ok the sticky said to enter the entire code so i'v put in the main part. Is PLAYER_DIFFICULTY_CHANGED the correct event to pull when the dungeon difficulty (normal/heroic) is toggled. I have the correct setup to get the difficulty but can't get the thing to fire when i toggle it.

Did you double-check that it's firing by putting in a print() statement or watching the event trace (/eventtrace)?

__________________
"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

well it didn't fire but now that iv figured out print (i am i still haven't learned lua fully but i am trying ) now i am shoving in prints everywhere to find out its flow chart. but event trace didn't find an event when i changed from normal to heroic (arrg). so i still need to find out what it shows up as.

ok the sticky said to enter the entire code so i'v put in the main part. Is PLAYER_DIFFICULTY_CHANGED the correct event to pull when the dungeon difficulty (normal/heroic) is toggled. I have the correct setup to get the difficulty but can't get the thing to fire when i toggle it.

I remember that the only thing Blizzard registers to listen for that event is the minimap, to change the little icon cluster. If you haven't already, extract their code and take a look at FrameXML/Minimap.* to see what they're doing.

Eventually, you'll almost certainly want to split out each event handler into its own function, so that your OnEvent doesn't become gigantic and hard to maintain. An event dispatcher like this is quite common:

Code:

function FarmForum_OnEvent (self, event, ...)
local handler = self[event]
if type(handler) == "function" then
-- passing the event name is a little redundant for this example but is useful in the general case
return handler (self, event, ...)
end
end

Then your individual handler functions are named after the event, and can also name their arguments directly:

Code:

local MyFrame = Global_Name_of_FarmForum_Frame_From_Wherever_I_Declared_It
function MyFrame:ADDON_LOADED (event, addon_name)
-- addon_name is arg1 here but is also a more self-explanatory name
end
function MyFrame:PLAYER_ENTERING_WORLD()
-- doesn't take any args
end
function MyFrame:CHEESE_GOING_BAD (event, bagslot, flavor)
print("Dammit! The", flavor, "cheese in slot", bagslot, "is turning green!")
end

I remember that the only thing Blizzard registers to listen for that event is the minimap, to change the little icon cluster. If you haven't already, extract their code and take a look at FrameXML/Minimap.* to see what they're doing.