Manos
Manos

Reputation: 11

LUA script on gaming mouse doesnt work in Origin software

Even though my Lua scripts for my gaming mouse Logitech G502 Hero work fine in Windows desktop, or every application or game I tries, they dont work on Battlefield and the Origin app. Custom macros work, but the scripting doesnt.

Any ideas? or anyone else having the same problem?

Thanks! Emmanouil Filippou

Here is an example of a simple Lua script that I have tried and doesnt work.

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
        if IsMouseButtonPressed(3)then
            repeat  
                if IsMouseButtonPressed(1) then
                    repeat
                        MoveMouseRelative(0,5)
                        Sleep(33)
                    until not IsMouseButtonPressed(1)
                end             
            until not IsMouseButtonPressed(3)
        end     
end

Upvotes: 0

Views: 2381

Answers (2)

SWIZZ
SWIZZ

Reputation: 1

also you need to launch G-Hub as administrator

Upvotes: 0

Egor Skriptunoff
Egor Skriptunoff

Reputation: 23767

You have forgotten to insert Sleep

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
    Sleep(20)
    if IsMouseButtonPressed(3)then
        repeat  
            if IsMouseButtonPressed(1) then
                repeat
                    MoveMouseRelative(0,5)
                    Sleep(33)
                until not IsMouseButtonPressed(1)
            end             
        until not IsMouseButtonPressed(3)
    end     
end

Upvotes: 0

Related Questions