News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Running a LUA script for Battle Kid on Mesen.  (Read 307 times)

NES Boy

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Running a LUA script for Battle Kid on Mesen.
« on: January 18, 2020, 05:01:26 pm »
So, I downloaded this LUA script 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 two TAS videos.

pirate_sephiroth

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: Running a LUA script for Battle Kid on Mesen.
« Reply #1 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.