微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

结合两个脚本LUA

如何解决结合两个脚本LUA

这些脚本可以组合吗?

代码 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  -- RMB pressed
      Sleep(10)
      repeat
         MoveMouseRelative(0,2)
         Sleep(10)
      until not IsMouseButtonpressed(1)  -- RMB released
end
end

代码 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}
--use setposmode to adjust 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 部分!!! ………………………………………………………………………………………………………………………………………………………… ……………………………………………………………………………………………………………………………………………………………… ……………………………………………………………………………………………………………………………………………………………… ....................................

解决方法

----------------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

,

将 fastloot 和 code 2 locals 复制粘贴到 code 1 的第一行

为什么不能复制粘贴

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。