Hello There, Guest! Login Register


How to write your own Script in Lua
#26
(2016-09-12, 19:40:22)Pokermon
function onPathAction ()
    if isPokemonUsable(1) then
        if getMapName () == "Pokecenter Lilycove" then
            moveToMap ("Lilycove City")
        elseif getMapName () == "Lilycove City" then
            moveToMap ("Route 121")
        elseif getMapName () == "Route 121"
            moveToMap ("Hoenn Safari Zone Lobby")
        elseif getMapName () == "Hoenn Safari Zone Lobby" then
            moveToMap ("Hoenn Safari Zone 1")
        elseif getMapName () == "Hoenn Safari Zone 1" then
            moveToGrass ()
        end
    else
        if getMapName () == "Hoenn Safari Zone Lobby" then
            moveToMap "Route 121"
        elseif getMapName () == "Route 121" then
            moveToMap ("Lilycove City")
        elseif getMapName () == "Lilycove City" then
            moveToMap ("Pokecenter Lilycove")
        elseif getMapName () == "Pokecenter Lilycove" then
            usePokecenter ()

function onBattleAction ()
    if isWildBattle () and isOpponentShiny () or getOpponentName () == "Treecko" then
        if useItem ("Ultra Ball") or useItem ("Great Ball") or useItem ("Pokeball") then
            return
        end
    end
    return sendUsablePoemon () or run()
end

Am I a retard or what?

[20:38:02] Could not load script Treecko Pudding.txt:
chunk_1: (12,3-12): unexpected symbol near 'moveToMap'

You are missing a "then" here  elseif getMapName () == "Route 121"
 
Reply
#27
(2016-09-12, 21:18:23)FreddyFish
(2016-09-12, 19:40:22)Pokermon Am I a retard or what?

[20:38:02] Could not load script Treecko Pudding.txt:
chunk_1: (12,3-12): unexpected symbol near 'moveToMap'

You are missing a "then" here  elseif getMapName () == "Route 121"

Try out an editor plugin for lua "linting", it would catch syntax errors like this.
 
Reply
#28
Thanks, not sure how I missed that even with failed proof reading.
 
Reply
#29
(2016-09-13, 18:37:21)Pokermon Thanks, not sure how I missed that even with failed proof reading.

hehe!

You welcome mate. Smile
 
Reply
#30
Hey, nice guide but I find it kinda hard to understand how to write my own script, could you make a video or something? thanks!!
 
Reply
#31
my friend it is almost like a text

lets imagine you want staryu on route 20
-- Copyright sader fawall

name = "Staryu - route 20"
author = "sader fawall"
description = [[Start anywhere between Cinnabar Island and route 20.]]
usingRod = "Good Rod" --this one will tell that  that the 'variavel(i think is like this what they call??)' usingRod will be a "Good Rod"
function onPathAction() -- this is the function to tell what he will go , from place to place and terms like how much pokes you want alive or how much health should be certain pokemon
     if  getPokemonHealthPercent(1)>30 then -- in this case it say if first pokemon is below 30% it will go from between Cinnabar Pokecenter or Cinnabar island it will go to Route 20
        if getMapName() == "Pokecenter Cinnabar" then -- if is on  Pokecenter Cinnabar
            moveToMap("Cinnabar Island") -- i will move to Cinnabar island
        elseif getMapName() == "Cinnabar Island" then -- elseif is on Cinnabar Island
            moveToMap("Route 20") -- i will move to Route 20
        elseif getMapName() == "Route 20" then -- so if im at Route 20  
            if (getPlayerX() == 3 and getPlayerY() == 36) then -- and in this coordenats
                       useItem(usingRod) -- i will use the 'variable' usingRod
                   else
                   moveToCell(3, 36) -- if not in that coordenats i will move to there
           end
    end
    else
        if getMapName() == "Route 20" then -- samething but to go cure your pokes
            moveToMap("Cinnabar Island")
        elseif getMapName() == "Cinnabar Island" then
            moveToMap("Pokecenter Cinnabar")
        elseif getMapName() == "Pokecenter Cinnabar" then
            usePokecenter()
        end
    end
end

function onBattleAction() -- here you will write if you want to fight, send pokeballs, send another pokemon , use expecific moves and some more
    if isWildBattle() and ( isOpponentShiny() or getOpponentName() == "Staryu" )then -- if wild pokemon is shiny or a Staryu
        if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then -- i will send a pokeball
            return
        else
        return run() or sendUsablePokemon() or sendAnyPokemon() -- if not i will Run Away or send another pokemon to Run Away
        end
    else
        return  run() or sendUsablePokemon() or sendAnyPokemon() or run() -- if not i will Run Away or send another pokemon to Run Away ( to insist)
    end
end
 
Reply
#32
(2016-10-02, 23:20:50)kopopa my friend it is almost like a text

lets imagine you want staryu on route 20
-- Copyright sader fawall

