EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   quest::delay(time) (https://www.eqemulator.org/forums/showthread.php?t=24282)

narcberry 01-30-2008 09:00 AM

quest::delay(time)
 
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.

Code:

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
Code:

sub delay{
  $delayOver = (time + @_[0]);
  while (time < $delayOver){}
  1;
}

and call with
Code:

delay(seconds);
yeah, that is a while loop. yeah, it's icky. yeah, it's my permanent solution.


All times are GMT -4. The time now is 08:28 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.