Context Menu
Description
Shows coords given in table format {x,y} (then it will appear on $posz) or {x,y,z} as tiles on screen. Script is based on Raphael's Show Waypoints HUD. This HUD can be helpful during aoe actions debugging.
Configuration
Edit the tileColor, tiles variables after init block to specify color and tiles.
Code
init start
-- local SCRIPT_VERSION = '1.0.0'
local xOffset, yOffset, worldWidth, worldHeight, x, y, z, topLeftTilePos,
botRightTilePos, width, height, text, label
local waypointRect = {}
function gettilepos(x, y, z)
local tile = getobjectarea(x, y, z)
if tile == nil then
local xDiff, yDiff = x - $posx, y - $posy
if math.abs($posx - x) <= 7 then
tile = getobjectarea(x, $posy, $posz)
xDiff = 0
elseif math.abs($posy - y) <= 5 then
tile = getobjectarea($posx, y, $posz)
yDiff = 0
else
tile = getobjectarea($posx, $posy, $posz)
end
-- Some strange stuff happens when you go from 0 to -1, so I'm
-- adding this as a precaution.
if tile ~= nil then
local width, height = $worldwin.width, $worldwin.height
tile.left = tile.left + (width * xDiff)
tile.right = tile.right + (width * xDiff)
tile.centerx = tile.centerx + (width * xDiff)
tile.top = tile.top + (height * yDiff)
tile.bottom = tile.bottom + (height * yDiff)
tile.centery = tile.centery + (height * yDiff)
end
end
return tile
end
useworldhud()
init end
-- ********************* SETUP ********************* --
local tileColor = 0xAAF200
local tiles = {{32342, 32223, 7}, {32347, 32225, 7}}
-- ********************* DONT CHANGE ANYTHING BELOW ********************* --
setfontstyle('Tahoma', 7, 75, 0xFFFFFF, 1, 0x000000)
xOffset, yOffset = $worldwin.left - $clientwin.left, $worldwin.top - $clientwin.top
worldWidth, worldHeight = $worldwin.right - $worldwin.left - 2, $worldwin.bottom - $worldwin.top - 2
for j = 1, #tiles do
x, y, z = tonumber(tiles[j][1]), tonumber(tiles[j][2]), tonumber(tiles[j][3]) or $posz
if z == $posz then
tilePos = gettilepos(x, y, z)
if tilePos then
waypointRect.left = math.max(tilePos.left , 0)
waypointRect.top = math.max(tilePos.top , 0)
waypointRect.right = math.min(tilePos.right , worldWidth)
waypointRect.bottom = math.min(tilePos.bottom, worldHeight)
waypointRect.width = waypointRect.right - waypointRect.left
waypointRect.height = waypointRect.bottom - waypointRect.top
if waypointRect.width > 0 and waypointRect.height > 0 then
setfillstyle('color', (tileColor or 0) + (math.floor(2.55*50)*16777216))
drawroundrect(
waypointRect.left,
waypointRect.top,
waypointRect.width,
waypointRect.height,
10, 10
)
end
end
end
end