||05-08-20 01:37 AM
Guideline for turning lua code into addon?
Long ago, I found a post on here giving steps to turn any bit of lua code into an addon. I recently found a weakaura that reports token price, and I'd much rather have it as an addon. Unfortunately, my disk drive ate itself back in February, and I had to create a whole new machine, and lost my bookmarks. Could someone point me to this post?
I'm sure I'll have more questions then. I'm currently planning on snitching code from other addons to give it a frame and make it moveable. I don't code well, but I can copy-paste! (assuming I can figure out the effective code snippets)
Then I'll just have to make it *actually* update on price change. *sigh*
||05-08-20 02:09 AM
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.
-- Function to display the price
local function UpdateTokenPrice(self)
local Price = C_WowTokenPublic.GetCurrentMarketPrice()
if not Price then
self.Text:SetText("|TInterface/ICONS/Wow_Token01:0:0:2:0|t "..GetMoneyString(Price, true))
-- Create a Frame and make it dragable
local CurrencyFrame = CreateFrame("Button", "BarleduqCurrencyFrame", UIParent)
CurrencyFrame:SetPoint("TOP", 0, -4)
CurrencyFrame:SetMovable(true) -- Create frame before PLAYER_LOGIN to save position
CurrencyFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
CurrencyFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
-- Create a Fontstring to display the current price
CurrencyFrame.Text = CurrencyFrame:CreateFontString("$parentText", "OVERLAY")
-- register the token change event
-- Script to update the price when it changes
CurrencyFrame:SetScript("OnEvent", function(self, event, ...)
--Display the price on startup (the event might not fire for minutes/hours/days...)
|All times are GMT -6. The time now is 01:51 AM.
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI