Reply
 
Thread Tools Display Modes
Old 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
DJMcCarthy12 is offline   Reply With Quote
Old 04-27-13, 03:12 PM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
WoWInterface Super Mod
Featured
Join Date: Sep 2008
Posts: 1,155
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.
Haleth is online now   Reply With Quote
Old 04-27-13, 08:00 PM   #3
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,977
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".
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 04-27-13, 09:36 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,528
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

Seerah is offline   Reply With Quote
Old 04-28-13, 06:14 AM   #5
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,977
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 04-28-13, 12:21 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,528
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

Seerah is offline   Reply With Quote
Old 04-29-13, 01:09 PM   #7
Rainrider
A Rage Talon Dragon Guard
Join Date: Nov 2008
Posts: 314
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.
Rainrider is offline   Reply With Quote
Old 04-29-13, 02:13 PM   #8
myrroddin
Premium Member
 
myrroddin's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 358
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.
myrroddin is offline   Reply With Quote
Old 04-29-13, 02:56 PM   #9
Resike
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 527
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.
Resike is offline   Reply With Quote
Old 04-29-13, 04:06 PM   #10
myrroddin
Premium Member
 
myrroddin's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 358
It is; however, it is easier to read the results. Just my opinion, of course!
myrroddin is offline   Reply With Quote
Old 04-29-13, 04:19 PM   #11
Resike
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 527
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.
Resike is offline   Reply With Quote
Old 04-29-13, 07:34 PM   #12
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,977
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » General Authoring Discussion » New to Creating Addons

Thread Tools
Display Modes

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