name = "Staryu - route 20"
author = "sader fawall"
description = [[Start anywhere between Cinnabar Island and route 20.]]
usingRod = "Good Rod" --this one will tell that  that the 'variavel(i think is like this what they call??)' usingRod will be a "Good Rod"
function onPathAction() -- this is the function to tell what he will go , from place to place and terms like how much pokes you want alive or how much health should be certain pokemon
     if  getPokemonHealthPercent(1)>30 then -- in this case it say if first pokemon is below 30% it will go from between Cinnabar Pokecenter or Cinnabar island it will go to Route 20
        if getMapName() == "Pokecenter Cinnabar" then -- if is on  Pokecenter Cinnabar
            moveToMap("Cinnabar Island") -- i will move to Cinnabar island
        elseif getMapName() == "Cinnabar Island" then -- elseif is on Cinnabar Island
            moveToMap("Route 20") -- i will move to Route 20
        elseif getMapName() == "Route 20" then -- so if im at Route 20  
            if (getPlayerX() == 3 and getPlayerY() == 36) then -- and in this coordenats
                       useItem(usingRod) -- i will use the 'variable' usingRod
                   else
                   moveToCell(3, 36) -- if not in that coordenats i will move to there
           end
    end
    else
        if getMapName() == "Route 20" then -- samething but to go cure your pokes
            moveToMap("Cinnabar Island")
        elseif getMapName() == "Cinnabar Island" then
            moveToMap("Pokecenter Cinnabar")
        elseif getMapName() == "Pokecenter Cinnabar" then
            usePokecenter()
        end
    end
end

function onBattleAction() -- here you will write if you want to fight, send pokeballs, send another pokemon , use expecific moves and some more
    if isWildBattle() and ( isOpponentShiny() or getOpponentName() == "Staryu" )then -- if wild pokemon is shiny or a Staryu
        if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then -- i will send a pokeball
            return
        else
        return run() or sendUsablePokemon() or sendAnyPokemon() -- if not i will Run Away or send another pokemon to Run Away
        end
    else
        return  run() or sendUsablePokemon() or sendAnyPokemon() or run() -- if not i will Run Away or send another pokemon to Run Away ( to insist)
    end
end
I once used to bot with Macro which I video'ed my moves than played it, this is a little bit more complicated. Thanks for that, i'll review it in a bit.

one more question: after I write a script how to run it on the bot? cause till now I'm using already built ones so I just open them and nothing else, would love to get an explanation
 
Reply
#33
so you gonna start Proshine
[Image: 5d5a01fdad34a6eb45baae0899a53382.png]

click on login [Image: 34fe3f1787bacafac4741a0951e29b64.png]
put ur information[Image: e6de71896fb1438d424e3f291e39818c.png]

and click on this icon to search your script [Image: 05c3f065033347a1032cbcffea2b2414.png]

then search each one you want and [Image: 015b8db349d74cac0dc6bf72f19e1408.png]

then just click on start ^^

i think is this what u asked
 
Reply
#34
(2016-10-03, 07:22:04)kopopa so you gonna start Proshine
[Image: 5d5a01fdad34a6eb45baae0899a53382.png]

click on login [Image: 34fe3f1787bacafac4741a0951e29b64.png]
put ur information[Image: ceda1a338709cf7c8ab2b0c1b9920777.png]

and click on this icon to search your script [Image: 05c3f065033347a1032cbcffea2b2414.png]

then search each one you want and [Image: 015b8db349d74cac0dc6bf72f19e1408.png]

then just click on start ^^

i think is this what u asked

after I write the script in notepad++ I have to save as lua file?

will try to build my script later, it really looks dam hard

is there any money maker script I can learn from and build my own to my own map?
 
Reply
#35
well you can but no need it load .txt too Big Grin

a money maker is just a script that will kill any poke it find xD

man really it isn't hard , i just started to try script around 3weeks and i already can do almost everything i want
just read it with attention cause it is almost a composition in English you did back in school lel Big Grin
you can be confused now because you see == = > numbers etc , but man just look for 20min and you will see how easy this lovely guys did to us Big Grin
 
Reply
#36
(2016-10-03, 07:22:04)kopopa so you gonna start Proshine
[Image: 5d5a01fdad34a6eb45baae0899a53382.png]

click on login [Image: 34fe3f1787bacafac4741a0951e29b64.png]
put ur information[Image: ceda1a338709cf7c8ab2b0c1b9920777.png]

and click on this icon to search your script [Image: 05c3f065033347a1032cbcffea2b2414.png]

then search each one you want and [Image: 015b8db349d74cac0dc6bf72f19e1408.png]

then just click on start ^^

i think is this what u asked

DUDE, PS your account name off!!!! The PRO staff comes on this forum, and if they sees this, all your accounts are fucked.
 
Reply
#37
Exists a command to leave the battle if i found a specific pokemon?

A few mounths ago i started programing bots through other aplication that has a similar syntax that PROSHINE uses. So i succeed to read some lines properly. But im stucked on make that script.

I really want to learn how to make PROSHINE scripts to my own, but i need support this time.

Can someone help me?

