Hello There, Guest! Login Register


Templates | .lua
#1
Counter Template | .lua

I noticed some guys have problems with including correct counters in their scripts. So I'd like to show you how you include them correctly in your scripts.
The counters will be visible if you pause the bot.
If you got any questions or found any bugs feel free to contact me.

Simple Counter:

[XX:XX:XX] Your Pokemon1 gained X level during the bot time.
[XX:XX:XX] Your Pokemon2 gained X level during the bot time.
[XX:XX:XX] Your Pokemon3 gained X level during the bot time.
[XX:XX:XX] Your Pokemon4 gained X level during the bot time.
[XX:XX:XX] Your Pokemon5 gained X level during the bot time.
[XX:XX:XX] Your Pokemon6 gained X level during the bot time.
[XX:XX:XX] Pokedollars earned: X
[XX:XX:XX] Shinies Caught: X
[XX:XX:XX] Pokemons encountered: X
[XX:XX:XX] Times in Pokecenter: X

[Image: 57e4fd7b135f4a1e839ac392ee7d539e.jpg]

function onStart()
    levelOfTheFirst = getPokemonLevel(1)
    levelOfTheSecond = getPokemonLevel(2)
    levelOfTheThird = getPokemonLevel(3)
    levelOfTheFourth = getPokemonLevel(4)
    levelOfTheFifth = getPokemonLevel(5)
    levelOfTheSixth = getPokemonLevel(6)
    startMoney = getMoney()
    shinyCounter = 0
    pokecenterCounter = 0
    wildCounter = 0
end

function onDialogMessage(pokecenter)
    if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
        pokecenterCounter = pokecenterCounter + 1
    end
end

function onBattleMessage(wild)
    if stringContains(wild, "A Wild SHINY ") then
        shinyCounter = shinyCounter + 1
    elseif stringContains(wild, "A Wild ") then
        wildCounter = wildCounter + 1
    end
end

function onPause()
    log("Your ".. getPokemonName(1) .." gained " .. (getPokemonLevel(1) - levelOfTheFirst) .. " level during the bot time.")
    log("Your ".. getPokemonName(2) .." gained " .. (getPokemonLevel(2) - levelOfTheSecond) .. " level during the bot time.")
    log("Your ".. getPokemonName(3) .." gained " .. (getPokemonLevel(3) - levelOfTheThird) .. " level during the bot time.")
    log("Your ".. getPokemonName(4) .." gained " .. (getPokemonLevel(4) - levelOfTheFourth) .. " level during the bot time.")
    log("Your ".. getPokemonName(5) .." gained " .. (getPokemonLevel(5) - levelOfTheFifth) .. " level during the bot time.")
    log("Your ".. getPokemonName(6) .." gained " .. (getPokemonLevel(6) - levelOfTheSixth) .. " level during the bot time.")
    log("Pokedollars earned: "..tostring(getMoney() - startMoney))
    log("Shinies Caught: " .. shinyCounter)
    log("Pokemons encountered: " .. wildCounter)
    log("Times in Pokecenter: " .. pokecenterCounter)
end

Advanced Counter:

[XX:XX:XX] Snubull Counter: X
[XX:XX:XX] Tauros Counter: X
[XX:XX:XX] Shinies Caught: X
[XX:XX:XX] Pokemons encountered: X
[XX:XX:XX] Times in Pokecenter: X
[XX:XX:XX] Pokedollars earned: X
[XX:XX:XX] Your Pokemon1 gained X level during the bot time.
[XX:XX:XX] Your Pokemon2 gained X level during the bot time.
[XX:XX:XX] Your Pokemon3 gained X level during the bot time.
[XX:XX:XX] Your Pokemon4 gained X level during the bot time.
[XX:XX:XX] Your Pokemon5 gained X level during the bot time.
[XX:XX:XX] Your Pokemon6 gained X level during the bot time.

[Image: 57e4fd7b135f4a1e839ac392ee7d539e.jpg]

