syntax error (i need some help)

Hey guys,

I was trying to edit a lua script, but something is wrong.

Since i am not really into this, can someone tell me where the bug is? The red marked line is shown as syntax error. If i remove some lines, it automatically marks the line before the blue text as an error.

best regards,

john

EnablePrimaryMouseButtonEvents(true);

local recoil = not true;

function OnEvent(event, arg)

 

if (event == “MOUSE_BUTTON_PRESSED” and arg == 9) then

recoil = not recoil

OutputLogMessage(“SCAR-H + RDS”, 2014)

end

 

if IsMouseButtonPressed(3) and recoil then

Sleep(1)

if (event == “MOUSE_BUTTON_PRESSED” and arg == 1) then

Sleep(85)

MoveMouseRelative(-4,3)

Sleep(85)

MoveMouseRelative(-5,2)

Sleep(85)

MoveMouseRelative(6,1)

Sleep(85)

MoveMouseRelative(-5,2)

Sleep(85)

MoveMouseRelative(6,0)

Sleep(85)

MoveMouseRelative(-6,5)

Sleep(85)

MoveMouseRelative(8,4)

Sleep(85)

MoveMouseRelative(7,4)

Sleep(85)

MoveMouseRelative(-7,1)

Sleep(85)

MoveMouseRelative(-7,1)

Sleep(85)

MoveMouseRelative(4,2)

Sleep(85)

MoveMouseRelative(6,2)

Sleep(85)

MoveMouseRelative(-1,2)

Sleep(85)

MoveMouseRelative(-8,3)

Sleep(85)

MoveMouseRelative(3,3)

Sleep(85)

MoveMouseRelative(6,1)

Sleep(85)

MoveMouseRelative(-3,-1)

Sleep(85)

MoveMouseRelative(0,2)

Sleep(85)

MoveMouseRelative(-1,2)

Sleep(85)

MoveMouseRelative(5,0)

Sleep(85)

MoveMouseRelative(-4,0)

Sleep(85)

MoveMouseRelative(6,0)

Sleep(85)

MoveMouseRelative(3,-2)

Sleep(85)

MoveMouseRelative(-4,-2)

Sleep(85)

MoveMouseRelative(2,-1)

Sleep(85)

MoveMouseRelative(-5,0)

Sleep(85)

MoveMouseRelative(4,0)

Sleep(85)

MoveMouseRelative(-2,-1)

Sleep(85)

MoveMouseRelative(-2,-1)

Sleep(85)

until not IsMouseButtonPressed(3) or not IsMouseButtonPressed(1)

end

end

end

Hi.

First off, in the future you should post in a code block (the “< >” symbol in the reply menu), for better formatting.

An “until” needs to be paired with a “repeat” , earlier in the code. Without knowing quite what you mean to do or what the various numbers mean, you might be going for something like this:

if (event == "MOUSE\_BUTTON\_PRESSED" and arg == 1) then repeat -- ADD THIS! Sleep(85) MoveMouseRelative(-4,3) -- etc.

Are you meaning to port this to Corona? (It seems to be Logitech mouse scripting.) Just curious, really.

Thanks! It worked :slight_smile:

I want to try some stuff with the logitech gaming software of my mouse (Logitech G300)

Hi.

First off, in the future you should post in a code block (the “< >” symbol in the reply menu), for better formatting.

An “until” needs to be paired with a “repeat” , earlier in the code. Without knowing quite what you mean to do or what the various numbers mean, you might be going for something like this:

if (event == "MOUSE\_BUTTON\_PRESSED" and arg == 1) then repeat -- ADD THIS! Sleep(85) MoveMouseRelative(-4,3) -- etc.

Are you meaning to port this to Corona? (It seems to be Logitech mouse scripting.) Just curious, really.

Thanks! It worked :slight_smile:

I want to try some stuff with the logitech gaming software of my mouse (Logitech G300)