
Originally Posted by
tjucken
Thanks alot mate, i hope i can redo some favour for you sometime!
Never made hotkeys script before, so i was looking at the example at Update thread.
The main thing we care is that it works well.
That hotkeys thing looks well for manualy playin.
Enjoy your code. :P
Code:
local spells = {"Utori Bomb Vis", "Utori Bomb Flam", "Exevo Vort Lux", "Exori Pyro"}
local runeid = 3154
local dist = 7
for name, value in pairs(Hotkeys) do
if (type(value) == "number") then
if (not Hotkeys.Register(value)) then
print("Failed to register hotkey %d", value)
end
end
end
local spellsOnUse = function()
local creature = Creature.GetByID(Self.TargetID())
local i = 1
while (creature:isValid() and creature:isAlive() and (creature:DistanceFromSelf() <= dist) and creature:isTarget()) do
Self.Cast(spells[i])
Self.UseItemWithTarget(runeid)
i = i + 1
wait(2010)
if (i > 4) then i = 1 end
end
end
function pressHandler(key, control, shift)
if key == Hotkeys.F1 then
spellsOnUse()
end
end
function releaseHandler(key, control, shift)
-- not needed i think
end
Hotkeys.AddPressHandler(pressHandler)
Hotkeys.AddPressHandler(releaseHandler)
Hotkeys.AddPressHandler(function(key)
if (key == Hotkeys.DELETE) then
for i = 1, 255 do
UnRegisterHotkey(i)
end
end
end)