I was trying to make a SMW wall jump bruteforcer Lua script, and I wrote this script:
local sav
sav = savestate.create()
savestate.save(sav)
local groundflag
groundflag = memory.readbyte(0x0077) --0x0077 checks if on ground
local xvel --0x007B
xvel = memory.readbyte(0x007B)
local yvel --0x007D
yvel = memory.readbyte(0x007D)
local input
while (yvel~=6 or yvel~=3) and groundflag<=2 do --if not on ground
ran=math.random(2) --pick either 1 or 2
if(ran~=1) then --if it's 1
input = {B=true} --press B that frame
else --if not
input = {} --don't press B
end
joypad.set(1, input)
groundflag = memory.readbyte(0x0077) --reread variables each frame
xvel = memory.readbyte(0x007B)
yvel = memory.readbyte(0x007D)
if(xvel==0) then --if hit wall
if yvel~=6 or yvel~=3 then --if not cling wall
savestate.load(sav) --load state
else --if cling wall
snes9x.pause() --pause emulator
end
end
snes9x.frameadvance() --advance 1 frame and go to beginning of loop
end
However, when I run the script it never pauses the emulator, which means I never managed to cling the wall. Am I doing something wrong here?
I'm using Snes9x1.51v6