WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   [AddonHelp] adding a waypoint in TomTom (https://www.wowinterface.com/forums/showthread.php?t=56287)

saxitoxin 06-14-18 02:09 PM

[AddonHelp] adding a waypoint in TomTom
 
How do i add a waypoint in TomTom from inside a addon

in the TomTom_Waypoints.lua file line 7-8 it says
Code:

--  don't call TomTom:SetWaypoint() or TomTom:ClearWaypoint(), use the public
--  TomTom:AddZWaypoint() and TomTom:RemoveWaypoint() instead.

so i'm trying the following
Lua Code:
  1. local waypoint = "Wintergrasp 50.4 16.4 Vault of Archavon"
  2. if waypoint then
  3.     if IsAddOnLoaded("TomTom") then
  4.         TomTom:AddZWaypoint(waypoint)
  5.     else
  6.         print(waypoint)
  7.     end
  8. end

if someone could help me out that would be very great

Ammako 06-14-18 03:28 PM

TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, callbacks, silent, crazy)

In the hopes of making the meaning of those parameters more obvious:

lua Code:
  1. -- TODO: Make this not suck
  2. function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world, silent)
  3.     local c,z = GetCurrentMapContinent(), GetCurrentMapZone()
  4.  
  5.     if not c or not z or c < 1 then
  6.         --self:Print("Cannot find a valid zone to place the coordinates")
  7.         return
  8.     end
  9.  
  10.     return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, nil, silent)
  11. end
  12.  
  13. function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, callbacks, silent, crazy)
  14.     -- Convert the c,z,x,y tuple to m,f,x,y and pass the work off to AddMFWaypoint()
  15.     local mapId, floor = hbd:GetMapIDFromCZ(c, z)
  16.     if not mapId then
  17.         return
  18.     end
  19.  
  20.     return self:AddMFWaypoint(mapId, floor, x/100, y/100, {
  21.         title = desc,
  22.         persistent = persistent,
  23.         minimap = minimap,
  24.         world = world,
  25.         callbacks = callbacks,
  26.         silent = silent,
  27.         crazy = crazy,
  28.     })
  29. end

saxitoxin 06-14-18 11:57 PM

Quote:

Originally Posted by Ammako (Post 328332)
...

sorry, but I did not figure it out :/

but I made the button a secureActionButton and running a macro onClick

Lua Code:
  1. if InCombatLockdown() then return end
  2.         if activeStepIndex then
  3.             local mountID, itemID, pretext, place, kill, mode, note, chance, raidID, worldBossID, waypoint = unpack(cfg.infoList[activeStepIndex])
  4.             if waypoint then
  5.                 if IsAddOnLoaded("TomTom") then
  6.                 self:SetAttribute("macrotext", "/way "..waypoint)
  7.                 else
  8.                     print(waypoint)
  9.                 end
  10.             end
  11.         end

Ammako 06-15-18 01:30 AM

I'll try and figure it out sometime later. I posted that because your initial usage was incorrect and I was hoping this would help fix it, but I've never actually used that myself.


All times are GMT -6. The time now is 06:01 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI