View Single Post
03/17/23, 05:15 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,009
Could you please show your total code, and no screenshots? It's ahrd to see what is wrong if we do not have ALL addon files that you are calling (especially thx txt "manifes" file can create issues too!)

You can attach zip files to the posts too afaik and if this does not work try to just paste the code between the lua highlight tags, or post a link to github/gist/whatever code sharing platform you prefer.


Basically you need to do EVENT_MANAGER:RegisterForEvent("myAddonName", EVENT_GROUP_MEMBER_ROLE_CHANGED, yourCallbackFunctionForThatEvent) within your EVENT_ADD_ON_LOADED callback function, without any zo_callLater!
This will register yourCallbackFunctionForThatEvent for that event, whenever it fires (should fire each time a group member changes his role).

And if you want to update your role texture once at EVENT_ADD_ON_LOADED you need to do that manually, by either calling your function yourCallbackFunctionForThatEvent once (if that was designed to work without the event data which the event callback would pass in as parameters!) or by other means.

And EVENT_MANAGER:UnregisterForEvent is not needed unless you want to explicitly unregister events because they are not needed any longer (eg. if you disable a setting about that group role update -> unregister the events for that too so they do not fire any longer the callback functions. And if you enable the setting -> Register the events again).



btw: You got a typo in your event name!
EVENT_GROUP_MEMBER_ROLE_CHANGED

without S after ROLE

Last edited by Baertram : 03/17/23 at 05:22 PM.
  Reply With Quote