G13 能够为活动的游戏配置文件设置三个不同的子配置文件,称为 M1、M2、M3 或 MKeystates……基本上允许我根据激活的 Mkey 配置文件将三个命令映射到 G13 上的每个键。
我希望脚本知道 G13 的当前 MKeystate M1、M2、M3 是什么,并在 M1、M2 或 M3 一次仅对一个 MKeyState 执行这些命令,而不是在每个 MKeyState 上执行这些命令。因此,如果子配置文件 1“M1”处于活动状态并且我按下 G4 键,LCD 会显示“前进”,如果子配置文件 2“M2”处于活动状态并且我按下相同的 G4 键,那么 LCD 会显示不同的内容,依此类推。
是否可以为每个子配置文件独立编写脚本?
我尝试在第 27 行之后的部分中添加此内容,但出现语法错误
if ( arg == 4 and MKeyState == 1) then
这是我的代码。我想要它,这样我就可以根据当前活动的子配置文件/ MKeyState 让相同的按键做不同的事情。
isPressed = false;
function OnEvent(event, arg, family)
-- If a G-Key is pressed
if event =="G_PRESSED" then
-- was it G9?
if arg == 9 then
ClearLCD ()
OutputLCDMessage("Auto Run ON", 2000)
ClearLCD ()
-- If we're not currently running
if not isPressed then
-- we are now
PressKey("w");
isPressed = true
else
ClearLCD ()
OutputLCDMessage("Auto Run OFF", 1000)
ClearLCD ()
-- stop running
ReleaseKey("w");
isPressed = false;
end
end
end
if ( arg == 4 ) then
ClearLCD ()
OutputLCDMessage("FOWARD")
end
if ( arg == 7 ) then
ClearLCD ()
OutputLCDMessage("MOBI GLASS")
end
if ( arg == 1 ) then
ClearLCD ()
OutputLCDMessage("PRIMARY WEAPON")
end
end