1

我正在使用 G700 鼠标,并且正在尝试编写快速 LUA 脚本。我无法将 IsMouseButtonPressed 分配给任何其他鼠标按钮,然后是 1、2、3。如何在 G4 鼠标按钮上使用 IsMouseButtonPressed?

在职的...

if IsMouseButtonPressed(2) then
   OutputLogMessage("Mouse button 2 pressed") 
end

不工作...

if IsMouseButtonPressed(4) then
   OutputLogMessage("Mouse button 4 pressed") 
end

我在右键单击时需要此功能。

脚本

    ----------------------------------------------Simple settings----------------------------------------------
    REEcoil=1000
    Sensrelative=REEcoil/1000
    ---------------------------Rapidfire---------------------------
    PressSpeedMin=15            --Change this           <-this is the delay between pressing and releasing left click
    PressSpeedMax=25            --Change this
            
    NoRecoilRFMin=3         --Change this           <-this is recoil reduction
    NoRecoilRFMax=5         --Change this
        
     
    SleepNRFMin=75          --Change this           <-this is the delay between clicks
    SleepNRFMax=105         --Change this
            
    ------------------------------------------------------BINDS------------------------------------------------------

        LCRF=1              --just leftclick
    RC=3                    --just rightclick
    Rapidfirebutton=4       -- tis my forward key for thumb use >>> if I put RapidFireButton to 2 then it's working fine. How can I make it work with my thumb button?
       
 
    ------------------------------------------------------FUNCTIONS------------------------------------------------------   
    EnablePrimaryMouseButtonEvents(true);   
     
function RapidFire()    
        
    OutputLogMessage("Running RapidFire function")
    
        repeat
        OutputLogMessage("Mousebutton " .. Rapidfirebutton .. " clicked. \n")               
        PressMouseButton(LCRF)
            Sleep(math.random(PressSpeedMin,PressSpeedMax))
            ReleaseMouseButton(LCRF)
            MoveMouseRelative(0,math.random(NoRecoilRFMin,NoRecoilRFMax)*Sensrelative)
            Sleep(math.random(SleepNRFMin,SleepNRFMax)) 
            MoveMouseRelative(0,math.random(NoRecoilRFMin,NoRecoilRFMax)*Sensrelative)
        until not IsMouseButtonPressed(Rapidfirebutton)
end    

 ------------------------------------------------------Main function------------------------------------------------------
function OnEvent(event, arg)    

    if GetMKeyState() == 3 then
     
        OutputLogMessage("Script active.".. "\n")

        if IsMouseButtonPressed(RC)then                 --Loop for ADS. Primes rapidfire
                OutputLogMessage("Weapon primed \n")                             
                
            repeat
                    if IsMouseButtonPressed(Rapidfirebutton)  then              
                    OutputLogMessage("Call function RapidFire \n")
                    RapidFire   ()
                    Sleep(20) -- added after comment by EGOR
                end
             until not IsMouseButtonPressed(RC)             --end of Priming loop
          end
    end
end
4

0 回答 0