So I thought I'd try to add some functionality to it to allow myself to auto-hide (as a rogue) when leaving combat, and to be able to turn that function on and off.
So I have the following code. The speed part still works properly. The part for enabling and disabling autohide, it recognizes the keypress but the onLeaveCombat section doesn't seem to run, even with no conditions put on it (you can see I commented out the condition check) it doesn't even do a print during the onLeaveCombat. Here's my code:
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad><![CDATA[
autoHide = false
for k,v in pairs(settings.profile.skills) do
v.AutoUse = false
yrest(50)
end
function settings.profile.events.onLeaveCombat()
print("AutoHiding ")
--if autoHide == true then
yrest(500)
sendMacro("/cast Hide")
cprintf(cli.red, "Auto Hiding after Combat!!!\n")
--end
end
--============= Function to show button controls ===================
function SKM_ShowButtons()
cprintf(cli.green, "SPACEBAR - - > Set Speed.\n")
cprintf(cli.green, "VK_HOME - - > Disable Autohide.\n")
cprintf(cli.green, "VK_INSERT - - > Enable Autohide.\n")
end
--============= main routine starting: =====================
local delay = 1 -- time between key presses.
local time = os.time()
SKM_ShowButtons();
while(true) do
--================== Enable speed() ======================
if keyPressed(key.VK_SPACE) and (os.time() - time > delay ) then
speed()
cprintf(cli.yellow, "HIGH SPEED ENABLEED!!!\n")
SKM_ShowButtons();
time = os.time()
end
--================== Enable Auto Hide after leaving combat =============
if keyPressed(key.VK_INSERT) and (os.time() - time > delay ) then
autoHide = true
cprintf(cli.yellow, "Auto Hide ENABLEED!!!\n")
SKM_ShowButtons();
time = os.time()
end
--================== Disable Auto Hide after leaving combat =============
if keyPressed(key.VK_HOME) and (os.time() - time > delay ) then
autoHide = false
cprintf(cli.yellow, "Auto Hide disabled!!!\n")
SKM_ShowButtons();
time = os.time()
end
yrest(10)
end
]]></onLoad>
</waypoints>