local fireStatus = false --设置一个全局变量,控制是否启用该功能 --SetBacklightColor(0,0,255) --设置背光, 我的设备不支持,就注释掉了 EnablePrimaryMouseButtonEvents(true) --启动主键检测即鼠标左键(默认是不检测的) function OnEvent(event, arg) --全部事件的监控 if (event == "MOUSE_BUTTON_PRESSED" and arg == 4 ) then --用4键来开启此功能 fireStatus = not fireStatus --if(fireStatus) then --SetBacklightColor(255,0,0) --else --SetBacklightColor(0,0,255) --end end if ( fireStatus == true and event == "MOUSE_BUTTON_PRESSED" and arg == 1 ) then --检测到鼠标左键按下 --while(IsMouseButtonPressed(1)) -- 当鼠标左键处于按下状态时执行下面代码 (不知什么原因,循环语句在我的游戏窗口上不起作用,就没有用循环控制) --do MoveMouseRelative(0, 4) --鼠标指针相对位移 Sleep(80) --睡眠 (用循环做时睡眠函数不可去掉,否则代码执行过快,容易卡死,相当于死循环) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) MoveMouseRelative(0, 4) Sleep(80) --MoveMouseRelative(0, 50) --end end end
请发表评论