-1

https://docs.google.com/document/d/1pX81q-AEn2o7n0rlpvD-GOoKCakMxqO0v8-JXPjtEnA/edit?usp=sharing

----- - here are all my LUA files

  • here are all my Lua files! they are used in LOGitech Ghud . when the macro is active, hold down the right mouse button and press the left mouse button to start the macro ( you cannot stop the macro while you are holding the right mouse button!) - I want them to stop when I release the left mouse button
    RC_COUNT = #RC_TABLE
    local LastIndex = 1
    if IsMouseButtonPressed(1)then 
        if (LastIndex <= RC_COUNT) then
            i = LastIndex
        else
            i = 1
        end
        while i <= RC_COUNT do
            if IsMouseButtonPressed(3)then
                PressAndReleaseMouseButton(1)
                MoveMouseRelative(RC_TABLE[i].x, RC_TABLE[i].y)Sleep(18)

            else
                LastIndex = i
                break
            end
            i = i + 1
        end
    end
end

when i right click my command will use ! and I left click they will continue working

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
  • 1
    That's no way c++ code. Remove that tag please! – πάντα ῥεῖ Jul 04 '23 at 16:30
  • Fwiw, it seems like there's something missing at the start of this macro – Ted Lyngmo Jul 04 '23 at 16:38
  • Jim, what documentation are you using when programming the macro? G-series Lua API? Which version? – Ted Lyngmo Jul 04 '23 at 16:41
  • One detail: `MoveMouseRelative(RC_TABLE[i].x, RC_TABLE[i].y)Sleep(18)` should be on two separate lines. `MoveMouseRelative(RC_TABLE[i].x, RC_TABLE[i].y)` and `Sleep(18)` – Ted Lyngmo Jul 04 '23 at 16:47
  • I think you need to post the full lua script in a [mre] and please state what version it is you're working with. The API and documentation has changed over the years. – Ted Lyngmo Jul 04 '23 at 16:50
  • The problem description is unclear. Please: 1) Show the whole script; 2) Specify what you expect the script to do; 3) What the script actually does. – ESkri Jul 04 '23 at 17:14
  • Jim, since you are new here you may not have expected to get a ton of requests for clarification, but that's not uncommon. It's usually a good idea to post a question when you have time to stick around for 30 minutes to clarify the question. Posting it and leaving it, hoping to have a solution when you check back hours later usually ends in disappointment because the question will likely have been closed so that no answers can be given. – Ted Lyngmo Jul 04 '23 at 18:32

1 Answers1

0
  1. In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your GHub script will use P.

  2. Replace these two lines

        if IsMouseButtonPressed(3)then
            PressAndReleaseMouseButton(1)

with the following:

        if IsMouseButtonPressed(3) and IsMouseButtonPressed(1) then
            PressAndReleaseKey("P")
ESkri
  • 1,461
  • 1
  • 1
  • 8