function onStart()
    levelOfTheFirst = getPokemonLevel(1)
    levelOfTheSecond = getPokemonLevel(2)
    levelOfTheThird = getPokemonLevel(3)
    levelOfTheFourth = getPokemonLevel(4)
    levelOfTheFifth = getPokemonLevel(5)
    levelOfTheSixth = getPokemonLevel(6)
    startMoney = getMoney()
    shinyCounter = 0
    pokecenterCounter = 0
    wildCounter = 0
    farfetchCounter = 0
    hoothootCounter = 0
    magnemiteCounter = 0
    meowthCounter = 0
    miltankCounter = 0
    noctowlCounter = 0
    raticateCounter = 0
    snubullCounter = 0
    taurosCounter = 0
end

function onDialogMessage(pokecenter)
    if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
        pokecenterCounter = pokecenterCounter + 1
    end
end

function onBattleMessage(wild)
        if stringContains(wild, "A Wild SHINY ") then
        shinyCounter = shinyCounter + 1
        wildCounter = wildCounter + 1
    elseif wild == "A Wild [FF9900]Snubull[-] Attacks!" then
        snubullCounter = snubullCounter + 1
        wildCounter = wildCounter + 1
    elseif wild == "A Wild [FF9900]Tauros[-] Attacks!" then
        taurosCounter = taurosCounter + 1
        wildCounter = wildCounter + 1
    end
end

function onPause()
    log("Snubull Counter: " .. snubullCounter)
    log("Tauros Counter: " .. taurosCounter)
    log("Shinies Caught: " .. shinyCounter)
    log("Pokemons encountered: " .. wildCounter)
    log("Times in Pokecenter: " .. pokecenterCounter)
    log("Pokedollars earned: "..tostring(getMoney() - startMoney))
    log("Your ".. getPokemonName(1) .." gained " .. (getPokemonLevel(1) - levelOfTheFirst) .. " level during the bot time.")
    log("Your ".. getPokemonName(2) .." gained " .. (getPokemonLevel(2) - levelOfTheSecond) .. " level during the bot time.")
    log("Your ".. getPokemonName(3) .." gained " .. (getPokemonLevel(3) - levelOfTheThird) .. " level during the bot time.")
    log("Your ".. getPokemonName(4) .." gained " .. (getPokemonLevel(4) - levelOfTheFourth) .. " level during the bot time.")
    log("Your ".. getPokemonName(5) .." gained " .. (getPokemonLevel(5) - levelOfTheFifth) .. " level during the bot time.")
    log("Your ".. getPokemonName(6) .." gained " .. (getPokemonLevel(6) - levelOfTheSixth) .. " level during the bot time.")
end


Swapping Template:

This function will swap your first Pokemon if this reached level 100 to another one which level is below 100.

[Image: 57e4fd7b135f4a1e839ac392ee7d539e.jpg]

function swapping()
    if getPokemonLevel(1) == 100 and getPokemonLevel(2) < 100 then
        log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(2))
        return swapPokemon(1, 2)
    elseif getPokemonLevel(1) == 100 and getPokemonLevel(2) == 100 and getPokemonLevel(3) < 100 then
        log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(3))    
        return swapPokemon(1, 3)
    elseif getPokemonLevel(1) == 100 and getPokemonLevel(2) == 100 and getPokemonLevel(3) == 100 and getPokemonLevel(4) < 100 then
        log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(4))    
        return swapPokemon(1, 4)
    elseif getPokemonLevel(1) == 100 and getPokemonLevel(2) == 100 and getPokemonLevel(3) == 100 and getPokemonLevel(4) == 100 and getPokemonLevel(5) < 100 then
        log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(5))    
        return swapPokemon(1, 5)
    elseif getPokemonLevel(1) == 100 and getPokemonLevel(2) == 100 and getPokemonLevel(3) == 100 and getPokemonLevel(4) == 100 and getPokemonLevel(5) == 100 and getPokemonLevel(6) < 100 then
        log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(6))    
        return swapPokemon(1, 6)
    elseif getPokemonLevel(1) == 100 and getPokemonLevel(2) == 100 and getPokemonLevel(3) == 100 and getPokemonLevel(4) == 100 and getPokemonLevel(5) == 100 and getPokemonLevel(6) == 100 then
        log("Every Pokemon reached Level 100!")
                doSwapping = false
    end
