Quantcast [Classic]LF help with LUA - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-16-19, 05:04 AM   #1
sh4dowburn
A Defias Bandit
Join Date: Oct 2019
Posts: 2
Question [Classic]LF help with LUA

Hi everyone!

I'm trying to write my first AddOn about showing my total money and latency in game,
But I notice that the total amount and latency only updated after input "/reload" in game now,

here is my code,
Code:
local m = CreateFrame("Frame", nil, UIParent);
      m:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -88, 6);
      m:SetWidth(80);
      m:SetHeight(10);
      m:RegisterEvent("PLAYER_MONEY");
      m:RegisterEvent("PLAYER_ENTERING_WORLD");

local Getmoney = GetMoney();
      money = m:CreateFontString(Getmoney, nil, nil);
      money:SetAllPoints(m);
      money:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE");
      money:SetJustifyH("LEFT");
      money:SetTextColor( 1, 1, 1 );
      money:SetFormattedText(("%d|cffFFD700g|r ".." %d|cffB5B5B5s|r ".." %d|cffCD853Fc|r"):format(Getmoney /10000, (Getmoney / 100) % 100, Getmoney % 100));
Code:
local bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats();

  local l = CreateFrame("Frame", nil, UIParent)
        l:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -21, 6)
        l:SetWidth(80)
        l:SetHeight(10)
        l:RegisterEvent("PLAYER_ENTERING_WORLD")

        latency = l:CreateFontString(latency, nil, nil)
        latency:SetAllPoints(l)
        latency:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE")

        --latency:SetShadowOffset(1, -1)
        --latency:SetShadowColor(0, 0, 0, 1)

        latency:SetJustifyH("RIGHT")
        latency:SetTextColor( 1, 1, 1 )
        latency:SetFormattedText(latencyHome.."/"..latencyWorld.."|cff87CEEB ms")
I'm new to Lua, learn all above codes from wowwiki and blizz source codes.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » [Classic]LF help with LUA

Thread Tools
Display Modes

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