吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4328|回复: 2
上一主题 下一主题
收起左侧

[求助] 罗技宏Lua语法错误,但是不知道哪错了

[复制链接]
跳转到指定楼层
楼主
无名小泽 发表于 2020-4-19 15:59 回帖奖励

烦请大佬们指出错误,十分感谢!
[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

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

沙发
defendx 发表于 2020-5-17 09:56
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
3#
vip021913 发表于 2020-5-19 06:11
你这个是只能用罗技键盘才能生效吗?问题解决了嘛?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 16:09

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表