Save-Point
Script Hanging Error - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Script Hanging Error (/thread-5502.html)



Script Hanging Error - BeJeremiah - 06-04-2015

So, while i get why I am getting the error I have no idea how to fix it. I create the following method to make the player move slow in snow, shallow water, etc. However, after about 10-20 seconds of walking I get a script hanging error telling me there is either a loop issue (maybe) or something causing graphics not to update. Disregard the x,y that was for when i was using $game_map's terrain tag. Then I say the player has a dedicate terrain tag and just never removed the x,y.

Code:
 
def move_shallowly?
   # Save Player Position
   x, y = self.x, self.y
   # Check for Terrain Trigger
   tile_effect = self.terrain_tag
   autotile_names = $game_map.autotile_names
   if tile_effect == 1 # Deep snow, High Grass, bushes - Slow Down
     @move_speed = 2
     @move_frequency = 3
   end
 end

I have a similar method that speeds the player up and i have no issue. Any ideas for a solution?

Code:
 def move_normally?
   # Save Player Position
   x, y = self.x, self.y
   # Check for Terrain Trigger
   tile_effect = self.terrain_tag
   autotile_names = $game_map.autotile_names
   if tile_effect == 0 # Reset Non Status Effects
     if not running?
       @move_speed = 4
       @move_frequency = 5
     end
   end
 end



RE: Script Hanging Error - thephantom - 06-04-2015

Any reason why you removed the "if not running?" from the slow down script?


RE: Script Hanging Error - BeJeremiah - 06-04-2015

(06-04-2015, 07:14 AM)thephantom Wrote: Any reason why you removed the "if not running?" from the slow down script?

Never added it. You cant run in water, snow, etc anyway so no reason to check if you running. You have walk at max walk speed for 30 seconds before the system allow you to start sprinting (if you have the sprint talent). Which wont happen in water or snow unless I add snow shoes or walk on water or something like that.


RE: Script Hanging Error - Charlie Fleed - 06-07-2015

Why do you think the problem is in that method? It seems safe code.


RE: Script Hanging Error - BeJeremiah - 06-08-2015

Because it went away when I removed it and came back when i added it back. Strange thing, but it not a necessary method. Just useful for effect.


RE: Script Hanging Error - MechanicalPen - 06-08-2015

Maybe use the stacktracer this guy posted. http://save-point.org/thread-4760.html You may be crashing there, but something else could be causing the problem.


RE: Script Hanging Error - BeJeremiah - 06-09-2015

I totally agree with you all that it may be related to something else entirely, I will try that.


RE: Script Hanging Error - kyonides - 06-13-2015

I still think they forgot to mention something relatively important. Whenever you define a method as method? because you need to check any sort of conditions, it should never ever include any piece of code that could throw a result other than true or false and no executable code like assigning values to variables should be included.

# Save Player Position
x, y = self.x, self.y

It seems you are just assigning values to local variables that will be discarded at the end of the method execution. Why do you do that? Even if variable x were actually method x, that would make no sense at all, it's redundant, unnecessary, especially because nothing else inside that piece of code needs those values. Perhaps you should recreate your script in such a way that will make it more logical, methodical, etc. This is just my very humble opinion but I seriously think that starting anew might help you more by letting you better understand your current issues with your script and the way the script should be executed.


RE: Script Hanging Error - BeJeremiah - 06-17-2015

(06-13-2015, 06:56 AM)kyonides Wrote: I still think they forgot to mention something relatively important. Whenever you define a method as method? because you need to check any sort of conditions, it should never ever include any piece of code that could throw a result other than true or false and no executable code like assigning values to variables should be included.

# Save Player Position
  x, y = self.x, self.y

It seems you are just assigning values to local variables that will be discarded at the end of the method execution. Why do you do that? Even if variable x were actually method x, that would make no sense at all, it's redundant, unnecessary, especially because nothing else inside that piece of code needs those values. Perhaps you should recreate your script in such a way that will make it more logical, methodical, etc. This is just my very humble opinion but I seriously think that starting anew might help you more by letting you better understand your current issues with your script and the way the script should be executed.

Anything is worth a try. I take a look back at it.