Posted by kraiven on Sun, 15 Feb 2015 21:11:19
I'm attempting to write my first addon while trying to learn LUA. I'm having trouble finding the exact API data to move forward with my code. I'd like to write it myself, but I'm wondering if someone can point me in the right direction with some better examples. Currently I'm trying to make a very simple code that when you enter a LFG, it compares your active spec(tank, healer, damage) to your Queued selected role(tank, healer, damage), and if they don't match, prints a message in chat saying you are in the wrong spec. Some of the "get(functions)" I've been looking at in the WoW API are incomplete for data and explanations. Any pointers?
Here's my current code:(which I'm sorry if it's noobish I'm more use to Python)
-- Spec Check load on Instance local f = CreateFrame("Frame") local role = UnitGroupRolesAssigned("player") local isAssigned = GetPartyAssignment("assignment", "player") f:RegisterEvent(PLAYER_ROLES_ASSIGNED); --f:RegisterEvent(ending event); -- Check Active Role Vs. Assigned Role f:SetScript("OnEvent", function(self, event, ...) if event == "PLAYER_ROLES_ASSIGNED" and role ~= isassigned then print("Your current Talent Spec is set Wrong, switch specs!") end end)
Thank you for any tips, I'm just doing this for fun.
Posted by jnwhiteh on Mon, 23 Feb 2015 21:38:45
Does your code work? Something specific I can help with?