end

Little example how you include them in your script:

function onPathAction()
    if getPokemonLevel(1) == 100 and doSwapping == true then
        swapping()
    elseif isPokemonUsable(1) then
        if getMapName() == "Indigo Plateau Center" then
            moveToMap("Indigo Plateau")
        elseif getMapName() == "Indigo Plateau" then
            moveToMap("Victory Road Kanto 3F")
        elseif getMapName() == "Victory Road Kanto 3F" then
            moveToRectangle(46, 14, 47, 22)
        end
    elseif not isPokemonUsable(1) then
        if getMapName() == "Victory Road Kanto 3F" then
            moveToMap("Indigo Plateau")
        elseif getMapName() == "Indigo Plateau" then
            moveToMap("Indigo Plateau Center")
        elseif getMapName() == "Indigo Plateau Center" then
            talkToNpcOnCell(4, 22)
        end
    end
end

Pokeballs Counter

This Counter will count the Pokeball's what you have used.

[Image: 57e4fd7b135f4a1e839ac392ee7d539e.jpg]

function onStart()
    pokeballCounter = 0
end

function onPause()
    log("Pokeball's used: " .. pokeballCounter)
end

function onBattleMessage(wild)
    if stringContains(wild, "You throw") then
        pokeballCounter = pokeballCounter + 1
    end
end

[Image: Credits_Royal.jpg]
  • BestKiller, thank you very much for these wonderful pictures!
  • Abra, without you I never had noticed that I have to use the hex-code for the Pokemon counter, thank you.
 
Reply
#2
Thanks.

In your "onStart" is an unexpected "end". Please remove it, otherwise this script will give you error
<eof> expected near 'end'
 
Reply
#3
Sharpadogge Thanks.

In your "onStart" is an unexpected "end". Please remove it, otherwise this script will give you error
<eof> expected near 'end'

My fault, thank you. Smile
 
Reply
#4
Can you do only for first pokemon of team, please? Thank you Big Grin
 
Reply
#5
jeanluke93 Can you do only for first pokemon of team, please? Thank you Big Grin

It's only for the first Pokemon in our Team or what did you exactly mean?
 
Reply
#6
[12:28:48] Celebi's ATK Gained - 0
[12:28:48] Celebi's DEF Gained - 0
[12:28:48] Celebi's SPD Gained - 32
[12:28:48] Celebi's SPATK Gained - 0
[12:28:48] Celebi's SPDEF Gained - 0
[12:28:48] Celebi's HP Gained - 0
[12:28:48] Celebi Gained 3 Levels during the Bot Session.
[12:28:48]
[12:28:48] Scyther's ATK Gained - 0
[12:28:48] Scyther's DEF Gained - 0
[12:28:48] Scyther's SPD Gained - 0
[12:28:48] Scyther's SPATK Gained - 0
[12:28:48] Scyther's SPDEF Gained - 0
[12:28:48] Scyther's HP Gained - 0
[12:28:48] Scyther Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Bronzong's ATK Gained - 0
[12:28:48] Bronzong's DEF Gained - 0
[12:28:48] Bronzong's SPD Gained - 0
[12:28:48] Bronzong's SPATK Gained - 0
[12:28:48] Bronzong's SPDEF Gained - 0
[12:28:48] Bronzong's HP Gained - 0
[12:28:48] Bronzong Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Milotic's ATK Gained - 0
[12:28:48] Milotic's DEF Gained - 0
[12:28:48] Milotic's SPD Gained - 0
[12:28:48] Milotic's SPATK Gained - 0
[12:28:48] Milotic's SPDEF Gained - 0
[12:28:48] Milotic's HP Gained - 0
[12:28:48] Milotic Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Slowbro's ATK Gained - 0
[12:28:48] Slowbro's DEF Gained - 0
[12:28:48] Slowbro's SPD Gained - 0
[12:28:48] Slowbro's SPATK Gained - 0
[12:28:48] Slowbro's SPDEF Gained - 0
[12:28:48] Slowbro's HP Gained - 0
[12:28:48] Slowbro Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Sudowoodo's ATK Gained - 0
[12:28:48] Sudowoodo's DEF Gained - 0
[12:28:48] Sudowoodo's SPD Gained - 0
[12:28:48] Sudowoodo's SPATK Gained - 0
[12:28:48] Sudowoodo's SPDEF Gained - 0
[12:28:48] Sudowoodo's HP Gained - 0
[12:28:48] Sudowoodo Gained 0 Levels during the Bot Session.
Only for Celebi not for all team
 
