[Lua] 纯文本查看 复制代码 --只给四把枪创建宏-------- 十分感谢能抽空解答的站友们!
local n = false
local SideKey = { 4, 5, 6, 7, 8}
local Gun
local Guns = { M4, Vector, AKM, M762, Groza, M249, AUG, Scarl}
function OnEvent(event , arg)
EnablePrimaryMouseButtonEvents(true)
MBP = "MOUSE_BUTTON_PRESSED"
MBR = "MOUSE_BUTTON_RELEASED"
------------------------------------------------
if ( event == MBP and arg == 4 ) then
n=true
LightingTips(4)
end
if ( event == MBP and arg == 5 ) then
n=true
LightingTips(5)
end
IsLeftPress(Gun)
-------------------------------------------------------------------
这里我想的是:在前面的LightingTips函数里在不同的侧键按下后给Gun赋予不同的值(我这里是M4 Vector),然后进入IsLeftPress的if中判断Gun,
当等于M4就进入M4的循环。但是问题出就出在不管是进入M4还是Vector,都是用的M4的压强系数,这里有个罗技里的测试截图
[attach]1907544[/attach]
所以我想解决的就是让它能在我按下4号侧键时用M4系数压,按下5号侧键时用Vector的系数
--------------------------十分感谢能抽空解答的站友们!
-------------------------------------------------------------------
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
----------------------------------------------------目前有一个问题,不管侧键按的是4 5 7 8都是按照4号键来压的,就算给名字上双引号也没用
----------------------------------------------------IsLeftPress()和MoveFunc()两个函数里面加不加函数结果都一样
function MoveFunc(Gun) ------------------*鼠标下移函数*
if (Gun == M4 ) then
OutputLogMessage("M4.ing\n")
repeat
MoveMouseRelative(0, 1) -------------M4系数
Sleep(10)
until not IsMouseButtonPressed(1)
elseif (Gun == Vector) then
OutputLogMessage("Vector.ing\n")
repeat
MoveMouseRelative(0, 4) ------------Vector系数
Sleep(10)
until not IsMouseButtonPressed(1)
end
----------------------------------------------------判断鼠标侧键是否启动
-- function IsSidePress()
-- -- body
-- 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 == 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
---------------------------------十分感谢能抽空解答的站友们! |