Thread Tools Display Modes
11-14-05, 11:59 AM   #1
Rapture
A Murloc Raider
Join Date: Nov 2005
Posts: 8
Calling Functions in XML Files

Hello,

I've begun working on an AddOn based off of StunWatch for Warlock spells and I'm in the process of working on the XML file for it. I've got a couple questions about calling functions and also about Positions/Offsets.

I am making 3 sets of bars (DoTs, Curses, and Misc) and for each set there are X amount of bars. When I looked at StunWatch's XML file, the code for each bar was something like:

Code:
<Frame name="StunWatchBar1" parent="StunWatch" inherits="StunWatchBarTemplate">
	<Anchors>
		<Anchor point="TOPLEFT">
			<Offset>
				<AbsDimension x="0" y="-80" />
			</Offset>
		</Anchor>
	</Anchors>
	<Scripts>
		<OnShow>
			StunWatchBar1_OnShow()
		</OnShow>
	</Scripts>
</Frame>
So I basically copied this and modified it like so:

Code:
<Frame name="DoT_Bar1" parent="SpellTimer" inherits="SpellTimerBarTemplate">
	<Anchors>
		<Anchor point="TOPLEFT">
			<Offset>
				<AbsDimension x="0" y="-220" />
			</Offset>
		</Anchor>
	</Anchors>
	<Scripts>
		<OnShow>
			DoT_Bar1_OnShow()
		</OnShow>
	</Scripts>
</Frame>
Let's say I have 12 DoT bars, is there a way to use a function for the OnShow event that has an arguement? I'm trying to minimize repetition of code so I'm wanting to do something like:

Code:
<OnShow>
	DoT_Bar_OnShow(X)
</OnShow>
Where X is the bar I'm triggering. Is this possible?

Also, I'm wanting to make a background border for each set of bars (to help keep them organized). So will I need to create 3 bar templates and anchor the corresponding bar to that template? Or is there a way to create a background frame (similar to Necrosis's Spell Timer background) for each set?

Finally, in relation to offsets, are they based off of the current position of the parent frame or is it based off of the X/Y point on the screen?

Thanx in advance,
Rapture

Edit: Notice I posted this in the wrong section. Sorry about that.

Last edited by Rapture : 11-14-05 at 12:09 PM.
  Reply With Quote
11-14-05, 12:48 PM   #2
Rapture
A Murloc Raider
Join Date: Nov 2005
Posts: 8
Hello again,

Have another question about Frames. I am basically doing this:

Creating a background with a title bar (togglable) and inside this background I have my bars:


So I'm wondering if I should make the background and then have the bars as frames within the background. If I do that and hide the background frame, will it also hide the bars? Or should I just create each frame seperately?

Thanx.
  Reply With Quote
11-14-05, 02:52 PM   #3
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
everything seems good with your code. Yes you can define a single function, and just pass the function a variable within your xml. So essentially you can easily call DotBar_OnShow(1); and have it pass the number to the function. This is of course assuming your function is set up to handle the argument, which I am sure it is since you are asking about it in the first place
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Calling Functions in XML Files


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