![]() |
Function Call with Sleep in!
When calling a function from another object (TStaticVar, in my case) which has a sleep(); function called in it... The function doesn't return AND the function doesn't resume after the sleep delay.
|
Normally it should work, but not necessary how you expect it.
When the called function is doing sleep(), it is suspending the script and returning 0 as result. The suspended script will continue to run once the specified time is over. |
Quote:
|
Quote:
I called the function TWICE, but only the LAST one actually finished. Thus... When a function is called TWICE within the interval of the sleep, the function does return 0 (as suppose to), but when the sleep stops, only the LAST function resumes. |
There can be only one sleep per object, but in the next Graal version (and npcserver) you have a new command for suspending scripts waitfor(objectname,eventname,timeout) which can be used several times.
|
Quote:
Would that still return 0 on function-calls? Or it would suspend that as well? |
Still return 0 i think
|
So would this be able to suspend the advance of a script past a function until that function is completed?
Because I have a public function showInputWindow() and I want the executing function to stop there until you get a return from the input window. Its like what there is in Java. String s = JOptionPane.showInputDialog("Input a String"); |
Added that yesterday to the npcserver, will also try to add it to the client before the xmas release. Instead of sleep() you need to use the new waitfor() command though which is waiting for an event for an object. A sleep/waitfor will basicly suspend the current script and all callers and the callers will be woken up once the sleep/waitfor function returns regulary.
|
Quote:
Can you use remote objects or only local ones? It would be cool if bjects could catch another objects event and read parameters and such. |
Right now it's only suspending the script until the event happens, you cannot access the parameters of the event.
|
Nice, I eagerly await the update.
Oh btw, i'm having a problem. When I do: function onCreated() { echo("keys: " @ getstringkeys("clientr.")); } It returns null, this is only on the serverside and only when trying to get keys for any player or client stuff, everything else works fine. |
onCreated() in the player class? Is "this.clientr." working ?
|
Quote:
|
All times are GMT +2. The time now is 09:15 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.