Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2009, 10:43 AM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

Some of the data is sent to the timer event, such as $name of player and $entity_list for the zone. I was specifically trying to functions for the client but those seemed to fail as well, strangely enough.
Code:
sub EVENT_TIMER
{
     quest::say("Hello $name");
     $c = $entity_list->GetClientByName($name);
     $charname = $c->GetName();
     quest::say("Hi $charname");
     $c->MovePC(1,1,1,1);
     $c->CastSpell(1,1);
}
Output:
Code:
NPC says, 'Hello JohnDoe'
NPC says, 'Hi JohnDoe'
*crickets*
*more crickets*
Not an actual script but prefect representation if all function input had valid data.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #2  
Old 06-19-2009, 05:58 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

not sure if this will fix it, but the client movepc function takes 5 parameters... zoneid, x, y, z, heading

and since movepc failed, castspell probably didn't even get called.
__________________
The Realm
Reply With Quote
  #3  
Old 06-19-2009, 06:10 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

Well that was just a sample of what would happen and would produce the same results each time, even if only one line per event_timer. The heading parameter is optional. The perl parser checks to see if there are 4 or 5 parameters, and a default is used if only 4 are present.

I just rewrote the quest functions to get the client by entity_list if initiator was not defined for my solution, as it appears not all data is exported when an event timer is triggered. Not sure how some people are reporting they are successfully using quest functions like selfcast and movepc in the EVENT_TIMER call.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #4  
Old 06-20-2009, 09:34 AM
Capheus
Hill Giant
 
Join Date: Apr 2008
Location: Milwaukee
Posts: 141
Default

Ok, trying to figure out what you are looking for. Here is another script that will allow you to use the client in sub EVENT_TIMER.

Code:
sub EVENT_SAY {

	if($text=~/hail/i) {
		
		quest::say("Would you like a [buff] or would you like to [goto] Crushbone?");
	}

	if($text=~/buff/i) {
		quest::say("Ok hold on while I get you the spell in my book.....");
		$theclienteid = $client->GetID();  #store client id
		$thename = $name;		   #store client name
		$theclient = $client;		   #store client
		quest::settimer("heal",10);
	}

	if($text=~/goto/i) {
		quest::say("Ok hold on while I find the right coordinates.....");
		quest::settimer("goto",10);
		$thename = $name;		   #store client name
		$theclient = $client;		   #store client
	}

}





sub EVENT_TIMER {

	if ($timer eq "heal") {
		quest::say("Found it! This should help $thename.");
		quest::stoptimer("heal");
		$theclient->CastSpell(26,$theclienteid); 	#casts skin like wood on self
	}
	
	if ($timer eq "goto") {
		quest::say("Off you go $thename!");
		quest::stoptimer("goto");
		$theclient->MovePC(58,143.4,-595.8,3.1,62.4);   #MovePC(zoneID, x, y, z, h)
	}
		
}
Reply With Quote
  #5  
Old 06-20-2009, 11:06 AM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

I'll give that a whurl Capheus. That's exactly what I was trying to do with little to no successful results. I'm starting to believe it has something to do with my highly customized build of Perl that I use for other applications. Thanks for taking the time to post your example.

I rewrote the timer trigger event so it tracks and always exports $client and $npc now so even the generic quest functions like quest::movepc() work now in EVENT_TIMER. I'll need to do more QA against it before distribution can be considered.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #6  
Old 06-20-2009, 05:06 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Just a minor note that might help a bit;

When exporting the client (or anything for that matter) to a timer, you always want to check for a NULL pointer before doing anything with it. Otherwise, if your client has died or left the zone, the zone will probably crash when you try to use the pointer later. Here is an example of what I mean from part of the script posted above:

Code:
if ($theclient && $theclienteid) {
  $theclient->CastSpell(26,$theclienteid); }
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #7  
Old 06-20-2009, 05:09 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

You most often don't get the crash if the player has left the zone since the perl client is checking to see if the reference is defined and IsClient() but when a player re-enters the zone with the timer still active, as their $entity_list id has changed.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
Reply

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 07:40 AM.


 

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