PDA

View Full Version : quest::delay(time)


narcberry
01-30-2008, 09:00 AM
I need a quest delay mechanism. Here is what I've learned:

quest::pause() does not work how I need, I'm unsure what it is for, probably for movement and waypoints.

perls built in sleep() function doesn't work when invoked by eqemu, I'm unsure why that is.

using the quest timers works, but I lose my reference to the pc that invoked the quest for some reason.


I've found 2 solutions in my searching, both years old. Scorpius2K customized their server to add a delay function, but it wasn't added into the eqemu source, and I have no idea what they did. The other was a while loop that iterated some million times to get a 10 second delay. I'm not a real fan of that solution.

If anyone has any ideas, or corrections to what I have encountered let me know. If I'm being retarded, I hope you wouldn't hesitate to tell me.

Theeper
01-30-2008, 01:56 PM
I am not sure of exactly what you need, but I use quest::settimer() and haven't noticed any problems with it losing track of the invoking PC.

Here is how I have used it in a couple custom scripts that seem to work fine for me on a 1085 build.


sub EVENT_SPAWN
{
quest::settimer("my_timer", 10);
}

sub EVENT_SAY
{
if ($text =~ /my timer/i)
{
quest::say("Starting 10 sec timer for $name.");
quest::settimer("my_timer", 10);
}
}

sub EVENT_TIMER
{
if($timer eq "my_timer")
{
quest::say("time is up for $name");
quest::stoptimer("my_timer");
}
}

narcberry
01-31-2008, 03:08 AM
In the event, I was trying to do a quest::movepc without success.

I now use
sub delay{
$delayOver = (time + @_[0]);
while (time < $delayOver){}
1;
}and call with
delay(seconds);

yeah, that is a while loop. yeah, it's icky. yeah, it's my permanent solution.