Reply
#7
jeanluke93
[12:28:48] Celebi's ATK Gained - 0
[12:28:48] Celebi's DEF Gained - 0
[12:28:48] Celebi's SPD Gained - 32
[12:28:48] Celebi's SPATK Gained - 0
[12:28:48] Celebi's SPDEF Gained - 0
[12:28:48] Celebi's HP Gained - 0
[12:28:48] Celebi Gained 3 Levels during the Bot Session.
[12:28:48]
[12:28:48] Scyther's ATK Gained - 0
[12:28:48] Scyther's DEF Gained - 0
[12:28:48] Scyther's SPD Gained - 0
[12:28:48] Scyther's SPATK Gained - 0
[12:28:48] Scyther's SPDEF Gained - 0
[12:28:48] Scyther's HP Gained - 0
[12:28:48] Scyther Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Bronzong's ATK Gained - 0
[12:28:48] Bronzong's DEF Gained - 0
[12:28:48] Bronzong's SPD Gained - 0
[12:28:48] Bronzong's SPATK Gained - 0
[12:28:48] Bronzong's SPDEF Gained - 0
[12:28:48] Bronzong's HP Gained - 0
[12:28:48] Bronzong Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Milotic's ATK Gained - 0
[12:28:48] Milotic's DEF Gained - 0
[12:28:48] Milotic's SPD Gained - 0
[12:28:48] Milotic's SPATK Gained - 0
[12:28:48] Milotic's SPDEF Gained - 0
[12:28:48] Milotic's HP Gained - 0
[12:28:48] Milotic Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Slowbro's ATK Gained - 0
[12:28:48] Slowbro's DEF Gained - 0
[12:28:48] Slowbro's SPD Gained - 0
[12:28:48] Slowbro's SPATK Gained - 0
[12:28:48] Slowbro's SPDEF Gained - 0
[12:28:48] Slowbro's HP Gained - 0
[12:28:48] Slowbro Gained 0 Levels during the Bot Session.
[12:28:48]
[12:28:48] Sudowoodo's ATK Gained - 0
[12:28:48] Sudowoodo's DEF Gained - 0
[12:28:48] Sudowoodo's SPD Gained - 0
[12:28:48] Sudowoodo's SPATK Gained - 0
[12:28:48] Sudowoodo's SPDEF Gained - 0
[12:28:48] Sudowoodo's HP Gained - 0
[12:28:48] Sudowoodo Gained 0 Levels during the Bot Session.
Only for Celebi not for all team

That's not my script. If you show me the full script I could edit it for you.
 
Reply
#8
Oh, you have right sorry. I took it here.
 
Reply
#9
jeanluke93 Oh, you have right sorry. I took it here.

name = " ..................  - ........................   with EVs earned STAT."
author = ".................   -  EVs Stat by ishanism"


function onStart()

    log ("The EVs stats script is made by ishanism. Kudos to him. Also credits to @pr4530dym1um for the idea and the log messages.")

    showStatsOnPause = true -- Change this to false if you don't want to see stats when the bot is paused.
    showStatsOnStop = true -- Change this to false if you don't want to see stats when the bot is stopped.

    startingMoney = getMoney()

    teamSize = getTeamSize()

    startingATK = {}
    startingDEF = {}
    startingSPD = {}
    startingSPATK = {}
    startingSPDEF = {}
    startingHP = {}
    startingLevel = {}

    startingATK[1] = getPokemonEffortValue(1, "ATK")
    startingDEF[1] = getPokemonEffortValue(1, "DEF")
    startingSPD[1] = getPokemonEffortValue(1, "SPD")
    startingSPATK[1] = getPokemonEffortValue(1, "SPATK")
    startingSPDEF[1] = getPokemonEffortValue(1, "SPDEF")
    startingHP[1] = getPokemonEffortValue(1, "HP")
    startingLevel[1] = getPokemonLevel(1)
end


function onPause()

    if showStatsOnPause == true then

        log ("Total amount of Pokedollars Earned is "..tostring(getMoney() - startingMoney))
        log ("")
        log ("" .. getPokemonName(1) .. "'s ATK Gained - "..tostring(getPokemonEffortValue(1, "ATK") - startingATK[1]))
        log ("" .. getPokemonName(1) .. "'s DEF Gained - "..tostring(getPokemonEffortValue(1, "DEF") - startingDEF[1]))
        log ("" .. getPokemonName(1) .. "'s SPD Gained - "..tostring(getPokemonEffortValue(1, "SPD") - startingSPD[1]))
        log ("" .. getPokemonName(1) .. "'s SPATK Gained - "..tostring(getPokemonEffortValue(1, "SPATK") - startingSPATK[1]))
        log ("" .. getPokemonName(1) .. "'s SPDEF Gained - "..tostring(getPokemonEffortValue(1, "SPDEF") - startingSPDEF[1]))
        log ("" .. getPokemonName(1) .. "'s HP Gained - "..tostring(getPokemonEffortValue(1, "HP") - startingHP[1]))
        log ("" .. getPokemonName(1) .. " Gained "..tostring(getPokemonLevel(1) - startingLevel[1]) .. " Levels during the Bot Session.")
        log ("")
        log("Bot Paused........  I can't guess if you will start the bot again. I am not a mind reader.")
    end

end

function onStop()

    if showStatsOnStop == true then

        log ("Total Poke$ earned :: "..tostring(getMoney() - startingMoney))
        log ("")
        log ("" .. getPokemonName(1) .. "'s ATK Gained - "..tostring(getPokemonEffortValue(1, "ATK") - startingATK[1]))
        log ("" .. getPokemonName(1) .. "'s DEF Gained - "..tostring(getPokemonEffortValue(1, "DEF") - startingDEF[1]))
        log ("" .. getPokemonName(1) .. "'s SPD Gained - "..tostring(getPokemonEffortValue(1, "SPD") - startingSPD[1]))
        log ("" .. getPokemonName(1) .. "'s SPATK Gained - "..tostring(getPokemonEffortValue(1, "SPATK") - startingSPATK[1]))
        log ("" .. getPokemonName(1) .. "'s SPDEF Gained - "..tostring(getPokemonEffortValue(1, "SPDEF") - startingSPDEF[1]))
        log ("" .. getPokemonName(1) .. "'s HP Gained - "..tostring(getPokemonEffortValue(1, "HP") - startingHP[1]))
        log ("" .. getPokemonName(1) .. " Gained "..tostring(getPokemonLevel(1) - startingLevel[1]) .. " Levels during the Bot Session.")
        log ("")
        log ("Bot Stopped..... Go play without bot now.")
    end

end
 
Reply
#10
Royal
jeanluke93 Oh, you have right sorry. I took it here.

name = " ..................  - ........................   with EVs earned STAT."
author = ".................   -  EVs Stat by ishanism"


function onStart()

    log ("The EVs stats script is made by ishanism. Kudos to him. Also credits to @pr4530dym1um for the idea and the log messages.")

    showStatsOnPause = true -- Change this to false if you don't want to see stats when the bot is paused.
    showStatsOnStop = true -- Change this to false if you don't want to see stats when the bot is stopped.

    startingMoney = getMoney()

    teamSize = getTeamSize()

    startingATK = {}
    startingDEF = {}
    startingSPD = {}
    startingSPATK = {}
    startingSPDEF = {}
    startingHP = {}
    startingLevel = {}

    startingATK[1] = getPokemonEffortValue(1, "ATK")
    startingDEF[1] = getPokemonEffortValue(1, "DEF")
    startingSPD[1] = getPokemonEffortValue(1, "SPD")
    startingSPATK[1] = getPokemonEffortValue(1, "SPATK")
    startingSPDEF[1] = getPokemonEffortValue(1, "SPDEF")
    startingHP[1] = getPokemonEffortValue(1, "HP")
    startingLevel[1] = getPokemonLevel(1)
end


function onPause()

    if showStatsOnPause == true then

        log ("Total amount of Pokedollars Earned is "..tostring(getMoney() - startingMoney))
        log ("")
        log ("" .. getPokemonName(1) .. "'s ATK Gained - "..tostring(getPokemonEffortValue(1, "ATK") - startingATK[1]))
        log ("" .. getPokemonName(1) .. "'s DEF Gained - "..tostring(getPokemonEffortValue(1, "DEF") - startingDEF[1]))
        log ("" .. getPokemonName(1) .. "'s SPD Gained - "..tostring(getPokemonEffortValue(1, "SPD") - startingSPD[1]))
        log ("" .. getPokemonName(1) .. "'s SPATK Gained - "..tostring(getPokemonEffortValue(1, "SPATK") - startingSPATK[1]))
        log ("" .. getPokemonName(1) .. "'s SPDEF Gained - "..tostring(getPokemonEffortValue(1, "SPDEF") - startingSPDEF[1]))
        log ("" .. getPokemonName(1) .. "'s HP Gained - "..tostring(getPokemonEffortValue(1, "HP") - startingHP[1]))
        log ("" .. getPokemonName(1) .. " Gained "..tostring(getPokemonLevel(1) - startingLevel[1]) .. " Levels during the Bot Session.")
        log ("")
        log("Bot Paused........  I can't guess if you will start the bot again. I am not a mind reader.")
    end

end

function onStop()

    if showStatsOnStop == true then

        log ("Total Poke$ earned :: "..tostring(getMoney() - startingMoney))
        log ("")
        log ("" .. getPokemonName(1) .. "'s ATK Gained - "..tostring(getPokemonEffortValue(1, "ATK") - startingATK[1]))
        log ("" .. getPokemonName(1) .. "'s DEF Gained - "..tostring(getPokemonEffortValue(1, "DEF") - startingDEF[1]))
        log ("" .. getPokemonName(1) .. "'s SPD Gained - "..tostring(getPokemonEffortValue(1, "SPD") - startingSPD[1]))
        log ("" .. getPokemonName(1) .. "'s SPATK Gained - "..tostring(getPokemonEffortValue(1, "SPATK") - startingSPATK[1]))
        log ("" .. getPokemonName(1) .. "'s SPDEF Gained - "..tostring(getPokemonEffortValue(1, "SPDEF") - startingSPDEF[1]))
        log ("" .. getPokemonName(1) .. "'s HP Gained - "..tostring(getPokemonEffortValue(1, "HP") - startingHP[1]))
        log ("" .. getPokemonName(1) .. " Gained "..tostring(getPokemonLevel(1) - startingLevel[1]) .. " Levels during the Bot Session.")
        log ("")
        log ("Bot Stopped..... Go play without bot now.")
    end

end

Thank you very much Smile
 
Reply
#11
[Image: Update_Royal.jpg]

Added a new template, feel free to use/edit it. Wink
 
Reply
#12
[Image: Update_Royal.jpg]

Added a new template, include them into your level script. Wink
 
Reply
#13
If you have any suggestions for a new kind of counter, feel free to tell me. Smile
 
Reply
#14
Used Pokeballs counter
God Karp Trainer loading... *splash*splash Huh

 
Reply
#15
redskhie Used Pokeballs counter

Alrigth, I added it. I haven't test it right now, if any error occurs tell me, I'll fix them.

Edit: Its working well. Wink
 
Reply
#16
elseif stringContains(wild, "A Wild ") then
        wildCounter = wildCounter + 1
I have change it to
elseif stringContains(wild, "A Wild Axew") then
        wildCounter = wildCounter + 1
and it didn't work @@ Axew count = 0. T.T What i need to fix sir
 
Reply
#17
lucarionew
elseif stringContains(wild, "A Wild ") then
        wildCounter = wildCounter + 1
I have change it to
elseif stringContains(wild, "A Wild Axew") then
        wildCounter = wildCounter + 1
and it didn't work @@ Axew count = 0. T.T What i need to fix sir

Take a look at the "Advanced Counter".

function onBattleMessage(wild)
        if stringContains(wild, "A Wild SHINY ") then
        shinyCounter = shinyCounter + 1
        wildCounter = wildCounter + 1
    elseif wild == "A Wild [FF9900]Snubull[-] Attacks!" then
        snubullCounter = snubullCounter + 1
        wildCounter = wildCounter + 1
    elseif wild == "A Wild [FF9900]Tauros[-] Attacks!" then
        taurosCounter = taurosCounter + 1
        wildCounter = wildCounter + 1
    end
end
 
Reply
#18
Thank you sorry for didn't notice your script. If u have time can explain me
[FF9900]Snubull[-]
what does it mean?
 
Reply
#19
lucarionew Thank you sorry for didn't notice your script. If u have time can explain me
[FF9900]Snubull[-]
what does it mean?

This is just the colour code. Wink
Without this the bot wouldn't 'see' the name which is displayed in the battle log .
 
Reply
#20
Nice Wink
 
Reply
#21
wanted to know how I can add the script to change my pokemon to another when it reaches a certain level, I wanted to combine that with one with this script but every time a Pokémon reaches the specified level change to the following.


function onPathAction()
    elseif isPokemonUsable(1) then
        if getMapName() == "Pokecenter Fuchsia" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Route 18")
        elseif getMapName() == "Route 18" then
            moveToGrass()
        end
    else
        if getMapName() == "Route 18" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Pokecenter Fuchsia")
        elseif getMapName() == "Pokecenter Fuchsia" then
            usePokecenter()
        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
 
Reply
#22
(2016-07-28, 12:24:54)Zenix wanted to know how I can add the script to change my pokemon to another when it reaches a certain level, I wanted to combine that with one with this script but every time a Pokémon reaches the specified level change to the following.


function onPathAction()
    elseif isPokemonUsable(1) then
        if getMapName() == "Pokecenter Fuchsia" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Route 18")
        elseif getMapName() == "Route 18" then
            moveToGrass()
        end
    else
        if getMapName() == "Route 18" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Pokecenter Fuchsia")
        elseif getMapName() == "Pokecenter Fuchsia" then
            usePokecenter()
        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

Hello, I know my answer is really late, however here is the solution:

function onStart()
    doSwapping = true
end

function onPathAction()
    if doSwapping == true and getPokemonLevel(1) == 20 then
        doSwapping()
    elseif isPokemonUsable(1) then
        if getMapName() == "Pokecenter Fuchsia" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Route 18")
        elseif getMapName() == "Route 18" then
            moveToGrass()
        end
    else
        if getMapName() == "Route 18" then
            moveToMap("Fuchsia City")
        elseif getMapName() == "Fuchsia City" then
            moveToMap("Pokecenter Fuchsia")
        elseif getMapName() == "Pokecenter Fuchsia" then
            usePokecenter()
        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

