├── README.md ├── beta ├── igtbot.lua └── wild.lua ├── fishbot.lua ├── giftbot.lua ├── party_checker.lua ├── stationarybot.lua └── tidbot.lua /README.md: -------------------------------------------------------------------------------- 1 | # rbylua 2 | Lua scripts for shiny hunting in RBY games. 3 | 4 | Work only with vba rr 23.6. 5 | 6 | Thanks to zaksabeast for updating the scripts for 1.3 transporter update! 7 | 8 | ## Gift ## 9 | DVs are generated after prompted to nickname your Pokémon. 10 | 11 | Put the cursor over "no" (nicknames not yet supported) and run the script 12 | 13 | Valid for: starters, fossils, in-game gifts (eevee, lapras, ...) and game corner prizes. 14 | 15 | ## Stationary ## 16 | DVs are generated when the battle begins. 17 | 18 | Interact with the sprite, stop at the cry text before the battle and run the script. 19 | 20 | Valid for: Snorlax, Zapdos, Articuno, Moltres, Mewtwo, Electrode/Voltorb in Power Plant. 21 | 22 | ## Fishing ## 23 | 24 | Species is generated first, and the IVs. Thanks Collector Togami for the info. 25 | 26 | Edit the script for desidered species, editing index number. 27 | 28 | Index numbers can be found here: http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_index_number_(Generation_I) 29 | 30 | Select your rod, put cursor over "use" and run the script. 31 | 32 | ## Nature check ## 33 | 34 | Rewritten Collector Togami's script with game version autocheck and more compact code. 35 | 36 | This script (not a bot) will show on-screen what nature Pokémon will have (and shinyness) when transferred through PokéBank. 37 | 38 | Nature is based on experience points, so gaining experience points will change nature. 39 | 40 | ## TID ## 41 | 42 | Edit the script for desired TID, in decimal. 43 | 44 | Run with the cursor over "New Game" in main screen. 45 | 46 | ## In game trade ## 47 | 48 | Run the script before last input before animation (should be at text "connect your link cable" or something like that). 49 | 50 | ## wild (requires IPS patch) ## 51 | 52 | To use with [patches](https://www.reddit.com/r/pokemonrng/comments/6e8kvm/ips_patches_pokemon_red_blue_with_fixed_rng_and/) 53 | Thanks to Aligateur! 54 | 55 | -------------------------------------------------------------------------------- /beta/igtbot.lua: -------------------------------------------------------------------------------- 1 | local version = memory.readword(0x14e) 2 | local base_address 3 | local atkdef 4 | local spespc 5 | 6 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 7 | print("RBGY JPN game detected") 8 | base_address = 0xd123 9 | elseif version == 0xe691 or version == 0xa9d then 10 | print("red/blue USA detected") 11 | base_address = 0xd163 12 | elseif version == 0x7c04 then 13 | print("yellow USA detected") 14 | base_address = 0xd162 15 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 16 | print("red/blue EUR detected") 17 | base_address = 0xd168 18 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 19 | print("yellow EUR detected") 20 | base_address = 0xd167 21 | else 22 | print(string.format("unknown versione, code: %4x", version)) 23 | print("script stopped") 24 | return 25 | end 26 | 27 | local partyno = memory.readbyte(base_address)-1 28 | local dv_addr = (base_address+0x23)+partyno*0x2C 29 | 30 | 31 | 32 | function shiny(atkdef,spespc) 33 | if spespc == 0xAA then 34 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 35 | return true 36 | else 37 | return false 38 | end 39 | else 40 | return false 41 | end 42 | end 43 | 44 | 45 | state = savestate.create() 46 | savestate.save(state) 47 | 48 | while true do 49 | 50 | emu.frameadvance() 51 | 52 | atkdef = memory.readbyte(dv_addr) 53 | spespc = memory.readbyte(dv_addr+1) 54 | savestate.save(state) 55 | joypad.set(1, {A=true}) 56 | emu.frameadvance() 57 | atkdef_prec = memory.readbyte(dv_addr) 58 | spespc_prec = memory.readbyte(dv_addr+1) 59 | while atkdef == atkdef_prec and spespc == spespc_prec do 60 | 61 | vba.frameadvance() 62 | atkdef = memory.readbyte(dv_addr) 63 | spespc = memory.readbyte(dv_addr+1) 64 | end 65 | print(atkdef) 66 | print(spespc) 67 | if shiny(atkdef,spespc) then 68 | print("Shiny!!! Script stopped.") 69 | print(string.format("atk: %d", math.floor(atkdef/16))) 70 | print(string.format("def: %d", atkdef%16)) 71 | print(string.format("spe: %d", math.floor(spespc/16))) 72 | print(string.format("spe: %d", spespc%16)) 73 | savestate.save(state) 74 | break 75 | else 76 | print("discarded") 77 | savestate.load(state) 78 | end 79 | 80 | 81 | end 82 | -------------------------------------------------------------------------------- /beta/wild.lua: -------------------------------------------------------------------------------- 1 | local battle_flag = 0xc027 2 | local battle = 0 3 | local i 4 | local atkdef 5 | local spespc 6 | local state = savestate.create() 7 | savestate.save(state) 8 | 9 | function shiny(atkdef,spespc) 10 | if spespc == 0xAA then 11 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 12 | return true 13 | else 14 | return false 15 | end 16 | 17 | else 18 | return false 19 | end 20 | end 21 | 22 | while true do 23 | battle = memory.readbyte(battle_flag) 24 | i = 0 25 | emu.frameadvance() 26 | 27 | savestate.save(state) 28 | --print("salvato") 29 | while battle ~= 0xf0 do 30 | if i <31 then 31 | --print("prima regione") 32 | joypad.set(1, {left=false}) 33 | joypad.set(1, {right=true}) 34 | 35 | else 36 | --print("seconda regione") 37 | joypad.set(1, {right=false}) 38 | joypad.set(1, {left=true}) 39 | end 40 | emu.frameadvance() 41 | battle = memory.readbyte(battle_flag) 42 | i = (i+1)%65 43 | end 44 | atkdef = memory.readbyte(0xcff1) 45 | spespc =memory.readbyte(0xcff2) 46 | 47 | if shiny(atkdef, spespc) then 48 | print("found") 49 | break 50 | else 51 | print(atkdef) 52 | print(spespc) 53 | savestate.load(state) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /fishbot.lua: -------------------------------------------------------------------------------- 1 | -- v0.1 fishbot 2 | --set up species, look for serebii for fishable pokemon in your area and look 3 | --http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_index_number_(Generation_I) 4 | --for index number and set in target 5 | --example horsea 6 | --local target = 92 7 | local target 8 | 9 | --da confermare per giallo e rbg/giapponesi 10 | local a_flagbite = 0xcd3d 11 | 12 | local a_fished_species 13 | local ivs_addr 14 | local version = memory.readword(0x14e) 15 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 16 | print("RBGY JAP detected") 17 | a_fished_species = 0xd036 18 | ivs_addr = 0xcfd8 19 | elseif version == 0xe691 or version == 0xa9d then 20 | print("Red/Blue USA detected") 21 | a_fished_species = 0xd059 22 | ivs_addr = 0xcff1 23 | elseif version == 0x7c04 then 24 | print("Yellow USA detected") 25 | a_fished_species = 0xd058 26 | ivs_addr = 0xcff0 27 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 28 | print("Red/Blue EUR detected") 29 | a_fished_species = 0xd05e 30 | ivs_addr = 0xcff6 31 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 32 | print("Yellow EUR detected") 33 | a_fished_species = 0xd05d 34 | ivs_addr = 0xcff5 35 | else 36 | print(string.format("unknown version, code: %4x", version)) 37 | print("script stopped") 38 | return 39 | end 40 | 41 | local atkdef 42 | local spespc 43 | 44 | function shiny(atkdef,spespc) 45 | if spespc == 0xAA then 46 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 47 | return true 48 | else 49 | return false 50 | end 51 | else 52 | return false 53 | end 54 | end 55 | 56 | if target == nil then 57 | print("You have not setup any species") 58 | return 59 | end 60 | 61 | state = savestate.create() 62 | savestate.save(state) 63 | while true do 64 | emu.frameadvance() 65 | savestate.save(state) 66 | joypad.set(1, {A=true}) 67 | emu.frameadvance() 68 | i=0 69 | --aspettiamo i risultati della pesca 70 | while i < 200 do 71 | emu.frameadvance() 72 | i = i+1 73 | end 74 | fished = memory.readbyte(a_flagbite) 75 | if fished == 0x2 then 76 | print("You're fishing where there are no pokemon") 77 | break 78 | elseif fished == 0x1 then 79 | --pescato qualcosa, vediamo se è la specie cercata 80 | if memory.readbyte(a_fished_species) == target then 81 | savestate.save(state) 82 | print("Species found, now searching for ivs") 83 | i = 0; 84 | --aspetta che finisca il dialogo 85 | while i<210 do 86 | joypad.set(1, {A=true}) 87 | emu.frameadvance() 88 | i= i+1 89 | end 90 | while true do 91 | emu.frameadvance() 92 | savestate.save(state) 93 | atkdef = 0 94 | spespc = 0 95 | while memory.readbyte(0xc027)~=0xf0 do 96 | 97 | joypad.set(1, {A=true}) 98 | emu.frameadvance() 99 | atkdef = memory.readbyte(ivs_addr) 100 | spespc = memory.readbyte(ivs_addr+1) 101 | end 102 | atkdef = memory.readbyte(ivs_addr) 103 | spespc = memory.readbyte(ivs_addr+1) 104 | print(atkdef) 105 | print(spespc) 106 | if shiny(atkdef,spespc) then 107 | print("Shiny!!! Script stopped.") 108 | print(string.format("Atk: %d", math.floor(atkdef/16))) 109 | print(string.format("Def: %d", atkdef%16)) 110 | print(string.format("Spe: %d", math.floor(spespc/16))) 111 | print(string.format("Spc: %d", spespc%16)) 112 | return 113 | else 114 | print("Wrong ivs") 115 | savestate.load(state) 116 | end 117 | end 118 | else 119 | --specie sbagliata 120 | print("Wrong species") 121 | savestate.load(state) 122 | end 123 | else 124 | --non ho pescato niente 125 | print("Nothing bited") 126 | savestate.load(state) 127 | end 128 | 129 | 130 | 131 | end 132 | -------------------------------------------------------------------------------- /giftbot.lua: -------------------------------------------------------------------------------- 1 | local version = memory.readword(0x14e) 2 | local base_address 3 | local atkdef 4 | local spespc 5 | 6 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 7 | print("RBGY JPN game detected") 8 | base_address = 0xd123 9 | elseif version == 0xe691 or version == 0xa9d then 10 | print("Red/Blue USA detected") 11 | base_address = 0xd163 12 | elseif version == 0x7c04 then 13 | print("Yellow USA detected") 14 | base_address = 0xd162 15 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 16 | print("Red/Blue EUR detected") 17 | base_address = 0xd168 18 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 19 | print("Yellow EUR detected") 20 | base_address = 0xd167 21 | else 22 | print(string.format("Unknown version, code: %4x", version)) 23 | print("Script stopped") 24 | return 25 | end 26 | 27 | local size = memory.readbyte(base_address)-1 28 | local dv_addr = (base_address+0x23)+size*0x2C 29 | 30 | 31 | 32 | function shiny(atkdef,spespc) 33 | if spespc == 0xAA then 34 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 35 | return true 36 | else 37 | return false 38 | end 39 | else 40 | return false 41 | end 42 | end 43 | 44 | state = savestate.create() 45 | savestate.save(state) 46 | 47 | while true do 48 | 49 | emu.frameadvance() 50 | savestate.save(state) 51 | i=0 52 | while i < 20 do 53 | joypad.set(1, {A=true}) 54 | vba.frameadvance() 55 | 56 | i=i+1 57 | end 58 | atkdef = memory.readbyte(dv_addr) 59 | spespc = memory.readbyte(dv_addr+1) 60 | if shiny(atkdef,spespc) then 61 | print("Shiny!!! Script stopped.") 62 | print(string.format("Atk: %d", math.floor(atkdef/16))) 63 | print(string.format("Def: %d", atkdef%16)) 64 | print(string.format("Spe: %d", math.floor(spespc/16))) 65 | print(string.format("Spc: %d", spespc%16)) 66 | savestate.save(state) 67 | break 68 | else 69 | print("discarded") 70 | savestate.load(state) 71 | end 72 | 73 | 74 | end 75 | -------------------------------------------------------------------------------- /party_checker.lua: -------------------------------------------------------------------------------- 1 | --rewritten /u/itsprofoak lua script, more compact code with automatic check version 2 | naturename={ 3 | "Hardy","Lonely","Brave","Adamant","Naughty", 4 | "Bold","Docile","Relaxed","Impish","Lax", 5 | "Timid","Hasty","Serious","Jolly","Naive", 6 | "Modest","Mild","Quiet","Bashful","Rash", 7 | "Calm","Gentle","Sassy","Careful","Quirky"} 8 | 9 | function shiny(atkdef,spespc) 10 | if spespc == 0xAA then 11 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 12 | return " shiny" 13 | else 14 | return "" 15 | end 16 | else 17 | return "" 18 | end 19 | end 20 | 21 | version = memory.readword(0x14e) 22 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 23 | print("RBGY JPN game detected") 24 | partystart = 0xd12b 25 | elseif version == 0xe691 or version == 0xa9d then 26 | print("red/blue USA detected") 27 | partystart = 0xd16b 28 | elseif version == 0x7c04 then 29 | print("yellow USA detected") 30 | partystart = 0xd16a 31 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 32 | print("red/blue EUR detected") 33 | partystart = 0xd170 34 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 35 | print("yellow EUR detected") 36 | partystart = 0xd16f 37 | else 38 | print(string.format("unknown versione, code: %4x", version)) 39 | print("script stopped") 40 | return 41 | end 42 | 43 | while true do 44 | partysize = memory.readbyte(partystart-8)-1 45 | 46 | p = 1 47 | for i = (partystart+0xe),(partystart+ 0xe +partysize*0x2c),0x2c do 48 | pexp = 0x10000*memory.readbyte(i)+0x100*memory.readbyte(i+1) + memory.readbyte(i+2) 49 | gui.text(2,p*10,tostring(p).." "..naturename[pexp%25+1]..shiny(memory.readbyte(i+0xd), memory.readbyte(i+0xe))) 50 | p = p+1 51 | end 52 | emu.frameadvance() 53 | end 54 | -------------------------------------------------------------------------------- /stationarybot.lua: -------------------------------------------------------------------------------- 1 | local version = memory.readword(0x14e) 2 | local flag_addr = 0xc027 3 | local base_address 4 | local atkdef 5 | local spespc 6 | 7 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 8 | print("RBGY JPN game detected") 9 | base_address = 0xcfd8 10 | elseif version == 0xe691 or version == 0xa9d then 11 | print("red/blue USA detected") 12 | base_address = 0xcff1 13 | elseif version == 0x7c04 then 14 | print("yellow USA detected") 15 | base_address = 0xcff0 16 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 17 | print("red/blue EUR detected") 18 | base_address = 0xcff6 19 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 20 | print("yellow EUR detected") 21 | base_address = 0xcff5 22 | else 23 | print(string.format("unknown version, code: %4x", version)) 24 | print("script stopped") 25 | return 26 | end 27 | 28 | 29 | function shiny(atkdef,spespc) 30 | if spespc == 0xAA then 31 | if atkdef == 0x2A or atkdef == 0x3A or atkdef == 0x6A or atkdef == 0x7A or atkdef == 0xAA or atkdef == 0xBA or atkdef == 0xEA or atkdef == 0xFA then 32 | return true 33 | else 34 | return false 35 | end 36 | else 37 | return false 38 | end 39 | end 40 | 41 | 42 | state = savestate.create() 43 | savestate.save(state) 44 | 45 | while true do 46 | joypad.set(1, {A=true}) 47 | emu.frameadvance() 48 | 49 | atkdef = 0 50 | spespc = 0 51 | savestate.save(state) 52 | 53 | while memory.readbyte(flag_addr)~=0xf0 do 54 | joypad.set(1, {A=false}) 55 | vba.frameadvance() 56 | atkdef = memory.readbyte(base_address) 57 | spespc = memory.readbyte(base_address+1) 58 | end 59 | if shiny(atkdef,spespc) then 60 | print("Shiny!!! Script stopped.") 61 | print(string.format("atk: %d", math.floor(atkdef/16))) 62 | print(string.format("def: %d", atkdef%16)) 63 | print(string.format("spe: %d", math.floor(spespc/16))) 64 | print(string.format("spc: %d", spespc%16)) 65 | savestate.save(state) 66 | break 67 | else 68 | print("discarded") 69 | savestate.load(state) 70 | end 71 | 72 | 73 | end 74 | -------------------------------------------------------------------------------- /tidbot.lua: -------------------------------------------------------------------------------- 1 | --edit this line with desired tid, in decimal, value between 0 and 65535 2 | local desired_tid = 0 3 | local a_tid 4 | local tid 5 | function reverseword(w) 6 | return (w % 256)*256+math.floor(w/256) 7 | end 8 | local version = memory.readword(0x14e) 9 | if version == 0xc1a2 or version == 0x36dc or version == 0xd5dd or version == 0x299c then 10 | print("RBGY JPN game detected") 11 | a_tid = 0xd2d8 12 | elseif version == 0xe691 or version == 0xa9d then 13 | print("RB USA detected") 14 | a_tid = 0xd359 15 | elseif version == 0x7c04 then 16 | print("Y USA detected") 17 | a_tid = 0xd358 18 | elseif version == 0xd289 or version == 0x9c5e or version == 0xdc5c or version == 0xbc2e or version == 0x4a38 or version == 0xd714 or version == 0xfc7a or version == 0xa456 then 19 | print("RB EUR detected") 20 | a_tid = 0xd35e 21 | elseif version == 0x8f4e or version == 0xfb66 or version == 0x3756 or version == 0xc1b7 then 22 | print("Y EUR detected") 23 | a_tid = 0xd35d 24 | else 25 | print(string.format("unknown version, code: %4x", version)) 26 | print("script stopped") 27 | return 28 | end 29 | 30 | desired_tid = reverseword(desired_tid) 31 | state = savestate.create() 32 | savestate.save(state) 33 | while true do 34 | curr_tid=memory.readword(a_tid) 35 | emu.frameadvance() 36 | savestate.save(state) 37 | local tid = memory.readword(a_tid) 38 | x = 0 39 | while x < 32 do 40 | joypad.set(1, {A=true}) 41 | vba.frameadvance() 42 | x=x+1 43 | end 44 | tid = memory.readword(a_tid) 45 | print(reverseword(tid)) 46 | if tid == desired_tid then 47 | print("TID found!") 48 | return 49 | else 50 | savestate.load(state) 51 | end 52 | 53 | 54 | end 55 | --------------------------------------------------------------------------------