Hello There, Guest! Login Register


Working on Script to farm Electabuzz at Power Plant
#1
First of all, sorry for my bad English.


I eddited a script of Royal in order to farm lv and catch Electabuzz at Power Plant and refill balls also
But the Script have some problem that i didnt know.
Hope someone here could help me

You can start this script in Route 9, Route 10, Cerulean City, inside the Pokecenter there and inside the Pokemart.
The script will move to the next water spot and surf around there.
  • Catch every Shiny

  • Catch every Electabuzz

  • Leveling your first Pokemon

  • Buy Pokeballs

  • The script will use a Sync, a False Swiper and a Pokemon with a sleep attack to catch Shinies and Electabuzzs (You can set this to true or false)
Here's my script

-- ########################## 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 = false

-- Set the number of Pokeballs you would like to buy                      
quantity = 100    

itemName = "Pokeball"    

-- If you have less than the number what you entered then the bot will
-- buy new Pokeballs
atLeast = 15          
-- #############################

-- ##### 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 = false
-- #########################

-- ##### 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 = "Adamant"
-- Set the index of your second Sync Pokemon
indexOfSync2 = 2
-- Set the nature of your second Sync Pokemon
nature2 = "Modest"
-- 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 = "Hypnosis"
-- ############################################################

-- [[Below these lines is the Script if you haven't any experience about Lua scripting then don't change anything!]]
-- #########################################################################################################################

name = "Power Plant Electabuzz Farmer"
author = "Ladori"
description = [[Start the Script in Route 10, Cerulean City, Pokecenter Cerulean and Cerulean Pokemart.
It will catch any Shiny, any Electabuzz.
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
   end
   
   wildCounter = 0
   shinyCounter = 0
   electabuzzCounter = 0
   pokecenterCounter = 0
   shellderCounter = 0
   startingMoney = getMoney()
   pokeballCounter = 0
   pokemonsCaught = 0
   

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 | Electabuzz ecountered: " .. electabuzzCounter)
       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 stringContains(wild, "A Wild SHINY ") then
       shinyCounter = shinyCounter + 1
       wildCounter = wildCounter + 1
       useLogs()
   elseif wild == "A Wild [FF9900]Electabuzz[-] Attacks!" then
       squirtleCounter = electabuzzCounter + 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
end

function onPause()

   if usingLogs then
       log("Times in Pokecenter: " .. pokecenterCounter)
       log("Pokemons encountered: " .. wildCounter)
       log("Shinies encountered: " .. shinyCounter .. " (" .. 100 * (shinyCounter/wildCounter) .. "%)")
       log("Electabuzzs encountered: " .. electabuzzCounter .. " (" .. 100 * (electabuzzCounter/wildCounter) .. "%)")
       log("Pokedollars earned: "..tostring(getMoney() - startingMoney).." (" ..tostring((getMoney() - startingMoney)/wildCounter).." average)")
       log("Pokeballs used: " .. pokeballCounter)
   end
end

function onPathAction()

   -- Buying Pokeballs

   if getItemQuantity(itemName) < atLeast and buyingPokeballs == true then
       if getMapName() == "Cerulean City" then
           moveToMap("Cerulean Pokemart")
       elseif getMapName() == "Route 10" then
           moveToMap("Route 9")
       elseif getMapName() == "Route 9" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean Pokemart" and not isShopOpen() then
           talkToNpcOnCell(3, 5)
       elseif isShopOpen() then
           buyItem(itemName, quantity)
       end

   -- Normal Electabuzz, without Special Catch
   
   if usingSpecialCatch == false and isPokemonUsable(1) then
       if usingDebugLogs then
           log("Farming | Catch Electabuzz without Special Catch | Hunting Electabuzz")
       end
       if getMapName() == "Route 10" then
           moveToMap("Power Plant")
       elseif getMapName() == "Pokecenter Cerulean" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean Pokemart" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Vermilion City" then
           moveToMap("Route 9")
       elseif getMapName() == "Route 9" then
           moveToCell(93,33)
       if getMapName() == "Power Plant" then
           moveToRectangle(4,17,16,18)
       end
   if usingSpecialCatch == false and not isPokemonUsable(1) then
       if usingDebugLogs then
           log("Farming / Healing | Catch Electabuzz without Special Catch")
       end
       if getMapName() == "Power Plant" then
           moveToMap("Route 10")
       if getMapName() == "Route 10" then
           moveToMap("Route 9")
       if getMapName() == "Route 9" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean Pokemart" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean City" then
           moveToMap("Pokecenter Cerulean")
       elseif getMapName() == "Pokecenter Cerulean" then
           usePokecenter()
       end
   
   -- Electabuzz, with Special Catch

   if usingSpecialCatch 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 Electabuzz with Special Catch")
       end
       if getPokemonNature(1) ~= "Bold" then
           swapPokemon(indexOfSync2, indexOfSync1)
       if getMapName() == "Route 10" then
           moveToMap("Power Plant")
       elseif getMapName() == "Pokecenter Cerulean" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean Pokemart" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean City" then
           moveToMap("Route 9")
       elseif getMapName() == "Route 9" then
           moveToCell(93,33)
       if getMapName() == "Power Plant" then
           moveToRectangle(4,17,16,18)
       end
   if 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 Electabuzz with Special Catch")
       end
       if getMapName() == "Power Plant" then
           moveToMap("Route 10")
       if getMapName() == "Route 10" then
           moveToMap("Route 9")
       if getMapName() == "Route 9" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean Pokemart" then
           moveToMap("Cerulean City")
       elseif getMapName() == "Cerulean City" then
           moveToMap("Pokecenter Cerulean")
       elseif getMapName() == "Pokecenter Cerulean" then
           usePokecenter()
       end
   end

end

function onBattleAction()

   -- Using Special Catch

   if usingSpecialCatch and (isWildBattle() and (isOpponentShiny() or getOpponentName() == "Electabuzz")) 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() == "Electabuzz") 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() == "Electabuzz" 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() == "Electabuzz" then
       if usingDebugLogs then
           log("Battle | Run away from Pokemon")
       end
       return run() or sendUsablePokemon() or attack()
   end

end

and here the problem

[11:21:51 PM] Could not load script Electabuzz Farmer at Power Plant Buys ball test.lua: 

chunk_1Sad338,3): unexpected symbol near '<eof>'
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)