Skip to content

Instantly share code, notes, and snippets.

@ericxyan
Last active December 1, 2019 09:28
Show Gist options
  • Save ericxyan/e6502350488f71c2365df3213ebd88b3 to your computer and use it in GitHub Desktop.
Save ericxyan/e6502350488f71c2365df3213ebd88b3 to your computer and use it in GitHub Desktop.
Left_Btn = 1
Mouse_M = 2
Right_Btn = 3
Mouse_G9 = 9
Mouse_LB = 5
Mouse_RB = 4
Skills_wall = {
{"1", 4, 0, Mouse_M},
{"2", 7.5, 0, Mouse_M},
{"3", 0.5, 0, Mouse_LB},
{"4", 100, 0, Mouse_RB}
}
Skills_thief = {
{"1", 4, 0, Mouse_M},
{"2", 7.5, 0, Mouse_LB},
-- {"3", 0.5, 0, Mouse_RB},
{"4", 0.5, 0, Mouse_M}
}
Skills = {
-- {"1", 4, 0, Mouse_M},
{"2", 7, 0, Mouse_M},
{"3", 0.5, 0, Mouse_LB},
{"4", 110, 0, Mouse_RB}
}
-- LoopInterval = 400
SkillDelay = 50
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %s\n", event, arg)
if (event == "MOUSE_BUTTON_RELEASED" and arg == Mouse_G9) then
skill_count = 0
for i,v in ipairs(Skills) do
Skill = Skills[i]
PressAndReleaseKey(Skill[1])
Skill[3] = Skill[3] + 1
skill_count = skill_count + 1
Sleep(SkillDelay)
end
LoopInterval = skill_count * SkillDelay
OutputLogMessage("LoopIntervalReset skill %d", LoopInterval)
while (IsKeyLockOn("scrolllock")) do
-- Skill
for i,v in ipairs(Skills) do
Skill = Skills[i]
if(IsMouseButtonPressed(Skill[4])) then
OutputLogMessage("Reset skill %s", Skill[1])
PressAndReleaseKey(Skill[1])
Skill[3] = 1
end
modulo = (Skill[3] * LoopInterval) % (Skill[2] * 1000)
if ( modulo < LoopInterval) then
PressAndReleaseKey(Skill[1])
Skill[3] = 1
end
Skill[3] = Skill[3] + 1
Sleep(SkillDelay)
end
-- Left Alt
if (IsModifierPressed("shift")) then
if not (Alt_Pressed) then
ReleaseMouseButton(Right_Btn)
PressMouseButton(Left_Btn)
OutputLogMessage("Release Right_Btn\n")
Alt_Pressed = true
end
else
if (Alt_Pressed) then
ReleaseMouseButton(Left_Btn)
PressMouseButton(Right_Btn)
OutputLogMessage("Press Right_Btn\n")
Alt_Pressed = false
elseif not (IsMouseButtonPressed(Right_Btn)) then
ReleaseMouseButton(Left_Btn)
PressMouseButton(Right_Btn)
OutputLogMessage("Press Right_Btn\n")
end
end
end
ReleaseMouseButton(Right_Btn)
OutputLogMessage("Release Right_Btn\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment