View Single Post
05-08-20, 02:09 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
This website allows you to paste some of your code and create a downloadable .zip addon as per sites like WoWI.

Change the Title from "My First Addon" to a unique name as that will be the name of the addon/folder.

Limits, it's a single .lua file and sadly they have remove the advanced .toc options button(s).

I hope that's close enough to what you are asking about (it gives you the basic folder name with corresponding .toc name and source file that makes up the core of an addon).

Something basic to paste to display/update on change the token price at the top/center of your screen initially.

Lua Code:
  1. -- Function to display the price
  2. local function UpdateTokenPrice(self)
  3.     local Price = C_WowTokenPublic.GetCurrentMarketPrice()
  4.     if not Price then
  5.         self.Text:SetText("N/A")
  6.         return
  7.     end
  8.     self.Text:SetText("|TInterface/ICONS/Wow_Token01:0:0:2:0|t "..GetMoneyString(Price, true))
  9.     self:SetSize(self.Text:GetSize())
  10. end
  11. -- Create a Frame and make it dragable
  12. local CurrencyFrame = CreateFrame("Button", "BarleduqCurrencyFrame", UIParent)
  13. CurrencyFrame:SetSize(14, 14)
  14. CurrencyFrame:SetPoint("TOP", 0, -4)
  15. CurrencyFrame:SetFrameStrata("DIALOG")
  16. CurrencyFrame:EnableMouse(true)
  17. CurrencyFrame:RegisterForDrag("LeftButton")
  18. CurrencyFrame:SetMovable(true) -- Create frame before PLAYER_LOGIN to save position
  19. CurrencyFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
  20. CurrencyFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  21. -- Create a Fontstring to display the current price
  22. CurrencyFrame.Text = CurrencyFrame:CreateFontString("$parentText", "OVERLAY")
  23. CurrencyFrame.Text:SetFont("Fonts/FRIZQT__.TTF", 21)
  24. CurrencyFrame.Text:SetPoint("CENTER")
  25. CurrencyFrame.Text:SetJustifyH("CENTER")
  26. -- register the token change event
  27. CurrencyFrame:RegisterEvent("TOKEN_MARKET_PRICE_UPDATED")
  28. -- Script to update the price when it changes
  29. CurrencyFrame:SetScript("OnEvent", function(self, event, ...)
  30.     UpdateTokenPrice(self)
  31. end)
  32. --Display the price on startup (the event might not fire for minutes/hours/days...)
  33. UpdateTokenPrice(CurrencyFrame)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-08-20 at 03:25 AM.
  Reply With Quote