
你们好,最近小活发现有诸多的小伙伴们对于罗技g502压枪宏脚本lua,罗技g502压枪宏脚本这个问题都颇为感兴趣的,今天小活为大家梳理了下,一起往下看看吧。
1、罗技官网下载安装“罗技游戏软件”。
2、打开“罗技游戏软件”找到罗技游戏软件里对应的G502游戏鼠标,将配置文件设置为“自动游戏检测”
3、进入按键配置,选择配置文件,弹出菜单,选择“编写脚本”,进行脚本编写设置。
4、然后就可以编写脚本以配置按键和游戏设置以及宏了,脚本可以参考下面的自行编写,或者去下载一个配置文件修改。下面附上网络上流行的一套“绝地求生”游戏的配置设置脚本
5、local pubg = {}
6、-------------------------------------------------------------------------------
7、-- 快捷键定义区域
8、-------------------------------------------------------------------------------
9、pubg.keyPickupWeapon = 8
10、pubg.keyAlwayRun = 4 -- 直接按键
11、pubg.keyLookAround = 1 -- alt + G + 定义
12、pubg.keyWeaponUmp9 = 8 -- G + 定义
13、pubg.keyWeaponAkm = 7 -- G + 定义
14、pubg.keyWeaponM16a4 = 7 -- 定义
15、pubg.keyWeaponM416 = 5 -- 定义
16、pubg.keyDrop = 1 -- G + 定义
17、-------------------------------------------------------------------------------
18、-- 变量定义区域
19、-------------------------------------------------------------------------------
20、-- 鼠标G键是否被按下
21、pubg.isGKeyPressed = false
22、-- 当鼠标G键被按下去之后,其他按钮是否被按下
23、pubg.isOKeyPressed = false
24、-- 当前选择的武器
25、pubg.currentWeapon = "NIL"
26、-------------------------------------------------------------------------------
27、-- 随机函数,支出负数
28、-------------------------------------------------------------------------------
29、pubg.random = function (min, max)
30、 local nMin = 1
31、 local nMax = max - min
32、 local randomNumber = math.random(nMin, nMax)
33、 return randomNumber + min - 1
34、end
35、-------------------------------------------------------------------------------
36、-- 一件拾取装备 = 游戏中:从左边拉物品到武器栏中
37、-------------------------------------------------------------------------------
38、pubg.onPickupWeapon = function ()
39、 local currentMouseX, currentMouseY = GetMousePosition()
40、 PressMouseButton(1)
41、 for i = 1, 5 do
42、 MoveMouseRelative(pubg.random(100, 120), pubg.random(-10, 10))
43、 Sleep(20)
44、 end
45、 ReleaseMouseButton(1)
46、 Sleep(100)
47、 MoveMouseTo(currentMouseX, currentMouseY)
48、end
49、-------------------------------------------------------------------------------
50、-- 一键丢东西 = 游戏中:ctrl+拖放
51、-------------------------------------------------------------------------------
52、pubg.onDrop = function ()
53、 local currentMouseX, currentMouseY = GetMousePosition()
54、 PressMouseButton(1);Sleep(20)
55、 for i = 1, 3 do
56、 MoveMouseRelative(pubg.random(-126, -100), pubg.random(-10, 10))
57、 Sleep(20)
58、 end
59、 ReleaseMouseButton(1)
60、 Sleep(100)
61、 MoveMouseTo(currentMouseX, currentMouseY)
62、end
63、-------------------------------------------------------------------------------
64、-- 一键奔跑 = 游戏中:按=好
65、-------------------------------------------------------------------------------
66、pubg.onAlwayRun = function ()
67、 PressKey(0x0d)
68、 Sleep(400)
69、 ReleaseKey(0x0d)
70、end
71、-------------------------------------------------------------------------------
72、-- 自动环视周围
73、-------------------------------------------------------------------------------
74、pubg.onLookAround = function ()
75、 PressMouseButton(1)
76、 repeat
77、 MoveMouseRelative(pubg.random(30, 70), pubg.random(-1, 2))
78、 Sleep(20)
79、 until not IsMouseButtonPressed(1)
80、 ReleaseMouseButton(1)
81、end
82、-------------------------------------------------------------------------------
83、-- 当单独的G键被按下
84、-------------------------------------------------------------------------------
85、pubg.onGKeyPressed = function ()
86、 pubg.currentWeapon = "NIL"
87、end
88、-------------------------------------------------------------------------------
89、-- 选择UMP9枪
90、-------------------------------------------------------------------------------
91、pubg.onWeaponUmp9 = function ()
92、 local weaponRocilData = {5, 5, 5, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}
93、 local weaponDuration = 20
94、 local currentRecoilPos = 1
95、 repeat
96、 MoveMouseRelative(pubg.random(-1,2), weaponRocilData[currentRecoilPos])
97、 currentRecoilPos = currentRecoilPos + 1
98、 Sleep(weaponDuration)
99、 OutputLogMessage(tostring(currentRecoilPos) .. " ")
100、 if currentRecoilPos == #weaponRocilData then
101、 currentRecoilPos = 1
102、 end
103、 until not IsMouseButtonPressed(1)
104、end
105、-------------------------------------------------------------------------------
106、-- 选择AKM枪
107、-------------------------------------------------------------------------------
108、pubg.onWeaponAkm = function ()
109、 local weaponRocilData = {5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}
110、 local weaponDuration = 20
111、 local currentRecoilPos = 1
112、 repeat
113、 MoveMouseRelative(0, weaponRocilData[currentRecoilPos])
114、 currentRecoilPos = currentRecoilPos + 1
115、 Sleep(weaponDuration)
116、 OutputLogMessage(tostring(currentRecoilPos) .. " ")
117、 if currentRecoilPos == #weaponRocilData then
118、 currentRecoilPos = 1
119、 end
120、 until not IsMouseButtonPressed(1)
121、end
122、-------------------------------------------------------------------------------
123、-- 选择M16A4枪
124、-------------------------------------------------------------------------------
125、pubg.onWeaponM16a4 = function ()
126、 local weaponRocilData = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}
127、 local weaponDuration = 20
128、 local currentRecoilPos = 1
129、 repeat
130、 MoveMouseRelative(pubg.random(-1,2), weaponRocilData[currentRecoilPos])
131、 currentRecoilPos = currentRecoilPos + 1
132、 Sleep(weaponDuration)
133、 OutputLogMessage(tostring(currentRecoilPos) .. " ")
134、 if currentRecoilPos == #weaponRocilData then
135、 currentRecoilPos = 1
136、 elseif currentRecoilPos % 5 == 0 then
137、 ReleaseMouseButton(1)
138、 Sleep(10)
139、 PressMouseButton(1)
140、 Sleep(100)
141、 end
142、 until not IsMouseButtonPressed(1)
143、 OutputLogMessage("IsMouseButtonPressed == false\n")
144、end
145、-------------------------------------------------------------------------------
146、-- 选择M416枪
147、-------------------------------------------------------------------------------
148、pubg.onWeaponM416 = function ()
149、 ClearLog()
150、 local weaponRocilData = {5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 2, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}
151、 local weaponDuration = 20
152、 local currentRecoilPos = 1
153、 repeat
154、 MoveMouseRelative(pubg.random(-1,2), weaponRocilData[currentRecoilPos])
155、 currentRecoilPos = currentRecoilPos + 1
156、 Sleep(weaponDuration)
157、 OutputLogMessage(tostring(currentRecoilPos) .. " ")
158、 if currentRecoilPos == #weaponRocilData then
159、 currentRecoilPos = 1
160、 elseif currentRecoilPos % 5 == 0 then
161、 ReleaseMouseButton(1)
162、 Sleep(20)
163、 PressMouseButton(1)
164、 end
165、 until not IsMouseButtonPressed(1)
166、end
167、-------------------------------------------------------------------------------
168、-- pubg逻辑处理
169、-------------------------------------------------------------------------------
170、pubg.onEvent = function (event, arg)
171、 OutputLogMessage("event = %s, arg = %d\n", event, arg)
172、
173、 if event == "PROFILE_ACTIVATED" then
174、 EnablePrimaryMouseButtonEvents(true)
175、 elseif event == "PROFILE_DEACTIVATED" then
176、 EnablePrimaryMouseButtonEvents(false)
177、 pubg.currentWeapon = "NIL"
178、 ReleaseKey(0x1d)
179、 ReleaseMouseButton(1)
180、 ReleaseMouseButton(2)
181、 return
182、 end
183、
184、 -- G键按下逻辑
185、 if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
186、 pubg.isGKeyPressed = true
187、 pubg.isOKeyPressed = false
188、 elseif event == "MOUSE_BUTTON_RELEASED" and arg == 6 then
189、 pubg.isGKeyPressed = false
190、 end
191、
192、 -- 在G键按下的时候,其他键是否被按下
193、 if event == "MOUSE_BUTTON_PRESSED" and arg ~= 6 and pubg.isGKeyPressed then
194、 pubg.isOKeyPressed = true
195、 end
196、
197、 -- 单独G键被按下
198、 if event == "MOUSE_BUTTON_RELEASED" and arg == 6 and pubg.isOKeyPressed == false then
199、 pubg.onGKeyPressed()
200、 -- 一键拾取物品
201、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyPickupWeapon and pubg.isGKeyPressed == false then
202、 pubg.onPickupWeapon()
203、 -- 一键丢弃物品
204、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyDrop and pubg.isGKeyPressed == true then
205、 pubg.onDrop()
206、 -- 一键奔跑
207、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyAlwayRun and pubg.isGKeyPressed == false then
208、 pubg.onAlwayRun()
209、 -- 自动环视周围
210、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyLookAround and IsModifierPressed("alt") then
211、 pubg.onLookAround()
212、 -- 选择UMP9
213、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyWeaponUmp9 and pubg.isGKeyPressed == true then
214、 pubg.currentWeapon = "UMP9"
215、 -- 选择AKM
216、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyWeaponAkm and pubg.isGKeyPressed == true then
217、 pubg.currentWeapon = "AKM"
218、 -- 选择M16A4
219、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyWeaponM16a4 and pubg.isGKeyPressed == false then
220、 pubg.currentWeapon = "M16A4"
221、 -- 选择M416
222、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == pubg.keyWeaponM416 and pubg.isGKeyPressed == false then
223、 pubg.currentWeapon = "M416"
224、
225、 -- 鼠标左键被按下
226、 elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
227、 if pubg.currentWeapon ~= "NIL" then
228、 if pubg.currentWeapon == "UMP9" then
229、 pubg.onWeaponUmp9()
230、 elseif pubg.currentWeapon == "AKM" then
231、 pubg.onWeaponAkm()
232、 elseif pubg.currentWeapon == "M16A4" then
233、 pubg.onWeaponM16a4()
234、 elseif pubg.currentWeapon == "M416" then
235、 pubg.onWeaponM416()
236、 end
237、 end
238、 end
239、end
240、-------------------------------------------------------------------------------
241、-- 驱动入口函数
242、-------------------------------------------------------------------------------
243、function OnEvent(event, arg)
244、 pubg.onEvent(event, arg)
245、end
以上就是罗技g502压枪宏脚本这篇文章的一些介绍,希望对大家有所帮助。
