The lua command joypad.set is not working correctly: consider, for example, the following (simple) script:
while true do
mf=emu.framecount()
key1={}
if math.mod(mf,4)==0 then key1.Start=1 end
if math.mod(mf,4)==1 then key1.Select=1 end
if math.mod(mf,4)==2 then key1.B=1 end
if math.mod(mf,4)==3 then key1.A=1 end
joypad.set(key1,1)
emu.frameadvance()
end
This should press Start, select, B and A, in that order (which is what it does in FCEUX), and never two buttons at the same time. However, when running this in the latest version of Bizhawk, the input registered seems quite random, and often more than one button is pressed at the same time.
Oh, and while I'm here, I'm still having problems with the gui.drawImage command, though admittedly this might be something I'm doing wrong. What I'm trying to do is display an image with this code:
imfile="C:\pics\map.png"
gui.drawImage(imfile,30,30,10,10)
but nothing happens - the code passes without an error, but nothing is displayed. Is my syntax wrong, or is the command broken? I've looked at the
Lua functions page but didn't get any wiser. Any help is very welcome!