Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
757
minimap pos #99
Adds coords to minimap, allows you to copy mouse cursor tile location to clipboard using a hotkey.
867b | 34 lines.
local minimap = modules.game_minimap.minimapWidget
local label = minimap.coords
label = label or g_ui.loadUIFromString([[
Label
  id: coords
  color: white
  font: verdana-11px-rounded
  anchors.left: parent.left
  anchors.right: parent.right
  anchors.bottom: parent.bottom
  text-align: center
  margin-right: 3
  margin-left: 3
  text:
]], minimap)

onPlayerPositionChange(function(newPos, oldPos)
  if label and newPos then
    label:setText(newPos.x ..', '..newPos.y..', '..newPos.z)
    label:setColor("white")
  end
end)

singlehotkey("F3", "Get Tile Pos", function()
  local tile = getTileUnderCursor()
  if tile then
    local tilePos = ''
    local tmp = tile:getPosition()
    tilePos =  tmp.x ..', '..tmp.y..', '..tmp.z
    label:setText(tilePos)
    label:setColor("red")
    g_window.setClipboardText(tilePos)
  end
end)

12 Jun 2022
Ads