Hello guys,
can someone help me to fix this 'loop' in the Squirtle-Farmer script by Royal?
I tired to fix it by myself but I can't figure out where this loop comes from...
the orginal code from his thread:
Logs:
thank you!
can someone help me to fix this 'loop' in the Squirtle-Farmer script by Royal?
I tired to fix it by myself but I can't figure out where this loop comes from...
the orginal code from his thread:
Show ContentCode:
-- ########################## CONFIG ##########################
-- ######### Change these lines for your own purpose ##########
-- ############################################################
-- ##### Logs #####
-- Set them to false if you don't want to use logs,
-- I would advise you to use logs, so you don't
-- need to login with the normal client
-- if you want to look if the bot catch any Shinies
usingLogs = true
-- If you encounter a bug this logs can help me to fix this bug,
-- so please turn this to true if you want to support this script
usingDebugLogs = true
-- ################
-- ##### Buying Pokeballs ######
-- Set them to false if you don't want to buy Pokeballs,
-- I would advise you to set them to true, so you won't miss
-- any Pokemon because you had not enough Pokeballs
buyingPokeballs = true
-- Set the number of Pokeballs you would like to buy
quantity = 50
itemName = "Pokeball"
-- If you have less than the number what you entered then the bot will
-- buy new Pokeballs
atLeast = 100
-- #############################
-- ##### Attack Config #####
-- Set them to true if you want to attack every Pokemon
-- set them to false if you want to run away from every Pokemon
attackPokemon = true
-- #########################
-- ##### Catch Config #####
-- If you set them to true the bot will use a Sync, a False Swiper and a Pokemon with sleep to catch every Pokemon
usingSpecialCatch = true
-- ########################
-- ##### Private Message #####
-- turn it to true if you want to disable private messages (recommend)
allowPrivateMessage = true
-- ###########################
-- ################## Special Catch Config ####################
-- ## Only change these lines if you activated special catch ##
-- Set the index of your first Sync Pokemon
indexOfSync1 = 1
-- Set the nature for your first Sync Pokemon
nature1 = "Bold"
-- Set the index of your second Sync Pokemon
indexOfSync2 = 6
-- Set the nature of your second Sync Pokemon
nature2 = "Adamant"
-- Set the index of your False Swiper
indexOfFalseSwiper = 3
-- Set the Index of your Sleeper
indexOfSleeper = 4
-- Set the Sleep Attack for your Sleeper
sleepAttack = "Sleep Powder"
-- ############################################################
-- ############## Night Config ##############
-- ## This config will happen if its Night ##
-- Set hunt Shellder to true if you want to hunt it in the night
huntShellder = true
-- Set the rod what you want to use
usingRod = "Good Rod"
-- ###########################################
-- [[Below these lines is the Script if you haven't any experience about Lua scripting then don't change anything!]]
-- #########################################################################################################################
name = "Vermilion Squirtle Farmer | Route 6 Shellder Farmer"
author = "Royal"
description = [[Start the Script in Route 6, Vermilion City, Pokecenter Vermilion and Vermilion Pokemart.
It will catch any Shiny, any Squirtle and any Shellder.
If you found any bugs or have any suggestions feel free to report it to me.]]
function onStart()
-- Display the Configurations if usingLogs is true
if usingLogs then
if buyingPokeballs then
log("Config | Buying Pokeballs is activated!")
log("Config | The bot will buy: " .. quantity .. " Pokeballs.")
log("Config | The bot moves to the next Pokemart if you have less then: " .. atLeast .. " Pokeballs.")
elseif buyingPokeballs == false then
log("Config | Buying Pokeballs is deactivated!")
end
if usingDebugLogs then
log("Config | Using Debug Logs is activated!")
elseif usingDebugLogs == false then
log("Config | Using Debug Logs is deactivated!")
end
if allowPrivateMessage then
log("Config | Private messages are disabled!")
elseif allowPrivateMessage == false then
log("Config | Private messages aren't disabled!")
end
if attackPokemon then
log("Config | The bot will attack every Pokemon!")
elseif attackPokemon == false then
log("Config | The bot will run away from every Pokemon!")
end
if usingSpecialCatch then
log("Config | The bot will use special catch feature!")
log("Config | Your first Sync Pokemon is on index " .. indexOfSync1 .. " and use the nature " .. nature1 .. ".")
log("Config | Your second Sync Pokemon is on index " .. indexOfSync2 .. " and use the nature " .. nature2 .. ".")
log("Config | Your false swiper is on index " .. indexOfFalseSwiper .. ".")
log("Config | Your sleeper is on index " .. indexOfSleeper .. " and use the Sleep Attack " .. sleepAttack .. ".")
elseif usingSpecialCatch == false then
log("Config | The bot won't use special catch feature!")
end
if huntShellder then
log("Config | Hunting Shellder is activated!")
log("Config | Used rod is " .. usingRod .. ".")
elseif huntShellder == false then
log("Config | Hunting Shellder is deactivated!")
end
end
wildCounter = 0
shinyCounter = 0
squirtleCounter = 0
poliwagCounter = 0
tentacoolCounter = 0
tentacruelCounter = 0
pokecenterCounter = 0
shellderCounter = 0
krabbyCounter = 0
magikarpCounter = 0
goldeenCounter = 0
startingMoney = getMoney()
pokeballCounter = 0
pokemonsCaught = 0
specialCase = false
specialShellder = true
if usingSpecialCatch == true and huntShellder == true then
specialShellder = true
else
specialShellder = false
end
end
if allowPrivateMessage then
if isPrivateMessageEnabled() then
disablePrivateMessage()
end
end
function useLogs()
if usingLogs then
log("Info | Pokemons encountered: " .. wildCounter)
log("Info | Shinies encountered: " .. shinyCounter)
log("Info | Squirtles ecountered: " .. squirtleCounter)
log("Info | Pokemons caught: " .. pokemonsCaught)
end
end
function useLogs2()
if usingLogs then
log("Info | Pokemons encountered: " .. wildCounter)
log("Info | Shinies encountered: " .. shinyCounter)
log("Info | Shellders ecountered: " .. shellderCounter)
log("Info | Pokemons caught: " .. pokemonsCaught)
end
end
function onDialogMessage(pokecenter)
if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
pokecenterCounter = pokecenterCounter + 1
if usingLogs then
log("Info | Times in Pokecenter: " .. pokecenterCounter)
end
end
end
function onBattleMessage(wild)
if not isNight() then
if stringContains(wild, "A Wild SHINY ") then
shinyCounter = shinyCounter + 1
wildCounter = wildCounter + 1
useLogs()
elseif wild == "A Wild [FF9900]Squirtle[-] Attacks!" then
squirtleCounter = squirtleCounter + 1
wildCounter = wildCounter + 1
useLogs()
elseif wild == "A Wild [FF9900]Poliwag[-] Attacks!" then
poliwagCounter = poliwagCounter + 1
wildCounter = wildCounter + 1
useLogs()
elseif wild == "A Wild [FF9900]Tentacool[-] Attacks!" then
tentacoolCounter = tentacoolCounter + 1
wildCounter = wildCounter + 1
useLogs()
elseif wild == "A Wild [FF9900]Tentacruel[-] Attacks!" then
tentacruelCounter = tentacruelCounter + 1
wildCounter = wildCounter + 1
useLogs()
elseif stringContains(wild, "A Wild ") then
wildCounter = wildCounter + 1
useLogs()
elseif stringContains(wild, "Pokedollar(s)") then
if usingLogs then
log("Info | Pokedollars earned: "..tostring(getMoney() - startingMoney).." (" ..tostring((getMoney() - startingMoney)/wildCounter).." average)")
end
elseif stringContains(wild, "Success!") then
pokemonsCaught = pokemonsCaught + 1
elseif stringContains(wild, "You throw") then
pokeballCounter = pokeballCounter + 1
end
elseif isNight() and huntShellder then
if stringContains(wild, "A Wild SHINY ") then
shinyCounter = shinyCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif wild == "A Wild [FF9900]Shellder[-] Attacks!" then
shellderCounter = shellderCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif wild == "A Wild [FF9900]Goldeen[-] Attacks!" then
goldeenCounter = goldeenCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif wild == "A Wild [FF9900]Krabby[-] Attacks!" then
krabbyCounter = krabbyCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif wild == "A Wild [FF9900]Magikarp[-] Attacks!" then
magikarpCounter = magikarpCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif wild == "A Wild [FF9900]Poliwag[-] Attacks!" then
poliwagCounter = poliwagCounter + 1
wildCounter = wildCounter + 1
useLogs2()
elseif stringContains(wild, "A Wild ") then
wildCounter = wildCounter + 1
useLogs2()
elseif stringContains(wild, "Pokedollar(s)") then
if usingLogs then
log("Info | Pokedollars earned: "..tostring(getMoney() - startingMoney).." (" ..tostring((getMoney() - startingMoney)/wildCounter).." average)")
end
elseif stringContains(wild, "Success!") then
pokemonsCaught = pokemonsCaught + 1
elseif stringContains(wild, "You throw") then
pokeballCounter = pokeballCounter + 1
end
end
end
function onPause()
if usingLogs then
if not isNight() then
log("Times in Pokecenter: " .. pokecenterCounter)
log("Pokemons encountered: " .. wildCounter)
log("Shinies encountered: " .. shinyCounter .. " (" .. 100 * (shinyCounter/wildCounter) .. "%)")
log("Squirtles encountered: " .. squirtleCounter .. " (" .. 100 * (squirtleCounter/wildCounter) .. "%)")
log("Poliwags encountered: " .. poliwagCounter .. " (" .. 100 * (poliwagCounter/wildCounter) .. "%)")
log("Tentacools encountered: " .. tentacoolCounter .. " (" .. 100 * (tentacoolCounter/wildCounter) .. "%)")
log("Tentacruels encountered: " .. tentacruelCounter .. " (" .. 100 * (tentacruelCounter/wildCounter) .. "%)")
log("Pokedollars earned: "..tostring(getMoney() - startingMoney).." (" ..tostring((getMoney() - startingMoney)/wildCounter).." average)")
log("Pokeballs used: " .. pokeballCounter)
elseif huntShellder and isNight() then
log("Times in Pokecenter: " .. pokecenterCounter)
log("Pokemons encountered: " .. wildCounter)
log("Shinies encountered: " .. shinyCounter .. " (" .. 100 * (shinyCounter/wildCounter) .. "%)")
log("Shellders encountered: " .. shellderCounter .. " (" .. 100 * (shellderCounter/wildCounter) .. "%)")
log("Magikarps encountered: " .. magikarpCounter .. " (" .. 100 * (magikarpCounter/wildCounter) .. "%)")
log("Goldeens encountered: " .. goldeenCounter .. " (" .. 100 * (goldeenCounter/wildCounter) .. "%)")
log("Poliwags encountered: " .. poliwagCounter .. " (" .. 100 * (poliwagCounter/wildCounter) .. "%)")
log("Krabbys encountered: " .. krabbyCounter .. " (" .. 100 * (krabbyCounter/wildCounter) .. "%)")
log("Pokedollars earned: "..tostring(getMoney() - startingMoney).." (" ..tostring((getMoney() - startingMoney)/wildCounter).." average)")
log("Pokeballs used: " .. pokeballCounter)
end
end
end
function onPathAction()
-- Switching Syncs
if specialShellder and not isNight() and getPokemonNature(1) ~= nature1 then
swapPokemon(indexOfSync2, indexOfSync1)
if usingDebugLogs then
log("Switching Sync 2 with Sync 1")
end
elseif specialShellder and isNight() and getPokemonNature(1) ~= nature2 then
swapPokemon(indexOfSync1, indexOfSync2)
if usingDebugLogs then
log("Switching Sync 1 with Sync 2")
end
-- Buying Pokeballs
elseif getItemQuantity(itemName) < atLeast and buyingPokeballs == true then
if getMapName() == "Vermilion City" then
moveToMap("Vermilion Pokemart")
elseif getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion Pokemart" and not isShopOpen() then
talkToNpcOnCell(3, 5)
elseif isShopOpen() then
buyItem(itemName, quantity)
end
-- Normal Squirtle, without Special Catch and disabled hunting Shellder
elseif usingSpecialCatch == false and huntShellder == false and isPokemonUsable(1) then
if usingDebugLogs then
log("Farming | Catch Squirtle without Special Catch | Hunting Squirtle")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Pokecenter Vermilion" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToRectangle(10, 28, 17, 33)
end
elseif usingSpecialCatch == false and huntShellder == false and not isPokemonUsable(1) then
if usingDebugLogs then
log("Farming / Healing | Catch Squirtle without Special Catch")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Pokecenter Vermilion")
elseif getMapName() == "Pokecenter Vermilion" then
usePokecenter()
end
-- Normal Shellder, without Special Catch
elseif usingSpecialCatch == false and huntShellder and isNight() and isPokemonUsable(1) then
if usingDebugLogs then
log("Farming | Catch Squirtle and Shellder without Special Catch | Hunting Shellder")
end
if getMapName() == "Pokecenter Vermilion" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Route 6")
elseif getMapName() == "Route 6" then
if (getPlayerX() == 23 and getPlayerY() == 43) then
useItem(usingRod)
else
moveToCell(23, 43)
end
end
elseif not isPokemonUsable(1) and usingSpecialCatch == false then
if usingDebugLogs then
log("Farming / Healing | Catch Squirtle and Shellder without Special Catch")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Pokecenter Vermilion")
elseif getMapName() == "Pokecenter Vermilion" then
usePokecenter()
end
-- Squirtle, with Special Catch and without hunting Shellder
elseif usingSpecialCatch and huntShellder == false and not isNight() and isPokemonUsable(1) and isPokemonUsable(indexOfFalseSwiper) and isPokemonUsable(indexOfSleeper) and getRemainingPowerPoints(indexOfFalseSwiper, "False Swipe") >= 1 and getRemainingPowerPoints(indexOfSleeper, sleepAttack) >= 1 then
if usingDebugLogs then
log("Farming | Catch Squirtle with Special Catch")
end
if getPokemonNature(1) ~= "Bold" then
swapPokemon(indexOfSync2, indexOfSync1)
elseif getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Pokecenter Vermilion" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToRectangle(10, 28, 17, 33)
end
elseif huntShellder == false and not isPokemonUsable(1) or not isPokemonUsable(indexOfFalseSwiper) or not isPokemonUsable(indexOfSleeper) or getRemainingPowerPoints(indexOfFalseSwiper, "False Swipe") < 1 or getRemainingPowerPoints(indexOfSleeper, sleepAttack) < 1 then
if usingDebugLogs then
log("Farming / Healing | Catch Squirtle with Special Catch")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Pokecenter Vermilion")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Pokecenter Vermilion" then
usePokecenter()
end
-- Squirtle and Shellder with Special Catch
elseif (usingSpecialCatch and huntShellder and isNight() and isPokemonUsable(1) and isPokemonUsable(indexOfFalseSwiper) and isPokemonUsable(indexOfSleeper) and getRemainingPowerPoints(indexOfFalseSwiper, "False Swipe") >= 1 and getRemainingPowerPoints(indexOfSleeper, sleepAttack) >= 1) then
if usingDebugLogs then
log("Farming | Catch Squirtle and Shellder with Special Catch | Hunting Shellder")
end
if getMapName() == "Pokecenter Vermilion" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Route 6")
elseif getMapName() == "Route 6" then
if (getPlayerX() == 23 and getPlayerY() == 43) then
useItem(usingRod)
else
moveToCell(23, 43)
end
end
elseif (usingSpecialCatch and not isNight() and huntShellder and isPokemonUsable(1) and isPokemonUsable(indexOfFalseSwiper) and isPokemonUsable(indexOfSleeper) and getRemainingPowerPoints(indexOfFalseSwiper, "False Swipe") >= 1 and getRemainingPowerPoints(indexOfSleeper, sleepAttack) >= 1) then
if usingDebugLogs then
log("Farming | Catch Squirtle and Shellder with Special Catch | Hunting Squirtle")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToRectangle(10, 28, 17, 33)
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Pokecenter Vermilion" then
moveToMap("Vermilion City")
end
elseif not isPokemonUsable(1) or not isPokemonUsable(indexOfFalseSwiper) or not isPokemonUsable(indexOfSleeper) or getRemainingPowerPoints(indexOfFalseSwiper, "False Swipe") < 1 or getRemainingPowerPoints(indexOfSleeper, sleepAttack) < 1 then
if usingDebugLogs then
log("Farming / Healing | Catch Squirtle and Shellder with Special Catch")
end
if getMapName() == "Route 6" then
moveToMap("Vermilion City")
elseif getMapName() == "Vermilion City" then
moveToMap("Pokecenter Vermilion")
elseif getMapName() == "Vermilion Pokemart" then
moveToMap("Vermilion City")
elseif getMapName() == "Pokecenter Vermilion" then
usePokecenter()
end
end
end
function onBattleAction()
-- Using Special Catch
if usingSpecialCatch and (isWildBattle() and (isOpponentShiny() or getOpponentName() == "Squirtle" or getOpponentName() == "Shellder" or getOpponentName() == "Buizel")) then
if getActivePokemonNumber() == 1 then
if usingDebugLogs then
log("Battle | Sending False Swiper")
end
sendPokemon(indexOfFalseSwiper)
elseif ( getActivePokemonNumber() == indexOfFalseSwiper ) and (getOpponentHealth() > 1) then
if usingDebugLogs then
log("Battle | Using False Swipe")
end
return useMove("False Swipe") or useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball")
elseif ( getActivePokemonNumber() == indexOfFalseSwiper ) and (getOpponentHealth() == 1) then
if usingDebugLogs then
log("Battle | Sending Sleeper")
end
sendPokemon(indexOfSleeper)
elseif (getActivePokemonNumber() == indexOfSleeper) and (getOpponentStatus() ~= "SLEEP") then
if usingDebugLogs then
log("Battle | Using a Sleep Attack")
end
return useMove(sleepAttack) or useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball")
elseif (getActivePokemonNumber() == indexOfSleeper) and ( getOpponentStatus() == "SLEEP") then
if usingDebugLogs then
log("Battle | Using Pokeballs")
end
return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball")
end
-- Don't using Special Catch
elseif usingSpecialCatch == false and isWildBattle() and (isOpponentShiny() or getOpponentName() == "Squirtle" or getOpponentName() == "Shellder" or getOpponentName() == "Buizel") then
if usingDebugLogs then
log("Battle | Catch Pokemon (without Special Catch)")
end
return useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") or sendUsablePokemon() or run()
-- Attack Pokemon
elseif attackPokemon and isWildBattle() and not isOpponentShiny() or not getOpponentName() == "Squirtle" or not getOpponentName() == "Shellder" or getOpponentName() == "Buizel" then
if usingDebugLogs then
log("Battle | Attacking Pokemon")
end
return attack() or sendUsablePokemon() or run()
-- Run Away
elseif attackPokemon == false and isWildBattle() and not isOpponentShiny() or not getOpponentName() == "Squirtle" or not getOpponentName() == "Shellder" or not getOpponentName() == "Buizel" then
if usingDebugLogs then
log("Battle | Run away from Pokemon")
end
return run() or sendUsablePokemon() or attack()
end
end
Logs:
Show ContentLoop Log:
[14:16:31] Bot started
[14:16:31] Config | Buying Pokeballs is activated!
[14:16:31] Config | The bot will buy: 50 Pokeballs.
[14:16:31] Config | The bot moves to the next Pokemart if you have less then: 100 Pokeballs.
[14:16:31] Config | Using Debug Logs is activated!
[14:16:31] Config | Private messages are disabled!
[14:16:31] Config | The bot will attack every Pokemon!
[14:16:31] Config | The bot will use special catch feature!
[14:16:31] Config | Your first Sync Pokemon is on index 1 and use the nature Bold.
[14:16:31] Config | Your second Sync Pokemon is on index 6 and use the nature Adamant.
[14:16:31] Config | Your false swiper is on index 3.
[14:16:31] Config | Your sleeper is on index 4 and use the Sleep Attack Sleep Powder.
[14:16:31] Config | Hunting Shellder is deactivated!
[14:16:31] Farming / Healing | Catch Squirtle with Special Catch
[14:16:35] Farming / Healing | Catch Squirtle with Special Catch
[14:16:35] Good afternoon, Trainer!
[14:16:35] Welcome to Vermilion CIty Pokemon Center.
[14:16:35] Info | Times in Pokecenter: 1
[14:16:35] Would you like me to heal your Pokemon?
[14:16:38] Okay, let me take a look at those Pokemon.
[14:16:45] There you go, take care of them!
[14:16:45] Have a nice afternoon!
[14:16:48] Farming / Healing | Catch Squirtle with Special Catch
[14:16:49] Good afternoon, Trainer!
[14:16:49] Welcome to Vermilion CIty Pokemon Center.
[14:16:49] Info | Times in Pokecenter: 2
[14:16:49] Would you like me to heal your Pokemon?
[14:16:52] Okay, let me take a look at those Pokemon.
[14:16:57] There you go, take care of them!
[14:16:57] Have a nice afternoon!
[14:17:01] Farming / Healing | Catch Squirtle with Special Catch
[14:17:01] Good afternoon, Trainer!
[14:17:01] Welcome to Vermilion CIty Pokemon Center.
[14:17:01] Info | Times in Pokecenter: 3
[14:17:01] Would you like me to heal your Pokemon?
[14:17:03] Okay, let me take a look at those Pokemon.
[14:17:07] There you go, take care of them!
[14:17:07] Have a nice afternoon!
[14:17:10] Farming / Healing | Catch Squirtle with Special Catch
[14:17:11] Good afternoon, Trainer!
[14:17:11] Welcome to Vermilion CIty Pokemon Center.
[14:17:11] Info | Times in Pokecenter: 4
[14:17:11] Would you like me to heal your Pokemon?
thank you!
