Originally Posted by Fizzlemizz
Lua Code:
if oldstanding and oldstanding<newstanding then
TrackedFactions starts as an empty table so oldstanding will always be nil until a new faction entry is added.
Lua Code:
if not oldstanding or oldstanding<newstanding then
|
That only controls the sound playing, not the recording. The idea is for
PLAYER_LOGIN to start the initial scan, populating
TrackedFactions. Further updates compare previous values added and act accordingly. If a new faction was added mid-session, it's designed to not play the sound and still record the initial value.
Looks like the issue was with the
hasrep flag. I assumed it was for all factions that show a reputation bar, but it only applies to headers. This adjusts accordingly.
Replace this
Code:
local _,_,newstanding,_,_,_,_,_,_,_,hasrep,_,_,faction=GetFactionInfo(i);
if hasrep and faction and (newstanding or 0)>0 then
with this
Code:
local _,_,newstanding,_,_,_,_,_,isheader,_,hasrep,_,_,faction=GetFactionInfo(i);
if faction and (not isheader or hasrep) and (newstanding or 0)>0 then
Also be sure to change
PlaySoundFile("Interface\\AddOns\\YourAddOn\\YourSoundFile.ogg") to the path to the sound file you wish to play. This is relative to the client's install directory. Note
YourAddOn and
YourSoundFile.ogg are the parts to change accordingly.