Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-18-18, 09:28 AM   #1
Seethe
A Defias Bandit
Join Date: Mar 2018
Posts: 2
Character Stats not loading on PLAYER_LOGIN

Hello, I am new and noob to WoW addons development.
As an exercise I am trying to do a little panel with player stats in it, but actually I am failing to do so
With the following code, when I enter into the game my stat is 0.000.
Any help? Thanks in advance!

Lua Code:
  1. function round(number, decimals)
  2.         return (("%%.%df"):format(decimals)):format(number)
  3.     end
  4.  
  5.     local crit = round(GetCritChance(), 3)
  6.  
  7.     local c = CreateFrame("Frame", "myframe", UIParent)
  8.  
  9.     c:SetWidth(400)
  10.     c:SetHeight(200)
  11.     c:SetPoint("TOP", UIParent, "CENTER")
  12.     c:SetFrameStrata("MEDIUM")
  13.  
  14.     c.tex = c:CreateTexture()
  15.     c.tex:SetAllPoints(c)
  16.     c.tex:SetColorTexture( unpack(cfg.color))
  17.  
  18.     c.text = c:CreateFontString(nil,"ARTWORK","GameFontNormal")
  19.     c.text:SetPoint("TOPLEFT",8,-10)
  20.     c.text:SetTextColor(classColor.r, classColor.g, classColor.b)
  21.  
  22.     c:RegisterEvent("PLAYER_LOGIN")
  23.  
  24.     c:SetScript("OnEvent", function()
  25.        c.text:SetText( "Crit: " .. crit )
  26.     end)

Last edited by Seethe : 03-18-18 at 09:30 AM.
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Character Stats not loading on PLAYER_LOGIN


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off