Go to Page... |
Thread Tools | Display Modes |
11/25/15, 09:34 PM | #1 |
Event for entering a group (and have unit frames ready)
I'm having the hardest time figuring out how to properly detect when I get in a group. Whatever event I use it seems there's always some missing information at that point.
I need an event that tells me: - I'm in a group - The unit frames for group mates are created And from any state - I got invited - I invited someone - I was offline and logged in already in a group - I am in a group and reloaded the UI - Any other possible state I was using the official source for unit frames as a guide - http://esodata.uesp.net/current/src/....lua.html#2024 On EVENT_PLAYER_ACTIVATED it seems I can't iterate over UNIT_FRAMES.groupFrames, they're not always initialized at this point. EVENT_GROUP_UPDATE, EVENT_UNIT_CREATED, EVENT_UNIT_FRAME_UPDATE and EVENT_GROUP_MEMBER_JOINED does not happen every time, or not with everyone, or some other shortcoming. Any ideas? |
|
11/26/15, 03:01 AM | #2 |
I had the same problem which couldn't be solved in the past.
So I wrote a workaround at player activated event callback function, which get's the actual group size and checks if I'm in the group member table: Lua Code:
Edit: Oh and for all other situations the callback function for event EVENT_GROUP_MEMBER_JOINED used the same check, and it fired correctly for me (couldn't test it in the past days though!) Last edited by Baertram : 11/26/15 at 03:04 AM. |
|
11/26/15, 04:50 AM | #3 |
@Baertram: There are easier ways to check if someone is in a group:
Lua Code:
@haggen: In my SocialIndicators addon I do not directly operate on every group member event as there are a lot of things going on when a member joins that caused micro freezes in the past (and still do sometimes) without addons adding more work. So in regard to accessing the unit frames this is what I do in my upcoming update for SocialIndicators: Lua Code:
As for the other things you need: - I got invited GetGroupInviteInfo() EVENT_GROUP_INVITE_RECEIVED EVENT_GROUP_INVITE_REMOVED - I invited someone Does not seem to be possible to completely track it via the api. You will need to hook into all the methods that allow you to invite someone and remember who was invited. GroupInvite(*string* _unitTag_) GroupInviteByName(*string* _name_) At least you should get an event when that invite changes: EVENT_GROUP_INVITE_RESPONSE - I was offline and logged in already in a group - I am in a group and reloaded the UI - Any other possible state See above. |
|
11/26/15, 09:34 PM | #4 |
So, I registered a bunch of events with a debug function and then invited some random fella from my guild to group, note that he/she was in a different region.
Here's the events that were triggered, with some additional information: - Value of UNIT_FRAMES.groupSize - If a unitTag was provided in the arguments Code:
1. EVENT_GROUP_MEMBER_ROLES_CHANGED, groupSize = 0, unitTag = group2 2. EVENT_GROUP_MEMBER_IN_REMOTE_REGION, groupSize = 0, unitTag = group2 3. EVENT_GROUP_MEMBER_JOINED, groupSize = 0, no unitTag, but my name character's was available 4. EVENT_LEADER_UPDATE, groupSize = 0, unitTag = group1 5. EVENT_GROUP_SUPPORT_RANGE_UPDATE, groupSize = 0, unitTag = group2 The events I was listening to were: - EVENT_GROUP_MEMBER_CONNECTED_STATUS - EVENT_GROUP_MEMBER_IN_REMOTE_REGION - EVENT_GROUP_MEMBER_JOINED - EVENT_GROUP_MEMBER_LEFT - EVENT_GROUP_MEMBER_ROLES_CHANGED - EVENT_GROUP_NOTIFICATION_MESSAGE - EVENT_GROUP_SUPPORT_RANGE_UPDATE - EVENT_GROUP_TYPE_CHANGED - EVENT_GROUP_UPDATE - EVENT_LEADER_UPDATE - EVENT_UNIT_FRAME_UPDATE The important lesson here is: during these events the unit frames were NOT ready, and NONE of them provided me with full information of my party, nor one same event was fired for each member of my group. Really, WHAT THE ****? |
|
11/26/15, 09:42 PM | #5 |
Now, I reloaded the UI, left the group and asked the guy to invite me back again.
Here's what happened: Code:
EVENT_GROUP_MEMBER_ROLES_CHANGED, 0, group1 EVENT_GROUP_MEMBER_IN_REMOTE_REGION, 0, group1 EVENT_GROUP_MEMBER_ROLES_CHANGED, 0, group2 EVENT_GROUP_MEMBER_IN_REMOTE_REGION, 0, group2 EVENT_GROUP_MEMBER_JOINED, 0, only my name EVENT_GROUP_SUPPORT_RANGE_UPDATE, 0, group1 EVENT_GROUP_SUPPORT_RANGE_UPDATE, 0, group2 Last edited by haggen : 11/26/15 at 09:46 PM. |
|
11/26/15, 10:43 PM | #6 |
One last trivia, I formed a grouped, logged out and then in, here's what happened.
Code:
GameTimeMilliseconds | Event | unitTag ---------------------+-------------------------------------+--------- 10421439 | EVENT_LEADER_UPDATE | [Empty String] 10421439 | UNIT_CREATED | group1 10421439 | EVENT_GROUP_MEMBER_ROLES_CHANGED | group1 10421439 | EVENT_GROUP_MEMBER_IN_REMOTE_REGION | group1 10421439 | UNIT_CREATED | group2 10421439 | EVENT_GROUP_MEMBER_ROLES_CHANGED | group2 10421439 | EVENT_GROUP_MEMBER_IN_REMOTE_REGION | group2 10421445 | EVENT_GROUP_UPDATE | - 10421445 | EVENT_GROUP_SUPPORT_RANGE_UPDATE | group1 10421445 | EVENT_GROUP_SUPPORT_RANGE_UPDATE | group2 10421892 | UNIT_CREATED | group1 10421892 | UNIT_CREATED | group2 10421894 | EVENT_GROUP_UPDATE | - |
|
11/27/15, 05:48 AM | #7 |
UNIT_FRAMES.groupSize is only updated in specific cases.
|
|
11/27/15, 06:26 AM | #8 | |
|
||
11/28/15, 07:42 PM | #9 |
|
I did not test any of this, but maybe it will help.
As for your problem with unit frames not being initialized yet. The zos code registers for this event to create/initialize UNIT_FRAMES: Lua Code:
and when its done it fires this callback & unregisters the event: Lua Code:
So it doesn't look like you need PLAYER_ACTIVATION, you could just register for that callback to know when it is done initializing UNIT_FRAMES and then UNIT_FRAMES.groupFrames should be available:
Warning: Spoiler
Lua Code:
As for knowing when a unit in the unit frames change: it looks like when the units change a dirty flag is set and after it updates everything the flag is cleared. I would think you could just use that function so you know when it is done updating all of the unit frames.
Warning: Spoiler
Lua Code:
I think sirinsidiator answered the other questions. |
ESOUI » Developer Discussions » General Authoring Discussion » Event for entering a group (and have unit frames ready) |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|