Romhacking.net

Romhacking => Programming => Topic started by: NES Boy on January 18, 2020, 05:01:26 pm

Title: Running a LUA script for Battle Kid on Mesen.
Post by: NES Boy on January 18, 2020, 05:01:26 pm
So, I downloaded this LUA script (http://tasvideos.org/userfiles/info/60045844721779290) for the Battle Kid games and am trying to run it on the emulator Mesen 0.9.8. However, it doesn't seem to run correctly, saying "Battle_Kid.lua:1916: attempt to index a nil value (global 'memory')". Here's the problematic portion of the script:

Code: [Select]
--version detection
memory.usememorydomain("PRG ROM");
local cart = memory.readbyte(0x01)
memory.usememorydomain("RAM");
if (cart == 133) then
  version = 1
  demo = true
elseif (cart == 168) then
  version = 1
  demo = false
elseif (cart == 24) then
  version = 2
  demo = true
elseif (cart == 128) then
  version = 2
  demo = false
else
  version = 3
end

I was interested in this script because it seems to be the same one used in these (http://www.youtube.com/watch?v=CdxCtcXRdms) two (http://www.youtube.com/watch?v=W8f2AXUZqrI) TAS videos.
Title: Re: Running a LUA script for Battle Kid on Mesen.
Post by: pirate_sephiroth on January 19, 2020, 06:38:53 pm
The script was probably made for Snes9x-RR so it has to be adapted if you wanbt to run it on other emulators.