Coder Social home page Coder Social logo

pubg-weapon-macro's Introduction

PUBG-weapon-macro

一个很简单鼠标压枪宏

local pubg = {}
-------------------------------------------------------------------------------
-- pubg逻辑处理
-------------------------------------------------------------------------------
pubg.onEvent = function (event, arg)
	OutputLogMessage("event = %s, arg = %d\n", event, arg)
	
	-- 前进键盘负责开启和关闭
	if event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
            EnablePrimaryMouseButtonEvents(true)
	elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
	    EnablePrimaryMouseButtonEvents(false)
	end

       -- 鼠标左键被按下
	if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
  	  repeat
  	    OutputLogMessage("use M416 MoveMouseRelative\n")
  		MoveMouseRelative(0, 5)
  		Sleep(20)
  	  until not IsMouseButtonPressed(1)
	end
end

-------------------------------------------------------------------------------
-- 驱动入口函数
-------------------------------------------------------------------------------

function OnEvent(event, arg)
	pubg.onEvent(event, arg)
end

罗技鼠标宏api文档

版本2:

-- v2 增加 下拉加速度 处理
local pubg = {}
-------------------------------------------------------------------------------
-- pubg逻辑处理
-------------------------------------------------------------------------------
local flag = 0 -- 开启开关
local SLEEP_TIME = 20 -- 间隔时间 毫秒
local MOVE_SENSITIVE = 5 -- 下拖灵敏度 像素
local move = MOVE_SENSITIVE

pubg.onEvent = function (event, arg)
	OutputLogMessage("event = %s, arg = %d flag = %s \n", event, arg, flag )

	-- 前进键盘负责开启和关闭
	if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
	    if flag == 0  then
	      EnablePrimaryMouseButtonEvents(true)
	      flag = 1
	    else
	      EnablePrimaryMouseButtonEvents(false)
	      flag = 0
	    end
	end

       -- 鼠标左键被按下
	if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3)  then
        for i = 0, 2000, 1 do --- 支持连续开火最长时间
            if not IsMouseButtonPressed(1) then
                move = MOVE_SENSITIVE
                break
            end
            if i % 40 == 0 and i <= 100 then --- 下拉加速度
                move = move + 1
            end
            MoveMouseRelative(0, move)
            Sleep(SLEEP_TIME)
        end
	end
end

-------------------------------------------------------------------------------
-- 驱动入口函数
-------------------------------------------------------------------------------

function OnEvent(event, arg)
	pubg.onEvent(event, arg)
end

pubg-weapon-macro's People

Contributors

ackermannn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.