Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Alternative to sleep() (https://forums.graalonline.com/forums/showthread.php?t=134267611)

brokk 12-21-2012 03:26 AM

Alternative to sleep()
 
I was wondering if there was an alternative to the sleep() function.

If I'm not mistaken, sleep pretty much just pauses the functions of the script.

DoThis;
DoThat;
sleep(1); <-- pauses for one second
DoSomethingElse;

I know it's a dumb question but I'm running into problems in my movement using sleep so I need another code that pauses a line in script.

cbk1994 12-21-2012 03:51 AM

Post your code? The only thing I can think of is that you're not taking into account that sleep drops player scope (i.e. you can't reference the player via "player" after sleep or waitfor).

Gunderak 12-21-2012 04:56 AM

Try this.
PHP Code:

temp.time 4//The time in seconds to "sleep".
waitfor(this"nothing"time); 

Doing this will pause at the current code block but I think will still continue to execute any scheduleevents or timeouts.


All times are GMT +2. The time now is 04:17 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.