No Hang Script - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Material Development (https://www.save-point.org/forum-8.html) +--- Forum: Scripts Database (https://www.save-point.org/forum-39.html) +---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html) +---- Thread: No Hang Script (/thread-2482.html) |
No Hang Script - Zeriab - 03-06-2008 As many of you probably know you get a 'Script Hanging' error if a script takes too long to process. More accurately, if the Graphics.update is not called in about 10 seconds the engine will assume an endless loop or something similar has happen. It will therefore give the 'Script Hanging' error. This code snippet works by calling Graphics.update if this has not happened in a long time. A separate thread is running which checks up on the time. It should not affect the speed of the main thread in any significant way. It will not work if you have DLL calls which takes too long though. THIS IS A SCRIPT YOU DON'T JUST ADD Adding this script comes at the of your code becoming non-deterministic. This is bad, very bad. Also I do not have a monitor on critical parts, which gives the possibility of race conditions. I think that Graphics.update does have mutual exclusion, but I am not sure. And even if it has, what do you think happens if Graphics.update is called while you are in the process of creating a sprite? I expect this mainly to be for scripters to help their debugging and testing of stuff. Since the script will not call Graphics.update unless 4 seconds has passed since the last call to Graphics.update I do not expect it will have too much of an effect. Code: if @zer_no_hang_stack.nil? Use it wisely and only if there is an actual need. *hugs* - Zeriab |