Hello There, Guest! Login Register


Crash of the app during a loop
#1
Hello, I have nerver try to make script before and Lua is the first language that I try to learn. I have a problem. When I integrated this:

while getPokemonLevel(1) <=14 do
            if getMapName() == "Pokecenter Viridian" then
                moveToMap("Viridian City")
            elseif getMapName() == "Viridian City" then
                moveToMap("Route 22")
            elseif getMapName() == "Route 22"  then
                moveToGrass()
            end
        end

the app always crash, can someone show me my mistake(s) please ? Smile
 
Reply
#2
When you mean crash, is there any crash report or does the script just stop?
The bot should never crash, no matter how incorrect the script is.

Anyway, you should not use a loop here. The function onPathAction is called whenever the bot is inactive and is only allowed to execute one action.
You should use a condition (if) instead of a loop (while).
 
Reply
#3
You're right sorry. When I run it, the bot just freeze ( program is not responding ) for 5 min and then script stop. And thanks for the fast answer Smile
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)