Thread Tools Display Modes
09-17-07, 05:40 AM   #1
ganders
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: May 2007
Posts: 131
getglobal and SetText functions

Hello, I'm pretty new to writing AddOns so I'm hoping someone might be able to help me. I'm trying to make some text appear at the top of my minimap that tells me the zone I'm in, and colors depending if I'm in friendly(green), neutral(yellow), or hostile(red) territory. The reason I'm trying to do this is because somewhere in MazzleUI it hides the minimap text and I want to make it myself. Anyway, what I need to know is this:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Frame name="MinimapTextFrame" parent="UIParent" hidden="false" movable="false">
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parent_ZoneText" inherits="GameFontNormal" text="?????">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="Minimap" relativePoint="TOPLEFT">
<Offset x="?" y="?"/>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
</Ui>
This is my XML script. I have question marks in the text for <FontString> because I don't know what to put there. I can't put a variable there, so I figured I'd have to set the text in the .lua file. In the WoW UI Designer it set the text of the label like this

label = getglobal("TutorialProjectForm".."CountLabel".."Label")
label:SetText("......")

So, my first question is, how would I use the getglobal function to assign my <FontString> text to a variable then change the text using SetText()?

My second question is how would I then set the color of it? I'm especially clueless when it comes to the colors, like r=0.5, etc. Hopefully someone with more experience could help me out.

Also if there's a list of all the Lua functions and what they do somewhere, a link would be greatly appreciated.

Thanks in advance.
  Reply With Quote
09-17-07, 06:06 AM   #2
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by ganders
Also if there's a list of all the Lua functions and what they do somewhere, a link would be greatly appreciated.
WoWWiki is what I use.

as to the other questions I would advise looking at other mods and seeing what makes them tick.
  Reply With Quote
09-17-07, 08:11 AM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You could either look at or use LocationFu.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » getglobal and SetText functions


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