Get the Desktop App for Battle.net Now
- All your games in 1 place
- Log in once
- Automatic game updates
Hey guys. I need some help figuring out my current rep with Nomi of the Tillers. His friendship is not on the rep list. What's more, you can only see your current level if you've already done his quest that day. I had a bug where I did not get credit properly, and I had to get a GM to fix it. Now, I'm coming up on the same problem, and I want to track it as I give it.
I KNOW there's got to be a script I can plug in to return the current rep level. Unfortunately, I'm not well versed in script writing enough to get it right. I'm thinking it's somewhere along the lines of GetFactionInfo(), but I can't figure out the correct syntax to get a script to work.
Any help would be greatly appreciated! I can't be the only one interested in this.
Expanded for clarity:
Edit: Forgot a [code] tag.
Edited by Choonster on 1/11/2013 6:14 PM PST
Thank you. This was fantastic.
The first line creates a bunch of local variables and assigns them to the values returned by the GetFriendshipReputation function (which we call with Nomi's factionID as the first and only argument).
The second line uses the string.format function (called here as a method of a string) to replace the placeholder tokens (%s, %d) in a string with the values of some of the variables we created above. The tokens are replaced from left to right with the corresponding arguments (the first token uses the first argument, the second token uses the second argument, etc.).
After the string has been formatted with the data from GetFriendshipReputation, it's passed as the first and only argument to the print function (which writes all of its arguments to the chat frame).
The abbreviated macro version uses underscores for the names of the variables we don't care about to save space (this is common practice when a function returns more values than you need).
Edited by Choonster on 1/11/2013 10:24 PM PST
If you want to learn more about Lua, there are a few resources available.
Programming in Lua is an online book targeted at programmers learning Lua and was written for Lua 5.0 (not 5.1 like WoW uses), but you may still find it useful:
You can also purchase the second edition, which was written for 5.1.
There are some resources about learning Lua in general here:
There's a tutorial on making AddOns here:
There's also a book targeted at people learning to write WoW AddOns you can purchase here:
I haven't bought the book myself, but I've heard that it's quite good.
If you have any questions, feel free to ask them here.
Edited by Choonster on 1/12/2013 6:08 PM PST
Threats of violence. We take these seriously and will alert the proper authorities.
Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.
Harassing or discriminatory language. This will not be tolerated.