Hello There, Guest! Login Register


Help with script
#1
Hey guys,
I would like to have your help for this script.
I solved the problems step by step, but I don't know what to do against:
"chunk_1Sad36,2): 'end' expected near '<eof>' "
Thanks!

function onPathAction()


   if isPokemonUsable(2) and getRemainingPowerPoints(2, "False Swipe") >= 1 then
        if getMapName() == "Pokecenter Love Island" then
            moveToMap("Love island")
        elseif getMapName() == "Love Island" then
                        moveToGrass()
        end
    else
        if getMapName() == "Love island" then
            moveToMap("Pokecenter Love Island")
            elseif getMapName() == "Pokecenter Love Island" then
            usePokecenter()
        end
    end
end

function onBattleAction ()

    if isWildBattle() and ( isOpponentShiny() or getOpponentName() == "Doduo") then
        if getActivePokemonNumber() == 1 then
            useMove("False Swipe")
        if ( getOpponentHealth() > 1 ) then
            return SendPokemon(2)
        if useMove("Hypnosis") then
            return useItem("Pokeball") or UseItem("Great Ball") or UseItem("Ultra Ball") or sendAnyPokemon()
        end
    end
end
 
Reply
#2
function onBattleAction()
    
    if isWildBattle() and (isOpponentShiny() or getOpponentName() == "Doduo") then
        if getActivePokemonNumber() == 1 then
            if getOpponentHealth() > 1 then
                return useMove("False Swipe") or run() or sendAnyPokemon()
            else
                return sendPokemon(2) or run() or sendAnyPokemon()
            end
        else
            if getOpponentStatus() != "SLEEP" then
                return useMove("Hypnosis") or run() or sendAnyPokemon()
            else
                return useItem("Pokeball") or UseItem("Great Ball") or UseItem("Ultra Ball") or run() or sendAnyPokemon()
            end
        end
    end
    
end
 
Reply
#3
First thanks Zonz for the effort, but there are some complications with this script.
First: Fleeing from Doduo's
Second: After encounting an other pokemon (except doduo) bot stops
Third: Script just works, if pokemon with ("false swipe") is in the sec. slot...doesn' make sense at all

Could you explain it to me?

Best regards
Sapphir
 
Reply
#4
-- Index of Pokemon with False Swipe
swiper = 2

-- Index of Pokemon with Hypnosis
sleeper = 3

function onBattleAction()
    
    if isWildBattle() and (isOpponentShiny() or getOpponentName() == "Doduo") then
        if getOpponentHealth() > 1 then
            if getActivePokemonNumber() != swiper then
                return sendPokemon(swiper) or run() or sendAnyPokemon()
            else
                return useMove("False Swipe") or run() or sendAnyPokemon()
            end
        elseif getOpponentStatus() != "SLEEP" then
            if getActivePokemonNumber() != sleeper then
                return sendPokemon(sleeper) or run() or sendAnyPokemon()
            else
                return useMove("Hypnosis") or run() or sendAnyPokemon()
            end
        else
            return useItem("Pokeball") or UseItem("Great Ball") or UseItem("Ultra Ball") or run() or sendAnyPokemon()
        end
    else
        return run() or attack() or sendAnyPokemon()
    end
    
end
 
Reply
#5
So far so good, but there seems to be a problem of the execution with the Ultra Ball:
"Error during the script execution: chunk_1Sad46,12-117): attempt to call a nil value"
 
Reply
#6
I didn't notice this before, but the useItem function for Great Ball and Ultra Ball has a capital U. Just make them lowercase.
 
Reply
#7
I am more than satisfied. Thanks for the help!
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)