PROShine
Victory Road Leveling Script (Help) - Printable Version

+- PROShine (https://proshine-bot.com)
+-- Forum: PROShine (https://proshine-bot.com/forum-5.html)
+--- Forum: Scripts (https://proshine-bot.com/forum-13.html)
+--- Thread: Victory Road Leveling Script (Help) (/thread-3334.html)



Victory Road Leveling Script (Help) - Gandalf - 2019-01-23

Hello, can anyone help? I edit this script, but after the first 3 Pokemon die, and the character leaves the "Victory Road Kanto 3F" location, he sees no further action and stops the bot. How can i fix this?

name = "Victory Road"
author = "Gandalf"
description = [[Start anywhere between the exit of the Victory Road and the Indigo Plateau.]]

function onPathAction()
   if not (isPokemonUsable(1)) and isPokemonUsable(2)   then
           swapPokemon(1,2)
   elseif not (isPokemonUsable(1)) and isPokemonUsable(3) then
           swapPokemon(1,3)
   elseif isPokemonUsable(1)or isPokemonUsable(2)or isPokemonUsable(3) then
       
       if getMapName() == "Indigo Plateau Center" then
           moveToCell(10, 28)
       elseif getMapName() == "Indigo Plateau" then
           moveToCell(21, 31)
       elseif getMapName() == "Victory Road Kanto 3F" then
           moveToRectangle(20, 29, 25, 35)
       end
   else
       if getMapName() == "Victory Road Kanto 3F" then
           moveToCell(46, 13)
       elseif getMapName() == "Indigo Plateau" then
           moveToCell(33, 12)
       elseif getMapName() == "Indigo Plateau Center" then
           talkToNpcOnCell(4, 22)
       end
   end
end

function onBattleAction()
   if isWildBattle() and isOpponentShiny() then
       if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then
           return
       end
   end
   if getActivePokemonNumber() == 1 then
       return attack() or sendUsablePokemon() or run() or sendAnyPokemon()
   else
       return run() or attack() or sendUsablePokemon() or sendAnyPokemon()
   end
end


RE: Victory Road Leveling Script (Help) - ssiaw12345 - 2019-01-24

I modified your code as follows, hope it can help you

function onPathAction()
first_usable=0
for i=1,3 do
if first_usable<1 and isPokemonUsable(i) then
first_usable=i
break
end
end
if first_usable==1 then
"Go to Fight!"
elseif first_usable>1 then
swapPokemon(1,first_usable)
else
"Go to Pokecenter"
end
end


RE: Victory Road Leveling Script (Help) - Gandalf - 2019-01-24

I'm sorry that I take your time, I just started editing scripts yesterday, and I do not understand much about it.
Now when adding your lines to the code, I get the following message:

[14:34:07] Could not load script Victory Road Complete.lua:
chunk_1: (14,9-23): unexpected symbol near 'Go to Fight!'

I tried to insert these lines in different ways but the result is one.


RE: Victory Road Leveling Script (Help) - ssiaw12345 - 2019-01-24

My strings, "Go to Fight!", "Go to Pokecenter", are not real code that can be run.
I means you should replace your code into these palces

function onPathAction()
first_usable=0
for i=1,3 do
if first_usable<1 and isPokemonUsable(i) then
first_usable=i
break
end
end
if first_usable==1 then
if getMapName() == "Indigo Plateau Center" then
moveToCell(10, 28)
elseif getMapName() == "Indigo Plateau" then
moveToCell(21, 31)
elseif getMapName() == "Victory Road Kanto 3F" then
moveToRectangle(20, 29, 25, 35)
end
elseif first_usable>1 then
swapPokemon(1,first_usable)
else
if getMapName() == "Victory Road Kanto 3F" then
moveToCell(46, 13)
elseif getMapName() == "Indigo Plateau" then
moveToCell(33, 12)
elseif getMapName() == "Indigo Plateau Center" then
UsePokecenter()
end
end
end


RE: Victory Road Leveling Script (Help) - Gandalf - 2019-01-24

I replaced, everything works fine, but after leaving Victory Road Kanto 3F, instead of going to the pokercenter, he stands still and stops.

[14:53:15] Position updated: Indigo Plateau (21, 30) [OK]
[14:53:22] No action executed: stopping the bot.
[14:53:22] Bot stopped


RE: Victory Road Leveling Script (Help) - ssiaw12345 - 2019-01-24

check the name of the map after the leaving Victory Road Kanto 3F.
there may be mistakes in the name in your code

I have read your logs, It looks fine.
I'm sorry that I don't know why

maybe you can add "print(getMapName() )" before "if getMapName() == "Victory Road Kanto 3F" then" to debug


RE: Victory Road Leveling Script (Help) - Gandalf - 2019-01-24

Okay, thanks, i try it