大家好,我有一个键盘 G105
,我试图制作一个小脚本,它正在工作,但它不想停止。
我想打开 G1 和关闭 G2。谢谢
**Macro LIST**
skill Selfbuff -- use after any playmacro "Petx" after reuse time
1 PlayMacro(selfbuff1) Sleep (1800000) --30 minutes
2 PlayMacro(selfbuff2) Sleep (600000) -- 10 minutes
-- add more
Skill Empower -- use after any playmacro "Petx" if none of then are
runing, can be at same time with "Skill Sellbuff" list
1 PlayMacro(Boost1) Reuse time = 480 seconds,Boosting time = 60 seconds
2 PlayMacro(Boost2) Reuse time = 600 seconds, Boosting time = 180 seconds
-- add more
-- G1 = 2pet
-- G2 = 3pet
local function interruptable_sleep(delay)
local tm = GetRunningTime() + delay
repeat
if IsKeyLockOn("scrolllock") then return true end
local t = tm - GetRunningTime()
if t > 0 then Sleep(math.min(t, 100)) end
until t <= 0
end
function OnEvent(event, arg)
if event=="G_PRESSED" and arg==1 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet1", sleep_macro = 2000, },
-- if on reuse PlayMacro(selfbuff1),PlayMacro(Selfbuff2), may add more
-- if on reuse PlayMacro(boots1),PlayMacro(boost2) may add some
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet2", sleep_macro = 2000, },
-- if on reuse PlayMacro(selfbuff1),PlayMacro(Selfbuff2), may add more
-- if on reuse PlayMacro(boots1),PlayMacro(boost2) may add some
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
PressAndReleaseKey("scrolllock")
end
end
非常感谢您的帮助,但我无法理解
这是我的完整脚本谢谢你
local function interruptable_sleep(delay)
local tm = GetRunningTime() + delay
repeat
if IsKeyLockOn("scrolllock") then return true end
local t = tm - GetRunningTime()
if t > 0 then Sleep(math.min(t, 100)) end
until t <= 0
end
function OnEvent(event, arg)
if event=="G_PRESSED" and arg==1 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet1", sleep_macro = 2000, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet2", sleep_macro = 2000, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
Sleep(250)
PressAndReleaseKey("scrolllock")
elseif event=="G_PRESSED" and arg==2 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet1", sleep_macro = 2000, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet2", sleep_macro = 2000, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "Pet3", sleep_macro = 2000, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
Sleep(250)
PressAndReleaseKey("scrolllock")
elseif event=="G_PRESSED" and arg==3 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 13000, },
{macro = "Pick", sleep_macro = 1000, },
{macro = "PetLargo1", sleep_macro = 2800, },
{macro = "Basicos1", sleep_macro = 13000, },
{macro = "Pick", sleep_macro = 1000, },
{macro = "PetLargo2", sleep_macro = 2800, },
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
Sleep(250)
PressAndReleaseKey("scrolllock")
elseif event=="G_PRESSED" and arg==4 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "PetLargo1", sleep_macro = 2800, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "PetLargo2", sleep_macro = 2800, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
{macro = "PetLargo3", sleep_macro = 2800, },
{macro = "Basicos1", sleep_macro = 16000, },
{macro = "Pick", sleep_macro = 2000, },
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
Sleep(250)
PressAndReleaseKey("scrolllock")
elseif event=="G_PRESSED" and arg==5 then
repeat
local exit
for _, phase in ipairs{
{macro = "Basicos1", sleep_macro = 16000,},
{macro = "Pick", sleep_macro = 500,},
} do
PlayMacro(phase.macro)
exit = interruptable_sleep(phase.sleep_macro)
AbortMacro()
if exit then break end
end
until exit
Sleep(250)
PressAndReleaseKey("scrolllock")
end
end
专为汽车农业游戏中的不同地点而设计