Thread Tools Display Modes
05-05-07, 11:54 AM   #1
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
Here's what I have so far

I started learing LUA and XML, and now I'm trying to make a little addon that will show my durability next a little anvil like DurabilityFu does.

This is the XML I have so Far.

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/ 
..\..\FrameXML\UI.xsd">
<Frame name="DurabilityMeter" toplevel="true" parent="UIParent" movable="true" 
            hidden="false">
<Size x="200" y="200"/>
<Anchors>
 <Anchor point="CENTER" relativeto="UIPARENT" relativepoint="CENTER">
  <Offset x="100" y="100"/>
 </Anchor>
</Anchors>
Questions:
1. So far have I done anything wrong?
2. I wan't to make the frame movable, did I already do that by having movable="true" in there?
3. To have a graphic, do I have to have something in the XML?
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
05-05-07, 12:31 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
1. I've been using WoW UI Designer to make my frame in the little addon I have in my UI comp. But in my .xml file it says:
Code:
    <Size>
      <AbsDimension x="350" y="400" />
    </Size>
I don't know what the difference is between the two - it probably works both ways. :P

2. not quite - http://www.wowwiki.com/HOWTO:_Make_a_Frame_Draggable

3. You might....

I know I'm not much help on 1 & 3, but I do know how to do #2
__________________
"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
05-05-07, 01:19 PM   #3
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
So the code should look like 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/ 
..\..\FrameXML\UI.xsd">
<Frame name="DurabilityMeter" toplevel="true" parent="UIParent">
<Size x="200" y="200"/>
<Anchors>
 <Anchor point="CENTER" relativeto="UIPARENT" relativepoint="CENTER">
  <Offset x="100" y="100"/>
 </Anchor>
</Anchors>
<Scripts>
<OnLoad>
 this:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
 this:StartMoving();
 this.isMoving = true;
</OnDragStart>
<OnDragStop>
 this:StopMovingOrSizing();
 this.isMoving = false;
</OnDragStop>
</Scripts>
right?
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
05-05-07, 03:24 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I think you missed this first sentence from the wiki page.

First, the XML tags movable="true" and enableMouse="true" must be in the frames declaration.
__________________
"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
05-05-07, 03:57 PM   #5
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
:P

oops
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
05-05-07, 04:05 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Make sure you have closing </Frame> and </Ui> tags at the end.

In there before the Scripts section, you need to add specific layers for your icon and text:
Code:
		<Layers>
			<Layer level="ARTWORK">
				<Texture name="DurabilityMeter_Icon" file="Interface\Icons\Trade_BlackSmith" alphaMode="BLEND">
					<Anchors>
						<Anchor point="LEFT" relativePoint="LEFT"/>
					</Anchors>
					<Size x="64" y="64"/>
				</Texture>
				<FontString name="DurabilityMeter_Text" inherits="GameFontNormal" text="">
					<Anchors>
						<Anchor point="LEFT" relativePoint="LEFT">
							<Offset x="64"/>
						</Anchor>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
Unless you want to blow up the icon and text to gargantuan proportions, 200x200 is probably a bit big for the frame, especially since it's going to be mouse-aware. You'll probably also want to scale down the icon from its default 64x64 size.

Then in your Lua you'll use DurabilityMeter_Text:SetText(text), where text is your current durability text. I'd recommend taking a look at FuBar_DuraTek instead of DurabilityFu for example Lua code... DuraTek is about the tenth of the size, and very basic, without all the fancy extras of DurabilityFu.

Also, proper indentaion will make your code easier to read.
  Reply With Quote
05-05-07, 04:13 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Phanx
Also, proper indentaion will make your code easier to read.
quote for proper truthfulnessliness

yay! Phanx saved me from being the only one helping Dread! He was gonna be doomed.
__________________
"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
05-05-07, 10:14 PM   #8
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
thanks phanx
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
05-15-07, 06:19 AM   #9
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
agg why do people still use "this"

If you're still reading this thread, please change your "this" to "self" as "this" is a global where "self" is a local, making "this" evil, slow, and deprecated. On top of that, it will be removed in the future.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
05-15-07, 09:30 AM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Because we're noobs. Thanks for enlightening, Shirik.
__________________
"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
05-15-07, 10:26 AM   #11
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Every time someone uses a global "this," "event," or "arg1," god kills a kitten. Think of all the poor kittens
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
05-15-07, 11:41 AM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
kitty!!!!!
Attached Thumbnails
Click image for larger version

Name:	1168705855-hugbear.b.jpg
Views:	644
Size:	39.0 KB
ID:	1155  
__________________
"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
05-15-07, 02:35 PM   #13
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
I don't believe in God, so it can't kill kittens.


HA!

I gave up one this also.
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Here's what I have so far


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