Skip to content

Instantly share code, notes, and snippets.

@RaycatWhoDat
Last active July 13, 2022 12:35
Show Gist options
  • Save RaycatWhoDat/4a52cb239bccda54f2f68a4a6618c9c9 to your computer and use it in GitHub Desktop.
Save RaycatWhoDat/4a52cb239bccda54f2f68a4a6618c9c9 to your computer and use it in GitHub Desktop.
Ironmon BizHawk Script
PATH_TO_ROMS = "../.."
NAME_OF_ROM_WITHOUT_NUMBER = "FireRed"
KEY_TO_ADVANCE = "N"
KEY_TO_PREVIOUS = "O"
NAME_OF_SEED_FILE = "current_seed.txt"
file = io.open(NAME_OF_SEED_FILE, "r")
INITIAL_SEED_NUMBER = tonumber(file:read("*number"))
file:close()
function changeseed(direction)
seednumber = userdata.get("seednumber")
if seednumber ~= nil then
seednumber = seednumber + direction
else
seednumber = INITIAL_SEED_NUMBER + direction
end
userdata.set("seednumber", seednumber)
console.log("Opening seed #" .. seednumber .. "...")
client.closerom()
client.openrom(PATH_TO_ROMS .. "/" .. NAME_OF_ROM_WITHOUT_NUMBER .. seednumber .. ".gba")
file = io.open("current_seed.txt", "w")
file:write(seednumber)
file:close()
end
while true do
if input.get()[KEY_TO_ADVANCE] == true then
changeseed(1)
end
if input.get()[KEY_TO_PREVIOUS] == true then
changeseed(-1)
end
emu.frameadvance()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment