Thread Tools Display Modes
11-07-08, 09:18 PM   #1
Abbi
A Kobold Labourer
 
Abbi's Avatar
Join Date: Oct 2008
Posts: 1
Very simple add on

Alright, before you say to use google, I've already tried and it helps none.

All I want to do is when I click on a target, some text on my add-on frame displays, say, the health. I know for a fact you can do this, but I don't know how. I've had previous coding experience, but frankly the UI Designer is a piece of crap and I can't find any decent tutorials on how to code it directly...

I think I'm looking for something along the lines of:

If Target(target) {
label.display(target_health)
}

Or something to that effect.
  Reply With Quote
11-07-08, 09:33 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Ah ... well ... I guess it would be a lot easier to write down the complete code instead teaching you some lessons ... but I can't do that. ;D

This comprises of three parts:

1. Some method to hook into the "hey the player has clicked a target ... we need some action" machanism.
This "mechanism" is named Event.
A very good event for this could be PLAYER_TARGET_CHANGED.
A good start point with handling events could be this page.

2. Get the value to show
If the value is the targets health this is very simple: UnitHealth("target")
For all other possible values it is as simple as with the units health. Just see the Unit Functions.

3. A way to show the value via your addon. But this should be really simple.

If you need further help I'll will be glad to provide it ...
... at least if you report back with some real code.

Last edited by Duugu : 11-07-08 at 09:35 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Very simple add on


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