Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-06-15, 02:48 PM   #1
Kraiven
A Deviate Faerie Dragon
 
Kraiven's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2015
Posts: 10
spName returning nil instead of spec name

Hey guys, I noticed a small bug in my code that I overlooked before. So basically the highlighted code is suppose to print a chat message telling the player their current "loot spec chosen". When you right click portrait > loot specialization There are 4 options, lets say the warrior for example:
  • Current Specialization (Protection)
    Arms
    Fury
    Protection

When you choose anything other than "Current Specialization" The print works just fine, naming your set loot spec chosen, but if Current Specialization is selected, returns a nil in the chat print.

Question, can anyone point out my obvious mistake? I must have deleted something that I needed before to correct this, unless something changed in 6.1, or I missed an option?

Code:
	local isInstance = IsInInstance()                  -- Check if Player is In an Instance
	if event == "PLAYER_ENTERING_WORLD" and isInstance then  -- "and isInstance" Remove this before 'then' to test code without being in LFG instance  
		local currentSpec = GetSpecialization()
		local currentSpecName = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or "None" -- Get Current Spec Name
		local role = UnitGroupRolesAssigned("player"); -- Role selected or assigned in LFG 
		local spec = GetSpecialization()
		local specRole = GetSpecializationRole(spec)   -- Current Role Specialization
		if role ~= specRole then
			local specId = GetSpecialization() 		   -- Loot Role Info
			local spId = GetLootSpecialization()   	   -- Loot Role Info
			local sId, spName = GetSpecializationInfoByID(spId) -- Loot Role Info
			StaticPopup_Show ("WRONG_SPEC_WARNING")    -- Show Static PopUp from below
			playSound()								   -- Illidan Sound File
			print("|cffffff00--- SpecCheck Addon Warning: Wrong Role Active")
			print("|cff00ccff--- Active Specialization:|r ", currentSpecName)
			print("|cff00ccff--- Loot Specialization: |r", spName)
Thanks for any help and taking the time to look,
Krai
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » spName returning nil instead of spec name


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