How does joypad.set work? I tried this:
memory.usememorydomain("Combined WRAM")
local p = memory.readbyte(0x03A54E) -- your position
local t1 = {[1]=0x03A5B6,[2]=0x03A61E,[3]=0x03A686,[4]=0x03A6EE,[5]=0x03A756} --stick positions
function Joy(button)
joypad.set({button = true},1)
end
function move(d,a)
if (d == true) then
if (a == 4) and (p == 1) then
Joy('Left')
elseif (a == 4) and (p == 2) then
Joy('A')
elseif (a == 12) and (p == 0) then
Joy('Right')
elseif (a == 12) and (p == 2) then
Joy('B')
elseif (a == 18) and (p == 1) then
Joy('Left')
elseif (a == 18) and (p == 0) then
Joy('A')
end
end
end
while true do
for i = 1, 5 do
if (memory.readbyte(t1[i]+2)<=0x10) then
if (memory.readbyte(t1[i]) == 4) or (memory.readbyte(t1[i]) == 12) or (memory.readbyte(t1[i]) == 18) then
move(true,memory.readbyte(t1[i])) end
end
end
emu.frameadvance()
end
and it doesnt give an error nor does it do anything. Setting it to
joypad.set({Left = true},1)
results in similar nothing happening.
Edit: I also checked if the script ever reaches the joypad part, and placing gui.text under there for debug shows that it does. Not sure why won't joypad work.