Thread Tools Display Modes
04-27-13, 03:05 PM   #1
DJMcCarthy12
A Kobold Labourer
Join Date: Apr 2013
Posts: 1
New to Creating Addons

Hey guys, I'm new to creating addons, but I've done some reading and I'm pretty sure I'm ready to go (I have other programming experience) - I just have one question.

How do I access preexisting information about a character in-game? i.e. the player level, class, health, item level, etc. - is this type of information stored in global variables somewhere?

Thanks in advance!

DJ
  Reply With Quote
04-27-13, 03:12 PM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
UnitLevel("player")
UnitClass("player")
UnitHealth("player")
GetAverageItemLevel()

You can find many of these here, for example. As you learn to make addons you'll remember the most common ones; others you can just look for in the relevant categories.
  Reply With Quote
04-27-13, 08:00 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I find the single-page list of global functions to be much easier to use than browsing categories. If I want to find the function that tells me a unit's name, for example, I don't have to think about which category that's probably in; I can just use my browser's find-in-page feature to search for "name".
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
04-27-13, 09:36 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Well, it's probably going to be in the "Unit functions" category. You can still use your browser's find feature on the categorized list. A categorized list is a whole lot less daunting for a beginner.
__________________
"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
04-28-13, 06:14 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
True, but it's not always obvious which category the function you want belongs to, and the global list is helpful for finding out if there even is a function for what you want.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
04-28-13, 12:21 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Again, you can still use Ctrl-F on the category list page. All the categories are listed on one page, after all, they're just organized. Then, if you find what you're looking for, you can see at a glance all the other related functions.
__________________
"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
04-29-13, 01:09 PM   #7
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Also keep in mind that all the available WoW API documentation is not officially supported by Blizzard but rather community driven. Thus information is not always up-to-date or accurate. What you can do is use the /dump command in-game to find out if the number or order of return values has changed or/and call the function wrongly with activated lua errors to get a short usage description.
  Reply With Quote
04-29-13, 02:13 PM   #8
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
You can also use EventTracker to glean information about undocumented Events. I found editing EventTracker_events.lua more effective than the slash commands, but your results may vary.
  Reply With Quote
04-29-13, 02:56 PM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
You can also use EventTracker to glean information about undocumented Events. I found editing EventTracker_events.lua more effective than the slash commands, but your results may vary.
This addon seems just like the blizzard built in "/eventtrace" command one.
  Reply With Quote
04-29-13, 04:06 PM   #10
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
It is; however, it is easier to read the results. Just my opinion, of course!
  Reply With Quote
04-29-13, 04:19 PM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
It is; however, it is easier to read the results. Just my opinion, of course!
Well, if you're a rookie you pretty much know all the events what you gonna need. JK just use CLEU.
  Reply With Quote
04-29-13, 07:34 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Rainrider View Post
What you can do is use the /dump command in-game to find out if the number or order of return values has changed or/and call the function wrongly with activated lua errors to get a short usage description.
It might be easier to look at the Blizzard UI code, so you can see how the values are actually used, as it's not always clear what a long list of true/false or number values actually mean.

You can look at it online, or extract a local copy from your installed game client.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » New to Creating Addons


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