function swapping()
   if getPokemonLevel(1) >= 20 and getPokemonLevel(2) < 20 then
       log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(2))
       return swapPokemon(1, 2)
   elseif getPokemonLevel(1) >= 20 and getPokemonLevel(2) >= 20 and getPokemonLevel(3) < 20 then
       log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(3))    
       return swapPokemon(1, 3)
   elseif getPokemonLevel(1) >= 20 and getPokemonLevel(2) >= 20 and getPokemonLevel(3) >= 20 and getPokemonLevel(4) < 20 then
       log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(4))    
       return swapPokemon(1, 4)
   elseif getPokemonLevel(1) >= 20 and getPokemonLevel(2) >= 20 and getPokemonLevel(3) >= 20 and getPokemonLevel(4) >= 20 and getPokemonLevel(5) < 20 then
       log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(5))    
       return swapPokemon(1, 5)
   elseif getPokemonLevel(1) >= 20 and getPokemonLevel(2) >= 20 and getPokemonLevel(3) >= 20 and getPokemonLevel(4) >= 20 and getPokemonLevel(5) >= 20 and getPokemonLevel(6) < 20 then
       log("Change " .. getPokemonName(1) .. " with " .. getPokemonName(6))    
       return swapPokemon(1, 6)
   elseif getPokemonLevel(1) >= 20 and getPokemonLevel(2) >= 20 and getPokemonLevel(3) >= 20 and getPokemonLevel(4) >= 20 and getPokemonLevel(5) >= 20 and getPokemonLevel(6) >= 20 then
       log("Every Pokemon reached Level 20!")
           doSwapping = false
   end
end
 
Reply
#23
Here's my take on a couple of these templates. They can be consolidated into for loops.

-- Levels gained template


function onStart()
    pokemonTable = {}
    for i = 1, getTeamSize() do
        pokemonTable[i] = {}
        pokemonTable[i][0] = getPokemonName(i)
        pokemonTable[i][1] = getPokemonUniqueId(i)
        pokemonTable[i][2] = getPokemonLevel(i)
    end
end

function onPause()
    for i = 1, #pokemonTable do
        log("Your " .. pokemonTable[i][0] .. " gained " .. getLevelFromId(pokemonTable[i][1]) - pokemonTable[i][2] .. " level(s)!")
    end
end

function getLevelFromId(ID)    
    for i = 1, getTeamSize() do
        if getPokemonUniqueId(i) == ID then
            return getPokemonLevel(i)
        end
    end    
end




-- Swapping Template


function swapping(level)
    
    -- Can optionally pass a level to check for - if no number is passed, it will check for level 100
    
    level = level or 100

    if getPokemonLevel(1) < level then return end

    for i = 2, getTeamSize() do
        if getPokemonLevel(i) < level then
            log("Swapping " getPokemonName(1) .. " with " .. getPokemonName(i) .. ".")
            return swapPokemon(1, i)
        end
    end

    log("All Pokemon have reached level " .. level .. "!")

end
 
Reply
#24
(2016-12-25, 21:50:19)Zonz Here's my take on a couple of these templates. They can be consolidated into for loops.

-- Levels gained template


function onStart()
   pokemonTable = {}
   for i = 1, getTeamSize() do
       pokemonTable[i] = {}
       pokemonTable[i][0] = getPokemonName(i)
       pokemonTable[i][1] = getPokemonUniqueId(i)
       pokemonTable[i][2] = getPokemonLevel(i)
   end
end

function onPause()
   for i = 1, #pokemonTable do
       log("Your " .. pokemonTable[i][0] .. " gained " .. getLevelFromId(pokemonTable[i][1]) - pokemonTable[i][2] .. " level(s)!")
   end
end

function getLevelFromId(ID)    
   for i = 1, getTeamSize() do
       if getPokemonUniqueId(i) == ID then
           return getPokemonLevel(i)
       end
   end    
end




-- Swapping Template


function swapping(level)
    
    -- Can optionally pass a level to check for - if no number is passed, it will check for level 100
    
    level = level or 100

    if getPokemonLevel(1) < level then return end

    for i = 2, getTeamSize() do
        if getPokemonLevel(i) < level then
            log("Swapping " getPokemonName(1) .. " with " .. getPokemonName(i) .. ".")
            return swapPokemon(1, i)
        end
    end

    log("All Pokemon have reached level " .. level .. "!")

end

Thank you, looks great. Wink
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)