HOTKEY'S
This image is hosted on a possibly dangerous website (http://vpx.pl/i/2013/12/26/Hotkeys_Layout.png). Please consider reuploading it on Imgur.com.
About:
- Allows You to use Hotkey's from Your Tibia Client (Just configure Hotkey in Tibia Client)
- You can move HUD with middle mouse button. Thanks to @sirmate.
Libraries:
- WindBot 1.1.2
- Raphael's Library 0.1.2
- Lucas Terra's Library 12.7
Version and Changelog:
- v1.0 - 26/12/2013 - stable version.
Code:
---- Init ----init start
-- Buttons
local ButtonsFunction = {
{text = "F1", id = -1, action = function() keyevent(0x70) end},
{text = "F2", id = -1, action = function() keyevent(0x71) end},
{text = "F3", id = -1, action = function() keyevent(0x72) end},
{text = "F4", id = -1, action = function() keyevent(0x73) end},
{text = "F5", id = -1, action = function() keyevent(0x74) end},
{text = "F6", id = -1, action = function() keyevent(0x75) end},
{text = "F7", id = -1, action = function() keyevent(0x76) end},
{text = "F8", id = -1, action = function() keyevent(0x77) end},
{text = "F9", id = -1, action = function() keyevent(0x78) end},
{text = "F10", id = -1, action = function() keyevent(0x79) end},
{text = "F11", id = -1, action = function() keyevent(0x7A) end},
{text = "F12", id = -1, action = function() keyevent(0x7B) end}
}
-- Locale
local lastPressed = {id = -1, time = $timems}
local rectHeight, rectWidth = 200, 140
setposition($clientwin.left, $clientwin.bottom)
-- Moving window
filterinput(false, true, false, false)
local Moving, Temp, Moved = false, {0, 0}, {0, 0}
function inputevents(e)
if (e.type == IEVENT_LMOUSEDOWN) then
for _, button in ipairs(ButtonsFunction) do
if (e.elementid == button.id) then
lastPressed = {id = button.id, time = $timems}
button.action()
end
end
end
if (e.type == IEVENT_MMOUSEDOWN) then
Moving, Temp = true, {$cursor.x - Moved[1], $cursor.y - Moved[2]}
end
if (e.type == IEVENT_MMOUSEUP) then
Moving = false
if math.abs(Moved[1]) <= 15 then
Moved[1] = 0
end
if math.abs(Moved[2]) <= 15 then
Moved[2] = 0
elseif math.abs(($worldwin.bottom-20) - Moved[2]) <= 15 then
Moved[2] = $worldwin.bottom-20
end
end
end
init end
if (Moving) then
auto(10)
Moved = {$cursor.x - Temp[1], $cursor.y - Temp[2]}
end
setposition($clientwin.left+130 + Moved[1], $clientwin.bottom - 139 + Moved[2])
---- Engine ----
-- Button layout
setfontsize(9)
spacing = 0
for i = 1, #ButtonsFunction do
setfillstyle('gradient', 'linear', 2, 0, 0, 0, 19)
if ButtonsFunction then
if ButtonsFunction[i].id ~= lastPressed.id then
addgradcolors(0.1, color(112, 142, 149), 1.0, color(44, 68, 74))
else
addgradcolors( 0.1,color(44, 68, 74), 1.0,color(112, 142, 149))
end
ButtonsFunction[i].id = drawroundrect(5+ spacing, 5 , 35, 20, 2)
local w,h = measurestring(ButtonsFunction[i].text)
drawtext(ButtonsFunction[i].text, (rectWidth/6) - (w/1.8) + spacing, 12 - (h/6))
end
if i == 4 or i == 8 then
spacing = spacing + 57
else
spacing = spacing + 42
end
end
-- clickable action
if $timems - lastPressed.time > 100 then
lastPressed.id = -1
end