Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: WalktoCeres on October 13, 2013, 12:34:57 pm

Title: Hanging Script Help (RMXP)
Post by: WalktoCeres on October 13, 2013, 12:34:57 pm
Hello,

I'm in pretty dire need for an expert to overlook my scripts for lag prone areas that may inflict the dreaded hanging script hiccup. I've released a game but unfortunately some players are stopped by the script error whereas others are not(probably on the basis of their computer's speed). Is there anyone I can PM my script base for help?

All the best and thank you,

:ninja:
Title: Re: Hanging Script Help (RMXP)
Post by: ForeverZer0 on October 13, 2013, 01:52:00 pm
A demo project, upload of your Scripts.rxdata, or at the very least a list of scripts would be helpful.
A hanging script just means that Graphics.update has not been called in a reasonable amount of time, usually when a script is caught in a loop that it can't escape from.
Title: Re: Hanging Script Help (RMXP)
Post by: WalktoCeres on October 13, 2013, 04:50:47 pm
A choir of singing thanks for your reply. Here's a link to my scripts: http://www.filedropper.com/scripts_1

From what I've heard the hanging script typically takes place in battle. I have no way of verifying this because my computer has no troubles running the game.
Title: Re: Hanging Script Help (RMXP)
Post by: KK20 on October 13, 2013, 05:16:23 pm
It'd help more if the players reported a bit more information than "It happened during a battle." I'm quickly scanning through all the loops in the scripts and see nothing yet.
Title: Re: Hanging Script Help (RMXP)
Post by: WalktoCeres on October 13, 2013, 05:43:06 pm
That's my issue aswell. My guess is that the game's hp bar script is calculating the change in hp too slowly in some cases, but this seems unlikely at the same time because the script is so tiny. Is there anywhere that looks liable enough to create problems to stick a 'graphics update' under just as a safeguard? 
Title: Re: Hanging Script Help (RMXP)
Post by: ForeverZer0 on October 13, 2013, 11:29:43 pm
All the Graphics.update will do is keep the game from crashing, it would just be frozen instead if you place it where the problem is found.  The "Script is hanging" error is meant to be there, and built-in to prevent the game from freezing for eternity.
Title: Re: Hanging Script Help (RMXP)
Post by: KK20 on October 13, 2013, 11:39:58 pm
It can't be computer performance. Your players must be doing something unique that's causing this. Where's your game anyways?
Title: Re: Hanging Script Help (RMXP)
Post by: WalktoCeres on October 15, 2013, 05:06:09 pm
The game's title is 'Gingiva': http://rpgmaker.net/games/4427/
Title: Re: Hanging Script Help (RMXP)
Post by: Heretic86 on October 16, 2013, 05:11:31 pm
I'll try to explain as best as I can.

Updates are cheap timewise, mostly.

Refreshes draw the Graphics and are Time Consuming.

Infinite hangs:

update until 1 == 0
  #do something
end

This will cause an Infinite loop.

You can try putting "print" inside the script you are using in either its Update or Refresh methods and might be able to find for yourself where your script is hanging.

NOTE:  If the script you are using is calling Refresh every Frame, you'll get a LOT of lag.  Refresh should really only be used when something needs to be completely redrawn, like you change a character Graphic from one graphic to a completely different Graphic.  So what could be causing Hanging is something like this:

def update
  # Redraw the Graphic
  graphic.refresh
  # Other Stuff
end

def refresh
   self.contents.clear
   bar.draw(some arguments)
end

I do suspect you have something that is causing an infinite loop however.

while 1 == 1
  # do stuff
end
graphic.refresh

That will never get to graphic.refresh because 1 is always equal to 1, and will cause the game to spit out the error "Script is hanging".