2016-06-04, 12:50:44
(This post was last modified: 2016-06-04, 12:57:24 by LifeisTough.)
hi all,
I have scripted a function that simplify the code to verify all the pokemon name in a single line input
Parameter => listPokemon
Type => String
Description => Type in the pokemon name that needed to catch with comma (,) to split each of them
Code :
Sample:
Put it under the function of onBattleAction()
Code to Put:
I have scripted a function that simplify the code to verify all the pokemon name in a single line input
Parameter => listPokemon
Type => String
Description => Type in the pokemon name that needed to catch with comma (,) to split each of them
Code :
function catchListedPokemon(listPokemon)
-- Seperate each PokemonName by comma (,)
opponentPokemon = getOpponentName()
for pokemons in string.gmatch(listPokemon, "([^,]+)") do
if pokemons == opponentPokemon then
return true
end
end
return false
end
Sample:
catchListedPokemon("Zubat,Geodude,Onix")
Put it under the function of onBattleAction()
Code to Put:
if isWildBattle() and (isOpponentShiny() or catchListedPokemon("Zubat,Geodude,Onix")) then
if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then
return
end
end