Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-13-2013, 07:41 PM
quido
Fire Beetle
 
Join Date: Oct 2009
Posts: 16
Default

I tried getting this to work by putting all the functionality within the client class.

I added a public function InitiateEncounter in client.h with no return or parameters.

I added a dummy definition for InitiateEncounter in client.cpp.

In perl_client.cpp I copied, pasted, and modified what I thought was an appropriate XS routine:

Code:
XS(XS_Client_InitiateEncounter);
XS(XS_Client_InitiateEncounter)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: Client::InitiateEncounter(THIS)");
	{
		Client *		THIS;

		if (sv_derived_from(ST(0), "Client")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(Client *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type Client");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->InitiateEncounter();
	}
	XSRETURN_EMPTY;
}
And I added my routine at the bottom of the list in perl_client.cpp
Code:
newXSproto(strcpy(buf, "InitiateEncounter"), XS_Client_InitiateEncounter, file, "$");

Then my script:
Code:
sub EVENT_COMBAT {
	if ($combat_state == 1)
	{
		quest::shout("you super stink!!!");
		quest::shout("you stink!!!");
		$client->InitiateEncounter();
		quest::shout("you so bad!!!");
	}
	else
	{
		quest::shout("eat me");
	}
}
What am I missing here?
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:27 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3