Can't convert String into Integer error,but not always!

Hello , I used to have the same issue popping up sometimes, when I put a teleport . Always the same game_variable(19) , no idea what is it .(not even on my console log)


Most of the time I just put my teleport elsewhere or a different way and it works . But now , I got the same error when I'm trying to teleport on a map


once again , but this time I really want to fix it ! 

I can teleport 10 times on the same event nothing happens , but the 11th time , it does ... it is frustrating . Now I created an event and it is permanent , so this is


a good time to find the problem , do you know where I can start ? Please 🙁


Thank you ! 🙂

errorSuiko.png
Please provide a screenshot of the event where you use the commands


That said, this looks like somewhere else in your script you assign a text-string to that variable instead of a number, and when that happened and you try to use the variable in the teleport command the game crashes.


Since it doesn't happen every time, it is most likely done in either a parallel process in the background or in a plugin.


Please search all plugin configurations on where else that variable might be used.
$game_player.actor.walking_sprite_name =
'$[f7]Party_Riou_World'
$game_player.actor.walking_sprite_index = 0


So it was this script call this time , I put it after my teleport command and it works , but not before it, for some reason. 

This script call is for Orange Movement Script , and f7 is a multiframe from viktor 
 


PS: I'm using this call to change my character pose graphic (world map boat)
 


Maybe an issue with his script...
Go to your script and find Game_Variables and change it to look like this (from line 18):

Code:
def [](variable_id)
  p 'variable id is ' + variable_id.to_s
  @data[variable_id] || 0
end



Now enable the console (Game menu, Show Console) and play.  When you get the error, see what was printed out on the console as the last 'variable id is ...'


It would be strange for a script to do this - I'm wondering if you're using a command somewhere where the variable is contained inside another variable id, and THAT variable is being set to a string somewhere.  You can do this through script calls or through the Change Variable command in addition to actual scripts.


I don't think it is that script call that's doing it.
You can also use a script which uses that variable for some automatic process, and you use that same variable for something else too (in eventing or for another custom script).


That can trigger the error too, and that cause sounds the most possible for me. Many people forget which variables they used in their long forgotten custom scripts in the project.


You can shrink the amount of possible causes by checking if you ever set a variable to a string with events (people rarely do this, from what I saw).


If you do, start your search in those events, check the variable used, and change it to a different one.


If you don't do that ever in events, than the issue comes from a custom script for sure, so start your search there for any scripts which use variables for their operations.


I don't think that Orange Movement got anything to do with the error you get, and that script call you use should mess with any variables either. 


In any case, make sure to do what Shaz wrote, that is the quickest way to find the source of the error for sure.
To avoid the situation above, you should ALWAYS name your variables whenever you use one in an event or a script, or (for MV) in plugin parameters.  This ensures that all variables being used can be identified easily, and you'll never accidentally use one for different purposes.  This means whenever you add a script, you NEED to go through at least the top part with customization options, and see what variables and switches they are using, and name them if you're not using them for something else, or if you are, find one you're not using, name it, and change the script to use it.

Original thread: https://forums.rpgmakerweb.com/threads/cant-convert-string-into-integer-error-but-not-always.65180/