Post subject: Issues with Lua
TRD159
He/Him
Joined: 8/8/2018
Posts: 5
I've tried using this Lua script for my TAS of Earthbound, but it uses a few functions that Bizhawk, which is the emulator I use, doesn't have. Can anyone help me fix this? Thanks!
Just an amateur TASer looking for satisfaction in my work
Pokota
He/Him
Joined: 2/5/2014
Posts: 778
You'll need to convert functions over to BizHawk. You'll need to convert the memory read functions - BizHawk doesn't alias read16 to readword because it supports systems with more than one word size (and thus must be agnostic about it). Also it looks like you've got a bunch of gui drawing functions that'll need to be converted.
Adventures in Lua When did I get a vest?
Editor, Player (163)
Joined: 4/7/2015
Posts: 329
Location: Porto Alegre, RS, Brazil
I was curious about that script, which was made for Snes9x. I edited to work on BizHawk and you can get it here. If you're not familiar with BizHawk's Lua API, the main changes I made were the following:
    memory.readbyte -> mainmemory.read_u8 memory.readword -> mainmemory.read_u16_le memory.readwordsigned -> mainmemory.read_s16_le gui.box -> gui.drawBox gui.line -> gui.drawLine addresses like 0x7E1234 -> 0x1234 colours like "#123456FF" -> 0xFF123456 emu.registerbefore -> event.onframestart gui.register(function() ... end) -> while true do ... emu.frameadvance() end
Games are basically math with a visual representation of this math, that's why I make the scripts, to re-see games as math. My things: YouTube, GitHub, Pastebin, Twitter
TRD159
He/Him
Joined: 8/8/2018
Posts: 5
Thanks, guys. This was really helpful!
Just an amateur TASer looking for satisfaction in my work