![]() |
execution of the sleep command
I am trying to rescript parts of my action system. It currently runs on timeouts, but I'm trying to separate it into functions that I can put into the main part of my movement system (I know there are bugs in this version of the function, but unrelated).
I have: PHP Code:
the while-sleep loop continues, but all other scripts also continue. On subsequent executions it only executes one iteration. The setTimer in the movement NPC isn't being set until after all script execution is completed in the timeout loop. movement system calls attemptAction(), attemptAction() calls attemptJump() This is quite nasty I think. Why shouldn't I be able to delay stack execution within a timeout? |
I don't totally understand, but are you looking for..
PHP Code:
|
I'm trying to delay script execution on the stack.
meaning Stack: attemptJump--interior execution in a while-sleep loop, shouldn't return until the while-sleep loop has executed (the problem is that it does, or only runs through one iteration of while). attemptAction--waits for attemptJump execution until it returns movement main--waits for attemptAction to return until continuing other script executions. |
Actually I have never tried to use sleep() in a function called by another object, so I can imagine that there are problems. Designing the program to not rely on blocking functions would be better in the long way.
|
Quote:
Is it a problem with adding public functions to the stack? (I'd suspect it is) |
By design i mean you make the functionality before and after the attempted jump independent. I meant its better to do that in the long way because you also might depend on some serverside action or similar.
The sleep in an external script is having problems because it would need to store the state of several virtual machines. It's probably possible but slightly more complex. |
Quote:
|
| All times are GMT +2. The time now is 11:28 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.