罗技宏Lua语法错误,但是不知道哪错了
烦请大佬们指出错误,十分感谢!
--只给四把枪创建宏--
local n = false --给鼠标侧键做判断
local m = false --给键盘按键做判断
local Gun="Gun"
local SideKey = { 4, 5, 6, 7, 8}
local Guns = { M4, Vector, AKM, M762, Groza, M249, AUG, Scarl}
local Parts = { MuzCom, FlasHid, Supp, Grip, Stock, ReDot, 2xSight, 3xScope, 4xScope, 6xScope, 8xScope}
----------------1.枪补2.消焰3.消音 4.握把 5.枪托 6.红点 7.2倍 8.3倍 9.4倍10.6倍 11.8倍
L_M4 = 4 --裸配M4
M_M4 = 3 --满配M4
L_Vector = 5
M_Vector = 4
L_AKM = 6
M_AKM = 5
L_M762 = 8
M_M762 = 7
function OnEvent(event , arg)
EnablePrimaryMouseButtonEvents(true)
MBP = "MOUSE_BUTTON_PRESSED"
MBR = "MOUSE_BUTTON_RELEASED"
if ( IsKeyLockOn("capslock") ) then --亮起capslock开启满配压枪
m=true
end
------------------------------------------------
if ( event == MBP and arg == 4 ) then --按下4号键进入M4压枪
n=true
LightingTips(4)
end
if ( event == MBP and arg == 5 ) then --按下5号键进入Vector压枪
n=true
LightingTips(5)
end
if ( event == MBP and arg == 7 ) then --按下7号键进入AKM压枪
n=true
LightingTips(7)
end
if ( event == MBP and arg == 8 ) then --按下8号键进入M762压枪
n=true
LightingTips(8)
end
IsLeftPress(Gun)
if ( event == MBP and arg == 6 ) then --关闭宏
n=false
LightingTips(6)
end
end
----------------------------------------------------判断鼠标左键是否按下
function IsLeftPress(Gun)
if ( IsMouseButtonPressed(1) and n ) then
MoveFunc(Gun)
end
end
--------------------------------------------------------------
-- function IMP()
if ( IsKeyLockOn("capslock") ) then --亮起capslock开启满配压枪
m=true
-- end
--------------------------------------------------------------
function MoveFunc(Gun) ------------------*鼠标下移函数*
if (Gun == "M4" and m ) then
OutputLogMessage("L_M4.ing\n")
repeat
MoveMouseRelative(0, L_M4)
Sleep(10)
until not IsMouseButtonPressed(1)
elseif (Gun == "M4" and m ) then
OutputLogMessage("M_M4.ing\n")
repeat
MoveMouseRelative(0, M_M4) --(消焰器+M4枪托)
Sleep(10)
until not IsMouseButtonPressed(1)
--------------------------------------------------------------------
elseif (Gun == "Vector" and m ) then
OutputLogMessage("L_Vector.ing\n")
repeat
MoveMouseRelative(0, L_Vector)
Sleep(10)
until not IsMouseButtonPressed(1)
elseif (Gun == "Vector" and m ) then --(握把+M4枪托)
OutputLogMessage("M_Vector.ing\n")
repeat
MoveMouseRelative(0, M_Vector)
Sleep(10)
until not IsMouseButtonPressed(1)
--------------------------------------------------------------------
elseif (Gun == "AKM" and m ) then --(消音管)
OutputLogMessage("L_AKM.ing\n")
repeat
MoveMouseRelative(0, L_AKM)
Sleep(10)
until not IsMouseButtonPressed(1)
elseif (Gun == "AKM" and m ) then --(消焰器)
OutputLogMessage("M_AKM.ing\n")
repeat
MoveMouseRelative(0, M_AKM)
Sleep(10)
until not IsMouseButtonPressed(1)
--------------------------------------------------------------------
elseif (Gun == "M762" and m ) then
OutputLogMessage("L_M762.ing\n") --(消音管)
repeat
MoveMouseRelative(0, L_M762)
Sleep(10)
until not IsMouseButtonPressed(1)
elseif (Gun == "M762" and m ) then
OutputLogMessage("M_M762.ing\n") --(消焰器+M4枪托)
repeat
MoveMouseRelative(0, M_M762)
Sleep(10)
until not IsMouseButtonPressed(1)
end
end
------------------------------------键盘提示灯---------------------------------
function LightingTips(Num)
if (Num == 4) then
TuOn()
OutputLogMessage("M4 on!\n")
Gun="M4"
elseif (Num == 5) then
TuOn()
OutputLogMessage("Vector on!\n")
Gun="Vector"
elseif (Num == 7) then
TuOn()
OutputLogMessage("AKM on!\n")
Gun="AKM"
elseif (Num == 8) then
TuOn()
OutputLogMessage("M762 on!\n")
Gun="M762"
----------------------------------------
elseif (Num == 6 ) then
TuOf()
ClearLog()
OutputLogMessage("norecoil off!\n")
end
end
-----------------------------------------------------开关灯函数
function TuOn()
if ( not IsKeyLockOn("scrolllock") ) then
PressAndReleaseKey("scrolllock");
end
end
function TuOf()
if (IsKeyLockOn("scrolllock")) then
PressAndReleaseKey("scrolllock");
end
end local n = false --给鼠标侧键做判断
local m = false --给键盘按键做判断
local Gun="Gun"
local SideKey = { 4, 5, 6, 7, 8}
local Guns = { M4, Vector, AKM, M762, Groza, M249, AUG, Scarl}
local Parts = { MuzCom, FlasHid, Supp, Grip, Stock, ReDot, 2xSight, 3xScope, 4xScope, 6xScope, 8xScope}
你变量是全局用.还加上local干嘛?数组里不能以数字开头
n = false --给鼠标侧键做判断
m = false --给键盘按键做判断
Gun="Gun"
SideKey = { 4, 5, 6, 7, 8}
Guns = { M4, Vector, AKM, M762, Groza, M249, AUG, Scarl}
Parts = { MuzCom, FlasHid, Supp, Grip, Stock, ReDot, Sight2x, Scope3x, Scope4x, Scope6x, Scope8x}
这样就不好了.
还有脚本第69行的end被你注释掉了.一样会报错,少一个end 你这个是只能用罗技键盘才能生效吗?问题解决了嘛?
页:
[1]