Hello There, Guest! Login Register


I need help
#1
Smile 
My bot cant count dragonair and corphis it here:




function onStart()
    shinyCounter = 0
    wildCounter = 0
CorphishCounter = 0
DragonairCounter = 0
startingmoney = getMoney()
end
function onBattleMessage(wild)
    if stringContains(wild, "A Wild SHINY ") then
        shinyCounter = shinyCounter + 1
        wildCounter = wildCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
elseif stringContains(wild, "A Wild Corphish ") then
        CorphishCounter = CorphishCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
log("Info | Corphish encountered: " .. CorphishCounter)
elseif stringContains(wild, "A Wild Dragonair ") then
        DragonairCounter = DragonairCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
log("Info | Dragonair encountered: " .. DragonairCounter)
    elseif stringContains(wild, "A Wild ") then
        wildCounter = wildCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
log("Info | Dragonair encountered: " .. DragonairCounter)
log("Info | Corphish encountered: " .. CorphishCounter)
    end
end
function onPause()
    log("Info | Shineys encountered: " .. shinyCounter)
    log("Info | Pokemon encountered: " .. wildCounter)
log ("Pokedollars Earned - "..tostring(getMoney() - startingmoney))
end
function onStop()
    log("Info | Shineys encountered: " .. shinyCounter)
    log("Info | Pokemon encountered: " .. wildCounter)
log ("Pokedollars Earned - "..tostring(getMoney() - startingmoney))
end

function onPathAction()
if isPokemonUsable(1) and getPokemonHealthPercent(1) >= 50 then
if getMapName() == "Pokecenter Blackthorn" then
moveToMap("Blackthorn City")
elseif getMapName() == "Blackthorn City" then
moveToMap("Dragons Den Entrance")
elseif getMapName() == "Dragons Den Entrance" then
moveToMap("Dragons Den")
elseif getMapName() == "Dragons Den" then
moveToRectangle(32, 58, 47, 60)
end
else
if getMapName() == "Dragons Den" then
moveToMap("Dragons Den Entrance")
elseif getMapName() == "Dragons Den Entrance" then
moveToMap("Blackthorn City")
elseif getMapName() == "Blackthorn City" then
moveToMap("Pokecenter Blackthorn")
elseif getMapName() == "Pokecenter Blackthorn" then
usePokecenter()
end
end
end

function onBattleAction()
if isWildBattle() and isOpponentShiny() or getOpponentName() == "Dratini" or getOpponentName() == "Dragonair" or getOpponentName() == "Corphish" then
if useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball") 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
 
Reply
#2
Battle messages have a weird invisible coloring text that you have to look for when matching the opponent's name. Try using a system like this instead.

function onBattleMessage(wild)
    if stringContains(wild, "A Wild") then
        if getOpponentName() == "Dragonair" then
            DragonairCounter = DragonairCounter + 1
            log("Info | Dragonair encountered: " .. DragonairCounter)
        elseif getOpponentName() == "Corphish" then            
            CorphishCounter = CorphishCounter + 1
            log("Info | Corphish encountered: " .. CorphishCounter)
        end        
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
    end
end
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)