Author Topic: Tracking a blocking script [SOLVED]  (Read 644 times)

Chrille

  • Posts: 726
    • Chrille worked on a game that was nominated for an AGS Award!
      Chrille worked on a game that won an AGS Award!
Tracking a blocking script [SOLVED]
« on: 07 Apr 2010, 16:05 »
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?
« Last Edit: 08 Apr 2010, 17:29 by Chrille »
GASPOP software
http://www.gaspop.com

Jim Reed

  • Posts: 701
Re: Tracking a blocking script
« Reply #1 on: 07 Apr 2010, 16:28 »
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

  • Local Moderator
  • Posts: 8,851
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Re: Tracking a blocking script
« Reply #2 on: 07 Apr 2010, 16:31 »
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

  • Posts: 726
    • Chrille worked on a game that was nominated for an AGS Award!
      Chrille worked on a game that won an AGS Award!
Re: Tracking a blocking script [SOLVED]
« Reply #3 on: 08 Apr 2010, 17:36 »
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