lua used in Silver TAS
move = { "No Move", "Pound", "Karate Chop", "DoubleSlap", "Comet Punch", "Mega Punch", "Pay Day",
"Fire Punch", "Ice Punch", "ThunderPunch", "Scratch", "ViceGrip", "Guillotine",
"Razor Wind", "Swords Dance", "Cut", "Gust", "Wing Attack", "Whirlwind", "Fly",
"Bind", "Slam", "Vine Whip", "Stomp", "Double Kick", "Mega Kick", "Jump Kick",
"Rolling Kick", "Sand-Attack", "Headbutt", "Horn Attack", "Fury Attack",
"Horn Drill", "Tackle", "Body Slam", "Wrap", "Take Down", "Thrash", "Double-Edge",
"Tail Whip", "Poison Sting", "Twineedle", "Pin Missile", "Leer", "Bite", "Growl",
"Roar", "Sing", "Supersonic", "SonicBoom", "Disable", "Acid", "Ember",
"Flamethrower", "Mist", "Water Gun", "Hydro Pump", "Surf", "Ice Beam", "Blizzard",
"Psybeam", "BubbleBeam", "Aurora Beam", "Hyper Beam", "Peck", "Drill Peck",
"Submission", "Low Kick", "Counter", "Seismic Toss", "Strength", "Absorb",
"Mega Drain", "Leech Seed", "Growth", "Razor Leaf", "SolarBeam", "PoisonPowder",
"Stun Spore", "Sleep Powder", "Petal Dance", "String Shot", "Dragon Rage",
"Fire Spin", "ThunderShock", "Thunderbolt", "Thunder Wave", "Thunder", "Rock Throw",
"Earthquake", "Fissure", "Dig", "Toxic", "Confusion", "Psychic", "Hypnosis",
"Meditate", "Agility", "Quick Attack", "Rage", "Teleport", "Night Shade", "Mimic",
"Screech", "Double Team", "Recover", "Harden", "Minimize", "SmokeScreen",
"Confuse Ray", "Withdraw", "Defense Curl", "Barrier", "Light Screen", "Haze",
"Reflect", "Focus Energy", "Bide", "Metronome", "Mirror Move", "Selfdestruct",
"Egg Bomb", "Lick", "Smog", "Sludge", "Bone Club", "Fire Blast", "Waterfall",
"Clamp", "Swift", "Skull Bash", "Spike Cannon", "Constrict", "Amnesia", "Kinesis",
"Softboiled", "Hi Jump Kick", "Glare", "Dream Eater", "Poison Gas", "Barrage",
"Leech Life", "Lovely Kiss", "Sky Attack", "Transform", "Bubble", "Dizzy Punch",
"Spore", "Flash", "Psywave", "Splash", "Acid Armor", "Crabhammer", "Explosion",
"Fury Swipes", "Bonemerang", "Rest", "Rock Slide", "Hyper Fang", "Sharpen",
"Conversion", "Tri Attack", "Super Fang", "Slash", "Substitute", "Struggle",
"Sketch", "Triple Kick", "Thief", "Spider Web", "Mind Reader", "Nightmare",
"Flame Wheel", "Snore", "Curse", "Flail", "Conversion 2", "Aeroblast",
"Cotton Spore", "Reversal", "Spite", "Powder Snow", "Protect", "Mach Punch",
"Scary Face", "Faint Attack", "Sweet Kiss", "Belly Drum", "Sludge Bomb",
"Mud-Slap", "Octazooka", "Spikes", "Zap Cannon", "Foresight", "Destiny Bond",
"Perish Song", "Icy Wind", "Detect", "Bone Rush", "Lock-On", "Outrage", "Sandstorm",
"Giga Drain", "Endure", "Charm", "Rollout", "False Swipe", "Swagger", "Milk Drink",
"Spark", "Fury Cutter", "Steel Wing", "Mean Look", "Attract", "Sleep Talk",
"Heal Bell", "Return", "Present", "Frustration", "Safeguard", "Pain Split",
"Sacred Fire", "Magnitude", "DynamicPunch", "Megahorn", "DragonBreath",
"Baton Pass", "Encore", "Pursuit", "Rapid Spin", "Sweet Scent", "Iron Tail",
"Metal Claw", "Vital Throw", "Morning Sun", "Synthesis", "Moonlight", "Hidden Power",
"Cross Chop", "Twister", "Rain Dance", "Sunny Day", "Crunch", "Mirror Coat",
"Psych Up", "ExtremeSpeed", "AncientPower", "Shadow Ball", "Future Sight",
"Rock Smash", "Whirlpool", "Beat Up",
"Move 0xFC", "Move 0xFD", "Move 0xFE", "Move 0xFF"
}
pokemon = { "No Pokemon", "Bulbasaur", "Ivysaur", "Venusaur", "Charmander", "Charmeleon", "Charizard",
"Squirtle", "Wartortle", "Blastoise", "Caterpie", "Metapod", "Butterfree",
"Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidgeotto", "Pidgeot", "Rattata", "Raticate",
"Spearow", "Fearow", "Ekans", "Arbok", "Pikachu", "Raichu", "Sandshrew", "Sandslash",
"Nidoran F", "Nidorina", "Nidoqueen", "Nidoran M", "Nidorino", "Nidoking",
"Clefairy", "Clefable", "Vulpix", "Ninetales", "Jigglypuff", "Wigglytuff",
"Zubat", "Golbat", "Oddish", "Gloom", "Vileplume", "Paras", "Parasect", "Venonat", "Venomoth",
"Diglett", "Dugtrio", "Meowth", "Persian", "Psyduck", "Golduck", "Mankey", "Primeape",
"Growlithe", "Arcanine", "Poliwag", "Poliwhirl", "Poliwrath", "Abra", "Kadabra", "Alakazam",
"Machop", "Machoke", "Machamp", "Bellsprout", "Weepinbell", "Victreebel", "Tentacool", "Tentacruel",
"Geodude", "Graveler", "Golem", "Ponyta", "Rapidash", "Slowpoke", "Slowbro",
"Magnemite", "Magneton", "Farfetch'd", "Doduo", "Dodrio", "Seel", "Dewgong", "Grimer", "Muk",
"Shellder", "Cloyster", "Gastly", "Haunter", "Gengar", "Onix", "Drowzee", "Hypno",
"Krabby", "Kingler", "Voltorb", "Electrode", "Exeggcute", "Exeggutor", "Cubone", "Marowak",
"Hitmonlee", "Hitmonchan", "Lickitung", "Koffing", "Weezing", "Rhyhorn", "Rhydon", "Chansey",
"Tangela", "Kangaskhan", "Horsea", "Seadra", "Goldeen", "Seaking", "Staryu", "Starmie",
"Mr. Mime", "Scyther", "Jynx", "Electabuzz", "Magmar", "Pinsir", "Tauros", "Magikarp", "Gyarados",
"Lapras", "Ditto", "Eevee", "Vaporeon", "Jolteon", "Flareon", "Porygon", "Omanyte", "Omastar",
"Kabuto", "Kabutops", "Aerodactyl", "Snorlax", "Articuno", "Zapdos", "Moltres",
"Dratini", "Dragonair", "Dragonite", "Mewtwo", "Mew",
"Chikorita", "Bayleef", "Meganium", "Cyndaquil", "Quilava", "Typhlosion",
"Totodile", "Croconaw", "Feraligatr", "Sentret", "Furret", "Hoothoot", "Noctowl",
"Ledyba", "Ledian", "Spinarak", "Ariados", "Crobat", "Chinchou", "Lanturn", "Pichu", "Cleffa",
"Igglybuff", "Togepi", "Togetic", "Natu", "Xatu", "Mareep", "Flaaffy", "Ampharos", "Bellossom",
"Marill", "Azumarill", "Sudowoodo", "Politoed", "Hoppip", "Skiploom", "Jumpluff", "Aipom",
"Sunkern", "Sunflora", "Yanma", "Wooper", "Quagsire", "Espeon", "Umbreon", "Murkrow", "Slowking",
"Misdreavus", "Unown", "Wobbuffet", "Girafarig", "Pineco", "Forretress", "Dunsparce", "Gligar",
"Steelix", "Snubbull", "Granbull", "Qwilfish", "Scizor", "Shuckle", "Heracross", "Sneasel",
"Teddiursa", "Ursaring", "Slugma", "Magcargo", "Swinub", "Piloswine", "Corsola", "Remoraid", "Octillery",
"Delibird", "Mantine", "Skarmory", "Houndour", "Houndoom", "Kingdra", "Phanpy", "Donphan",
"Porygon2", "Stantler", "Smeargle", "Tyrogue", "Hitmontop", "Smoochum", "Elekid", "Magby", "Miltank",
"Blissey", "Raikou", "Entei", "Suicune", "Larvitar", "Pupitar", "Tyranitar", "Lugia", "Ho-Oh", "Celebi",
"Mon 0xFC", "Mon 0xFD", "Mon 0xFE", "Mon 0xFF"
}
catch_status = "N/A"
effect_status = "N/A"
damage_roll = "N/A"
acc_roll = "N/A"
move_acc = "N/A"
effect_roll = "N/A"
effect_chance = "N/A"
catch_roll = "N/A"
catch_chance = "N/A"
crit_roll = "N/A"
crit_chance = "N/A"
a = 1 -- breakpoint toggle
local wCriticalHit = 0x0B44
local wEnemyMonSpecies = 0x10EF
local wEnemyMonDVs = 0x10F5
local wEnemyMonMaxHP = 0x1101
local wEnemyMonHP = 0x10FF
local wEnemyMonDefense = 0x1105
local wEnemyMonSpclDef = 0x110B
local wBattleMonSpecies = 0x0B0C
local wBattleMonAttack = 0x0B20
local wBattleMonSpclAtk = 0x0B26
local wBattleMode = 0x1116
local wCurEnemyMove = 0x0BC2
local wMapGroup = 0x1A00
local wRoamMon1MapGroup = 0x1D1C
local hRandomSub = 0x0064
local hROMBank = 0x001F
function compare_roamer_map()
if memory.read_u16_be(wRoamMon1MapGroup) == memory.read_u16_be(wMapGroup) then
return "Same Map!"
else
return "Different Map!"
end
end
function format_enemy_dvs()
atk_dv = bit.rshift(memory.read_u8(wEnemyMonDVs),4)
def_dv = bit.band(memory.read_u8(wEnemyMonDVs),0x0F)
spe_dv = bit.rshift(memory.read_u8(wEnemyMonDVs + 1),4)
spc_dv = bit.band(memory.read_u8(wEnemyMonDVs + 1),0x0F)
end
function display_enemy_dvs()
format_enemy_dvs()
gui.text(5,425,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Atk DV: "..atk_dv,"white","topright")
gui.text(5,445,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Def DV: "..def_dv,"white","topright")
gui.text(5,465,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Spe DV: "..spe_dv,"white","topright")
gui.text(5,485,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Spc DV: "..spc_dv,"white","topright")
end
function fetch_hl()
hl = (emu.getregister("H") * 0x100) + emu.getregister("L")
return memory.read_u8(hl,"System Bus")
end
function determine_catch_status()
if memory.read_u8(hROMBank,"HRAM") ~= 0x03 then
return
elseif emu.getregister("A") == 0x00 then
catch_status = "Fail"
else
catch_status = "Success"
end
end
function determine_effect_status()
if memory.read_u8(hROMBank,"HRAM") ~= 0x0D then
return
elseif bit.check(emu.getregister("F"),4) == true then
effect_status = "Success"
else
effect_status = "Fail"
end
end
function break_on_catch_roll()
if memory.read_u8(hROMBank,"HRAM") ~= 0x03 then
return
else
catch_roll = emu.getregister("A")
catch_chance = emu.getregister("B")
if a ~= 0 then
client.pause()
end
end
end
function break_on_damage_roll()
if memory.read_u8(hROMBank,"HRAM") ~= 0x0D then
return
else
damage_roll = emu.getregister("A")
if a ~= 0 then
client.pause()
end
end
end
function break_on_acc_roll()
if memory.read_u8(hROMBank,"HRAM") ~= 0x0D then
return
else
acc_roll = emu.getregister("A")
move_acc = emu.getregister("B")
if a ~= 0 then
client.pause()
end
end
end
function break_on_effect_roll()
if memory.read_u8(hROMBank,"HRAM") ~= 0x0D then
return
else
effect_roll = emu.getregister("A")
effect_chance = fetch_hl()
if a ~= 0 then
client.pause()
end
end
end
function break_on_crit_roll()
if memory.read_u8(hROMBank,"HRAM") ~= 0x0D then
return
else
crit_roll = emu.getregister("A")
crit_chance = fetch_hl()
if a ~= 0 then
client.pause()
end
end
end
function break_on_bank_37()
if a == 0 then
return
elseif memory.read_u8(hROMBank,"HRAM") ~= 0x25 then
return
else
client.pause()
end
end
function break_on_home()
if a == 0 then
return
else
client.pause()
end
end
function break_on_bank_14()
if a == 0 then
return
elseif memory.read_u8(hROMBank,"HRAM") ~= 0x0E then
return
else
client.pause()
end
end
event.onmemoryexecute(determine_catch_status,0x6A23) -- Catch Status
event.onmemoryexecute(determine_effect_status,0x5035) -- Effect Status
event.onmemoryexecute(break_on_acc_roll,0x4ED9) -- Accuracy Roll
event.onmemoryexecute(break_on_damage_roll,0x4E6A) -- Damage Roll
event.onmemoryexecute(break_on_effect_roll,0x5034) -- Effect Roll
event.onmemoryexecute(break_on_crit_roll,0x47EC) -- Critical Roll
event.onmemoryexecute(break_on_catch_roll,0x6A19) -- Catch Roll
-- event.onmemoryexecute(break_on_bank_14,0x4621) -- AI_Setup.discourage, fuck Rival 2/3/4
-- event.onmemoryexecute(break_on_bank_14,0x4CBF) -- AI_Smart_Spite, fuck Rival 3
-- event.onmemoryexecute(break_on_bank_14,0x54F2) -- AI_50_50, fuck Rival 3 and Lance
-- event.onmemoryexecute(break_on_bank_14,0x4B56) -- AI_Smart_HyperBeam, fuck Lance
event.onmemoryexecute(break_on_home,0x0A60) -- Prompt Button
event.onmemoryexecute(break_on_bank_37,0x68CC) -- Check A Press Overworld
while true do
memory.usememorydomain("WRAM")
client.SetGameExtraPadding(0,0,90,0)
gui.text(5,5,"Crit Status: "..memory.read_u8(wCriticalHit),"white","topright")
gui.text(5,35,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Max HP: "..memory.read_u16_be(wEnemyMonMaxHP),"white","topright")
gui.text(5,55,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Cur HP: "..memory.read_u16_be(wEnemyMonHP),"white","topright")
gui.text(5,85,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Defense: "..memory.read_u16_be(wEnemyMonDefense),"white","topright")
gui.text(5,105,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Sp. Def: "..memory.read_u16_be(wEnemyMonSpclDef),"white","topright")
gui.text(5,135,pokemon[memory.read_u8(wBattleMonSpecies) + 1].."'s Attack: "..memory.read_u16_be(wBattleMonAttack),"white","topright")
gui.text(5,155,pokemon[memory.read_u8(wBattleMonSpecies) + 1].."'s Sp. Atk: "..memory.read_u16_be(wBattleMonSpclAtk),"white","topright")
gui.text(5,185,"Random Sub: "..memory.read_u8(hRandomSub,"HRAM"),"white","topright")
gui.text(5,215,"Damage Roll: "..damage_roll,"white","topright")
gui.text(5,265,"Catch Status: "..catch_status,"white","topright")
gui.text(5,245,"Effect Status: "..effect_status,"white","topright")
gui.text(5,295,pokemon[memory.read_u8(wEnemyMonSpecies) + 1].."'s Move: "..move[memory.read_u8(wCurEnemyMove) + 1],"white","topright")
gui.text(5,325,"Accuracy Roll: "..acc_roll,"white","topright")
gui.text(5,345,"Move Accuracy: "..move_acc,"white","topright")
gui.text(5,375,"Effect Roll: "..effect_roll,"white","topright")
gui.text(5,395,"Effect Chance: "..effect_chance,"white","topright")
-- display_enemy_dvs() -- nice info but not really needed now tbh
-- gui.text(5,515,"Roamer Map Status: "..compare_roamer_map(),"white","topright")
gui.text(5,425,"Catch Roll: "..catch_roll,"white","topright")
gui.text(5,445,"Catch Chance: "..catch_chance,"white","topright")
gui.text(5,475,"Crit Roll: "..crit_roll,"white","topright")
gui.text(5,495,"Crit Chance: "..crit_chance,"white","topright")
if memory.read_u8(wBattleMode) == 0x00 then
catch_status = "N/A"
effect_status = "N/A"
damage_roll = "N/A"
acc_roll = "N/A"
move_acc = "N/A"
effect_roll = "N/A"
effect_chance = "N/A"
catch_roll = "N/A"
catch_chance = "N/A"
crit_roll = "N/A"
crit_chance = "N/A"
end
-- gui.text(5,65,"4E6A = Damage Roll Breakpoint","white","bottomright") -- these don't matter at this point I think?
-- gui.text(5,45,"4ED9 = Accuracy Roll Breakpoint","white","bottomright")
-- gui.text(5,25,"47EB = Crit Roll Breakpoint","white","bottomright")
-- gui.text(5,5,"5034 = Effect Roll Breakpoint","white","bottomright")
if client.isseeking() == true and client.isturbo() == true then
a = 0
end
emu.frameadvance()
end