ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   CENTER_SCREEN_ANNOUNCE changes (https://www.esoui.com/forums/showthread.php?t=7038)

Enodoc 05/17/17 12:02 PM

CENTER_SCREEN_ANNOUNCE changes
 
Does anyone have a full breakdown of changes for CENTER_SCREEN_ANNOUNCE? I use three related functions from it, and I'm not sure how they will be affected.

These two, which I nabbed (with permission) from No, Thank You! to disable certain AvA messages in Cyrodiil:
Lua Code:
  1. local messageQueue = CENTER_SCREEN_ANNOUNCE.m_displayQueue
Lua Code:
  1. local priority = CENTER_SCREEN_ANNOUNCE:GetPriority(avaEvents[eventIndex])

and this one, which I use in CyrodiilAlert to display all the messages:
Lua Code:
  1. CENTER_SCREEN_ANNOUNCE:AddMessage(0, category, sound, message, message2, nil, nil, nil, nil, delay_ms, nil)

The last one will almost certainly be affected by CENTER_SCREEN_ANNOUNCE:CreateMessageParams(type, sounds). but I don't know what's needed instead for all the parameters I have, and then to display the message afterwards.

I also don't know whether the changes to priority will affect anything, and what's the difference between a TYPE and a CATEGORY?

Thanks!

Kyoma 05/17/17 01:26 PM

Quote:

Originally Posted by Enodoc (Post 30974)
Does anyone have a full breakdown of changes for CENTER_SCREEN_ANNOUNCE? I use three related functions from it, and I'm not sure how they will be affected.
...
Thanks!

It seems most/all member variables no longer have the "m_" prefix so just use this:
Code:

CENTER_SCREEN_ANNOUNCE.displayQueue
Or a simple if check if you want code to work on live and on pts for now.

As for GetPriority() , it changed a bit since they changed from using an event code directly to a seperate set of constants. Before you would use
Code:

CENTER_SCREEN_ANNOUNCE:GetPriority(EVENT_KEEP_GATE_STATE_CHANGED)
Where as on pts you'd use
Code:

CENTER_SCREEN_ANNOUNCE:GetPriority(CENTER_SCREEN_ANNOUNCE_TYPE_KEEP_GATE_CHANGED)
There's a type for each of those previous events with a priority but they have a slightly different name.

You can still use AddMessage(...) as it became a wrapper function for the new code. It doesn't lose functionality. Now....depending on what exactly you want to do there might be more changes relevant to you.

Enodoc 05/21/17 10:05 AM

I just tried a simple thing in the chat box and nothing happened, so I'm not sure what I did wrong.
Lua Code:
  1. /script CENTER_SCREEN_ANNOUNCE:AddMessage(0, CSA_EVENT_COMBINED_TEXT, "Justice_NowKOS", "message", "message2", nil, nil, nil, nil, 10000, nil)
There was no error, so it seems to be syntactically correct, but simply nothing happened.


Edit: Ah, hold on, I think maybe they changed the names of the categories....

So far I think CSA_CATEGORY_LARGE_TEXT has replaced CSA_EVENT_COMBINED_TEXT, but I'm not sure about the others.


Edit 2: OK I think I've worked it out. CSA_EVENT_COMBINED_TEXT and CSA_EVENT_LARGE_TEXT have been merged into CSA_CATEGORY_LARGE_TEXT, CSA_EVENT_SMALL_TEXT has become CSA_CATEGORY_SMALL_TEXT, and as stated in the patch notes there's CSA_CATEGORY_MAJOR_TEXT and CSA_CATEGORY_COUNTDOWN_TEXT which are new. Anything I've missed?

Harven 05/23/17 08:20 AM

Hey,
There is a new API to create center screen announcements. This is how I use it in my Thieves Troves Marker addon:

Lua Code:
  1. local params = CENTER_SCREEN_ANNOUNCE:CreateMessageParams(CSA_CATEGORY_LARGE_TEXT, SOUNDS.ACHIEVEMENT_AWARDED)
  2.             params:SetCSAType(CENTER_SCREEN_ANNOUNCE_TYPE_POI_DISCOVERED)
  3.             params:SetText(GetString(HARVENS_THIEVES_TROVE_DISCOVERED))
  4.             CENTER_SCREEN_ANNOUNCE:AddMessageWithParams(params)

List of categories:
Lua Code:
  1. CSA_CATEGORY_SMALL_TEXT = 1
  2. CSA_CATEGORY_LARGE_TEXT = 2
  3. CSA_CATEGORY_NO_TEXT = 3
  4. CSA_CATEGORY_RAID_COMPLETE_TEXT = 4
  5. CSA_CATEGORY_MAJOR_TEXT = 5
  6. CSA_CATEGORY_COUNTDOWN_TEXT = 6

List of SCATypes is in the doc attached in this post: https://forums.elderscrollsonline.co...change-log-pts

Here are useful CENTER_SCREEN_ANNOUNCE public functions:
Lua Code:
  1. CreateBarParams(...)
  2. CreateMessageParams(category, sound) --this returs an object of type ZO_CenterScreenMessageParams
  3. ReleaseMessageParams(messageParams)
  4. CanDisplayMessage(category)
  5. AddMessage(eventId, category, ...) --this is the legacy function
  6. AddMessageWithParams(messageParams)
  7. QueueMessage(messageParams)
  8. DisplayMessage(messageParams)

ZO_CenterScreenMessageParams functions:
Lua Code:
  1. Reset()
  2. SetSound(sound)
  3. GetSound()
  4. SetText(mainText, secondaryText)
  5. GetMainText()
  6. GetSecondaryText()
  7. SetIconData(icon, iconBg)
  8. GetIconData()
  9. SetExpiringCallback(callback)
  10. GetExpiringCallback()
  11. SetBarParams(barParams)
  12. GetBarParams()
  13. SetLifespanMS(lifespanMS)
  14. GetLifespanMS()
  15. MarkSuppressIconFrame()
  16. GetSuppressIconFrame()
  17. MarkQueueImmediately(reinsertStompedMessage)
  18. GetQueueImmediately()
  19. MarkShowImmediately()
  20. GetShowImmediately()
  21. GetMostUniqueMessage()
  22. SetCategory(category)
  23. GetCategory()
  24. SetObjectPoolKey(key)
  25. SetCSAType(csaType)
  26. GetCSAType()
  27. SetPriority(priority)
  28. GetPriority()
  29. SetQueuedOrder(queuedOrder)
  30. GetQueuedOrder()
  31. SetEndOfRaidData(endOfRaidData)
  32. GetEndOfRaidData()
  33. CallExpiringCallback()
  34. PlaySound()
  35. ConvertOldParams(sound, message, combinedMessage, icon, iconBg, expiringCallback, barParams, lifespan, suppressFrame, queueImmediately, showImmediately, reinsertStompedMessage)

You can also add your types with priorities with this function:
Lua Code:
  1. ZO_CenterScreenAnnounce_SetPriority(csaType, priority)

Hope this will be useful :)

Enodoc 05/23/17 10:44 AM

That's great, thanks! I'll push a minimal-changes version of CA today, and then work on replacing the legacy function with the new ones later on.


All times are GMT -6. The time now is 06:50 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI