Tracking a blocking script [SOLVED]

Started by Chrille, Wed 07/04/2010 16:05:24

Previous topic - Next topic

Chrille

I recently realised that something, somewhere in my game's is blocking the scripts. I would never have noticed this had it not been for the game's GUI. I'm using a gui button to display some animations in the game with dynamic sprites and such and occasionally the GUI greys out as it does when a blocking function is run. These periods are very brief, just a cycle or two it seems.

I could just set the GUI to not change its appearance if the game is blocked. But I don't like using blocking functions and I'd like to get to the bottom of this. I've looked through the script without finding anything that might cause it. There are no wait commands, no blocking move commands and no blocking animations that I could find.

I suspect that the cause might some while statements being tested when there are alot of characters on the screen. It would be really useful if I could trace at what line in which script the game was at while it was being blocked. Is there any way to script a function like this?
GASPOP software
http://www.gaspop.com

Jim Reed

I think pressing Scroll Lock while in the debug mode would show the script line currently being executed.
Not sure though, haven't used it in ages.

Gilbert

Unless there is a blocking function or Wait(), etc. inside the while loop, while loops should not be causing a blocking effect. Even if the loop is very intensive that some certain systems cannot do all the operations to complete the loop in one game frame's time the game will just pause at the current frame without advancing to the next frames (this could be very noticeable especially when you do a noloopcheck loop with very demanding computations) causing a lag.

So, if your game appears to be "blocked" (so that the game's frames are still being advanced, such as background frame animation playing and repeatedly_execute_always() still functioning) it should not be caused by a while loop solely.

Could it be other events or modules you use inyour game that cause these blocks?

Chrille

I found the problem. I'd made a function with a while loop that kept randomizing a value until the function approved it. That's why the game being blocked happened so randomly, since sometimes it would keep randomizing that value so many times that basically became a wait function.

It was a really poorly written temporary function, at least I know what was causing it!
GASPOP software
http://www.gaspop.com

SMF spam blocked by CleanTalk