Hello all, I have a question of lua:
Bobo the King's code is good but it ignores other buttons when the turbo button is being pressed.
I'm trying to write a lua script but it doesn't work. Here's my code:
Language: lua
print("Turbo, B: H; R: U; Y: A")
local PressDownA = false
local PressDownB = false
local PressDownR = false
gui.register(function()
local KeyPress = input.get()
if KeyPress["H"] or KeyPress["U"] or KeyPress["Y"] then
local Buttons = joypad.get(0)
if not emu.lagged() then
if KeyPress["H"] then
Buttons["B"] = PressDownB
PressDownB = not PressDownB
end
if KeyPress["U"] then
Buttons["R"] = PressDownR
PressDownR = not PressDownR
end
if KeyPress["Y"] then
Buttons["A"] = PressDownA
PressDownA = not PressDownA
end
else
if KeyPress["H"] then
Buttons["B"] = PressDownB
end
if KeyPress["U"] then
Buttons["R"] = PressDownR
end
if KeyPress["Y"] then
Buttons["A"] = PressDownA
end
end
print(Buttons)
joypad.set(0, Buttons)
else
PressDownA = false
PressDownB = false
PressDownR = false
end
end)
I'm a programmer but this is my first time writing lua. I write some logs and it seems everything goes fine.
Emu used: v23.6 SVN480
Thanks