Thanks.
 
Reply
#38
(2016-12-15, 16:32:08)Sabrina Exists a command to leave the battle if i found a specific pokemon?

A few mounths ago i started programing bots through other aplication that has a similar syntax that PROSHINE uses. So i succeed to read some lines properly. But im stucked on make that script.

I really want to learn how to make PROSHINE scripts to my own, but i need support this time.

Can someone help me?

Thanks.

Good morning,

so you want to leave the battle when a specific Pokemon is found? Just to be sure, you don't want to catch it just run away? If I understood you correctly the answer is yes.
Just include this below in your "onBattleAction()"

if getOpponentName() == "specific Pokemon" then
    return run()
end
 
Reply
#39
can anyone help me with this error ?
[4:26:04 PM] Could not load script Ev.txt:
chunk_1Sad15,0): unexpected symbol near '�'
Quote-- Copyright © 2016 Silv3r <silv3r@openmailbox.org>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
name = "SpAttack EV: Route 6, Water (near Vermilion)"
author = "Silv3r"
description = [[This script will train the first pokémon of your team.
It will only attack pokémon giving special attack EV.
It will also try to capture shinies by throwing pokéballs.
Start anywhere between Vermilion City and Route 6.
You need a pokémon with surf.]]
function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Vermilion" then
            moveToMap("Vermilion City")
        elseif getMapName() == "Vermilion City" then
            moveToMap("Route 6")
        elseif getMapName() == "Route 6" then
            moveToRectangle(15, 35, 30, 41)
        end
    else
        if getMapName() == "Route 6" then
            moveToMap("Vermilion City")
        elseif getMapName() == "Vermilion City" then
            moveToMap("Pokecenter Vermilion")
        elseif getMapName() == "Pokecenter Vermilion" 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 and (isOpponentEffortValue("SpAttack") or isOpponentEffortValue("HP")) then
        return attack() or run() or sendUsablePokemon() or sendAnyPokemon()
    else
        return run() or attack() or sendUsablePokemon() or sendAnyPokemon()
    end
end

function onLearningMove(moveName, pokemonIndex)
  name = getPokemonName(pokemonIndex)
  if name == "Pikachu" then
    return forgetAnyMoveExcept({"Electro Ball", "Discharge", "Thunder", "ThunderShock"})
    end
end
 
Reply
#40
If i had to guess i would say you have some invisible, not allowed character on line 15.
Try deleting the line and write it again.
Do the same with lines 14 and 16.
 
Reply
#41
This just has comments and a few extras to help guide nebies with copy and paste. its rough



name = "Route 101 Level-Script"
author = "Royal"
description = [[Levelling in Route 101 and catch every Shiny Pokemon!]]
-- 'This is a comment, Above is Basic Identifying info'
-- 'Below starts the script note isPokemonUsable has 4 meaning it will fight till 4th pokemon dies'
function onPathAction()
   if isPokemonUsable(4) then
    -- 'Typically start at pc. log in on game an find area it tells you the names'
    -- 'Then line with then is your current map below that is your future map'
       if getMapName() == "Pokecenter Oldale Town" then
           moveToMap("Oldale Town")
       elseif getMapName() == "Oldale Town" then
           moveToMap("Route 101")
       elseif getMapName() == "Route 101" then
           moveToGrass()
            -- 'Here you can define you walk pattern. please vist official lua script page on tutortials'
            -- 'Define a rectangle, log in to game, look at area you want to be in type like so ( xx, xx, xx, xx ) no tricks'
       end
   else
    -- 'Begining of loop'
       if getMapName() == "Route 101" then
           moveToMap("Oldale Town")
       elseif getMapName() == "Oldale Town" then
           moveToMap("Pokecenter Oldale Town")
       elseif getMapName() == "Pokecenter Oldale Town" then
           usePokecenter()
            log("hey you see this guy every loop if put here")
       end
   end
end
-- 'Battle Settup below'
function onBattleAction()
-- 'add pokemon name to catch'
   if isWildBattle() and isOpponentShiny() or getOpponent () =="pokemon name" then
       if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then
   -- 'Will use ultra ball first'
            return
       end
   end
   return attack() or sendUsablePokemon() or run() or sendAnyPokemon()
end
 
Reply
#42
how do i put on the script to catch a pokemon that i haven't caught before?
 
Reply
#43
(2017-07-22, 20:50:47)HiddenLeaf how do i put on the script to catch a pokemon that i haven't caught before?

Do you mean:
function onBattleAction()
    if not isAlreadyCaught() then
        useItem("Pokeball")
    end
end
(minimalistic code)
 
Reply
#44
(2017-07-22, 21:03:25)DubsCheckum
(2017-07-22, 20:50:47)HiddenLeaf how do i put on the script to catch a pokemon that i haven't caught before?

Do you mean:
function onBattleAction()
   if not alreadyCaught() then
       useItem("Pokeball")
   end
end
(minimalistic code)
thanks!
 
Reply
#45
Crazy how old this already is... Big Grin
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)