09-30-20, 08:58 PM | #1 |
Lua Help for New Coder
I am having issues having a list displayed in a frame with general character information, ie armor pen, dodge, parry, etc. I can have one thing show but I am unable to get the second item to show up. below is the current code. Any help would be great thanks.
Code:
------------------------------------------------------- -- Main Addon Stuff -- ------------------------------------------------------- local AshStats = CreateFrame("frame", "AshStatsFrame") AshStats:SetBackdrop({ bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", tile=1, tileSize=32, edgeSize=32, insets={left=11, right=12, top=12, bottom=11} }) AshStats:SetWidth(170) AshStats:SetHeight(400) AshStats:SetPoint("CENTER",UIParent) AshStats:EnableMouse(true) AshStats:SetMovable(true) AshStats:RegisterForDrag("LeftButton") AshStats:SetScript("OnDragStart", function(self) self:StartMoving() end) AshStats:SetScript("OnDragStart", function(self) self:StartMoving() end) AshStats:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) AshStats:SetFrameStrata("FULLSCREEN_DIALOG") AshStats:RegisterEvent("PLAYER_ENTERING_WORLD"); local function eventHandler(self, event, ...) --print("Hello World! Hello " .. event); end AshStats:SetScript("OnEvent", eventHandler); -------------------------------------------------------------- --Framerate -------------------------------------------------------- local fpsframe = CreateFrame("Frame", nil, AshStats) fpsframe:SetFrameStrata("BACKGROUND") fpsframe:SetWidth(50) fpsframe:SetHeight(30) fpsframe:SetPoint("TOPLEFT", AshStats, "TOPLEFT", 20, -30) fpsframe:Show() fpsframe:RegisterEvent("ZONE_CHANGED") fpsframe:RegisterEvent("ZONE_CHANGED_INDOORS") fpsframe:RegisterEvent("ZONE_CHANGED_NEW_AREA") local fpsframeFS = fpsframe:CreateFontString("FontString","OVERLAY","GameTooltipText") fpsframeFS:SetPoint("TOPLEFT",fpsframe,"TOPLEFT",0,0) fpsframeFS:SetFont("Fonts\\FRIZQT__.TTF", 10, "THINOUTLINE") local elapsed = 0 fpsframe:SetScript("OnUpdate", function(self, e) elapsed = elapsed + e if elapsed >= 1 then fpsframeRefresh() elapsed = 0 end end) fpsframe:SetScript("OnEvent", function() fpsframeFS:SetTextColor(1, 1, 1); fpsframeRefresh() end) function fpsframeRefresh() local framerate = GetFramerate() fpsframeFS:SetFormattedText("Frame Rate - " .. "%.0f", framerate) end ----------------------------------------------------- local armframe = CreateFrame("Frame", nil, AshStats) armframe:SetFrameStrata("BACKGROUND") armframe:SetWidth(50) armframe:SetHeight(30) armframe:SetPoint("TOPLEFT", AshStats, "TOPLEFT", 20, -40) armframe:Show() armframe:RegisterEvent("ZONE_CHANGED") armframe:RegisterEvent("ZONE_CHANGED_INDOORS") armframe:RegisterEvent("ZONE_CHANGED_NEW_AREA") local armframeFS = armframe:CreateFontString("FontString","OVERLAY","GameTooltipText") armframeFS:SetPoint("TOPLEFT",armframe,"TOPLEFT",0,0) armframeFS:SetFont("Fonts\\FRIZQT__.TTF", 10, "THINOUTLINE") function armframeRefresh() local armorPen = GetArmorPenetration() --armframeFS:SetFormattedText("Armor Pen - " .. , armorPen) print armorPen end |
|
10-01-20, 12:29 AM | #2 |
You can just have one frame that hosts several Fontstrings and updates them as required (OnEvent, OnUpdate, or both) eg:
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
WoWInterface » Developer Discussions » Lua/XML Help » Lua Help for New Coder |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|