0% found this document useful (0 votes)
24 views4 pages

lua_script_logitech

The document contains a series of scripts for mouse event handling, specifically designed to enable or disable a script using mouse button 5. When enabled, the script allows for continuous mouse movement downward when button 1 is pressed, with variations in movement speed and logging messages for button actions. The scripts also include features for compensating recoil during sustained button presses.

Uploaded by

dima.pbg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

lua_script_logitech

The document contains a series of scripts for mouse event handling, specifically designed to enable or disable a script using mouse button 5. When enabled, the script allows for continuous mouse movement downward when button 1 is pressed, with variations in movement speed and logging messages for button actions. The scripts also include features for compensating recoil during sustained button presses.

Uploaded by

dima.pbg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

local button5IsEnabled = false

function OnEvent(event, arg)


if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enable\n")
else
button5IsEnabled = false
OutputLogMessage("Script disable\n")
end
end

if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then


isMouseDown = true
end

if button5IsEnabled and event == "MOUSE_BUTTON_RELEASED" and arg == 1 then


isMouseDown = false
end

if button5IsEnabled and isMouseDown then


MoveMouseRelative(0, 5) -- перемещение курсора на 5 пикселей вниз
Sleep(10)
while isMouseDown do
MoveMouseRelative(0, 5) -- перемещение курсора на 5 пикселей вниз
Sleep(10)
end
end
end

#
-----------------------------------------------------------------------------------
---------------------------
local button5IsEnabled = false
local isButton1Pressed = false

function OnEvent(event, arg)


if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end
end

#
-----------------------------------------------------------------------------------
---------------------------
EnablePrimaryMouseButtonEvents(true)

local button5IsEnabled = false


local isButton1Pressed = false

function OnEvent(event, arg)


if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end

if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then


OutputLogMessage("Button 1 is pressed\n")
end
end

#
-----------------------------------------------------------------------------------
---------------------------
# Курсор продолжает опускаться даже после того как ЛКМ отпущена
EnablePrimaryMouseButtonEvents(true)

local button5IsEnabled = false


local isButtonDown = false
local cursorStartPosition = nil

function OnEvent(event, arg)


if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end

--if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then


--OutputLogMessage("Button 1 is pressed\n")
--MoveMouseRelative(0, 10)
--Sleep(5)
--end

if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then


isButton1Pressed = true
while isButton1Pressed do
MoveMouseRelative(0, 5)
Sleep(5)
end
end

if event == "MOUSE_BUTTON_RELEASED" and arg == 1 then


isButton1Pressed = false
end
end

# --------------------------------------------------------------------
EnablePrimaryMouseButtonEvents(true)

local button5IsEnabled = false


function OnEvent(event, arg)
-- Включить/выключить скрипт
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end

if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then


OutputLogMessage("Button 1 is pressed\n")
repeat
MoveMouseRelative(0, 2) -- переместить курсор мыши на 10 пикселей вниз
Sleep(5) -- приостановить выполнение скрипта на 10 миллисекунд, чтобы не
нагружать процессор
until not IsMouseButtonPressed(1) -- продолжать перемещать курсор, пока левая
кнопка мыши удерживается
elseif button5IsEnabled and event == "MOUSE_BUTTON_RELEASED" and arg == 1 then
OutputLogMessage("Button 1 is released\n")
end
end

# ----------------------------------------------------------------------
EnablePrimaryMouseButtonEvents(true)

local button5IsEnabled = false

function OnEvent(event, arg)


-- Включить/выключить скрипт
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end

-- Компенсация отдачи при удержании ЛКМ


if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
OutputLogMessage("Button 1 is pressed\n")
Sleep(200)
repeat
math.randomseed(os.time()) -- инициализация генератора случайных чисел
текущим временем
local number = math.floor(math.random() * 3 + 4) -- генерация случайного
числа в диапазоне от 4 до 6
MoveMouseRelative(0, 2)
Sleep(4)
OutputLogMessage("Number: %d\n", number)
until not IsMouseButtonPressed(1)
elseif button5IsEnabled and event == "MOUSE_BUTTON_RELEASED" and arg == 1 then
OutputLogMessage("Button 1 is released\n")
end
end

#
-----------------------------------------------------------------------------------
------------------
EnablePrimaryMouseButtonEvents(true)

local button5IsEnabled = false

function OnEvent(event, arg)


-- Включить/выключить скрипт
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
if not button5IsEnabled then
button5IsEnabled = true
OutputLogMessage("Script enabled\n")
else
button5IsEnabled = false
OutputLogMessage("Script disabled\n")
end
end

-- Компенсация отдачи при удержании ЛКМ


if button5IsEnabled and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
OutputLogMessage("Button 1 is pressed\n")
Sleep(240)
repeat
MoveMouseRelative(0, 4)
Sleep(15)
until not IsMouseButtonPressed(1)
elseif button5IsEnabled and event == "MOUSE_BUTTON_RELEASED" and arg == 1 then
OutputLogMessage("Button 1 is released\n")
end
end

You might also like