如何将两个LUA脚本合并
2020-12-28 17:12:14
收藏:0
阅读:192
评论:2
这两个脚本可以合并吗?
代码1:
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3)and IsKeyLockOn"capslock" then -- 右键按下
Sleep(10)
repeat
MoveMouseRelative(0,2)
Sleep(10)
until not IsMouseButtonPressed(1) -- 右键松开
end
end
code 2
----------------Made By LazyBaxy------------------
local norecoil = true
local norecoilDelay = 16
local norecoilForce = 4
local fastloot = true
local setposmode = false
local fastlootkey_pos1 = 6
local fastlootkey_pos2 = 6
local cords = {{3552,8456},{26870,27774},26278}
--cords{{pos1 x, pos1 y},{pos2 x, pos2 y}, inventory x}
--使用 setposmode 调整 fastloot。
------------------Advanced------------------------
function fastloot(loc)
local x = math.random(cords[loc][1]-100,cords[loc][1]+100)
local y = math.random(cords[loc][2]-100,cords[loc][2]+100)
local d = math.random(cords[3],cords[3]+1000)
MoveMouseTo(x,y)
PressMouseButton(1)
MoveMouseTo(d,y)
ReleaseMouseButton(1)
end
function OnEvent(event, arg)
if(event=="PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(1)
elseif(event=="PROFILE_DEACTIVATED") then
ReleaseMouseButton(1)
elseif(IsMouseButtonPressed(1) and IsMouseButtonPressed(3) and norecoil)then
repeat
MoveMouseRelative(0,norecoilForce)
Sleep(norecoilDelay)
until not IsMouseButtonPressed(1)
elseif(setposmode) then
ClearLog()
local x, y = GetMousePosition()
OutputLogMessage("X: "..x.."\nY: "..y.."\n")
elseif(event=="MOUSE_BUTTON_PRESSED" and fastloot) then
if(arg==fastlootkey_pos1) then
fastloot(1)
elseif(arg==fastlootkey_pos2) then
fastloot(2)
end
end
end
我只想要第二份代码中的 fastloot 部分!!! ..............................................................................................................................................................................................
点赞
用户13447666
将 fastloot 和 code 2 locals 快速复制粘贴到 code 1 的第一行
为什么你不能复制粘贴呢?
2020-12-29 07:06:37
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

----------------Made By LazyBaxy------------------
local norecoil = true local norecoilDelay = 10 local norecoilForce = 2 local fastloot = true local setposmode = false local fastlootkey_pos1 = 6 local fastlootkey_pos2 = 6 local cords = {{3552,8456},{26870,27774}, 26278} --cords{{pos1 x, pos1 y},{pos2 x, pos2 y},..., inventory x} --use setposmode to adjust fastloot. ------------------Advanced------------------------ local function fastloot(loc) local x = cords[loc][1] + math.random(-100,100) local y = cords[loc][2] + math.random(-100,100) local d = cords[#cords] + math.random(0,1000) MoveMouseTo(x,y) Sleep(20) PressMouseButton(1) Sleep(30) MoveMouseTo(d,y) Sleep(30) ReleaseMouseButton(1) end function OnEvent(event, arg) if(event=="PROFILE_ACTIVATED") then EnablePrimaryMouseButtonEvents(1) elseif(event=="PROFILE_DEACTIVATED") then ReleaseMouseButton(1) elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and norecoil and IsMouseButtonPressed(3) and IsKeyLockOn"capslock" then repeat MoveMouseRelative(0,norecoilForce) Sleep(norecoilDelay) until not IsMouseButtonPressed(1) elseif(setposmode) then ClearLog() local x, y = GetMousePosition() OutputLogMessage("X: "..x.."\nY: "..y.."\n") elseif(event=="MOUSE_BUTTON_PRESSED" and arg==fastlootkey_pos1 and fastloot) then fastloot(1) elseif(event=="MOUSE_BUTTON_PRESSED" and arg==fastlootkey_pos2 and fastloot) then fastloot(2) end end由 LazyBaxy 制作
本脚本用于自定义鼠标设置
原理
使用 lua 代码模拟鼠标输入
使用方法
通过手动修改代码中的参数来修改功能
其他
如有需要可以自行通过修改代码来实现更强大的功能。