How to show announcements

From ESOUI Wiki

Jump to: navigation, search

There is a new API to create center screen announcements, a message at the center/top right edge of the screen, which is queued, so that different messages
will show after each other (error messages, information, etc.).
The so called "Center screen announcements" (CSA) can happen together with a sound of the global SOUNDS table.

This is an example

			local params = CENTER_SCREEN_ANNOUNCE:CreateMessageParams(CSA_CATEGORY_LARGE_TEXT, SOUNDS.ACHIEVEMENT_AWARDED)
			params:SetCSAType(CENTER_SCREEN_ANNOUNCE_TYPE_POI_DISCOVERED)
			params:SetText(GetString(SI_STRING_CONSTANT) or "My announcement text here")
			CENTER_SCREEN_ANNOUNCE:AddMessageWithParams(params)

List of categories:

CSA_CATEGORY_SMALL_TEXT = 1
CSA_CATEGORY_LARGE_TEXT = 2
CSA_CATEGORY_NO_TEXT = 3
CSA_CATEGORY_RAID_COMPLETE_TEXT = 4
CSA_CATEGORY_MAJOR_TEXT = 5
CSA_CATEGORY_COUNTDOWN_TEXT = 6

List of SCATypes is in the doc attached in this post: https://forums.elderscrollsonline.com/en/discussion/335644/update-14-api-patch-notes-change-log-pts
Center screen announcements have been refactored in a few ways. Instead of supplying a long, long, long list of returns to specify all of the details of the announcement,
you now return messageParams object created from CENTER_SCREEN_ANNOUNCE:CreateMessageParams(type, sounds). All of the existing functionality can be accessed by calling the
appropriate functions on the messageParams object.
We have also changed priority and filtering to be based on the new CENTER_SCREEN_ANNOUNCE_TYPE enum instead of events because there were more and more announcements not
triggered by events.
Finally, we have added two new announcement types called CSA_CATEGORY_MAJOR_TEXT and CSA_CATEGORY_COUNTDOWN_TEXT. These are used for battleground messages and countdowns
(battleground start and dueling) respectively.



Here are useful CENTER_SCREEN_ANNOUNCE public functions:

CreateBarParams(...)
CreateMessageParams(category, sound) --this returs an object of type ZO_CenterScreenMessageParams
ReleaseMessageParams(messageParams)
CanDisplayMessage(category)
AddMessage(eventId, category, ...) --this is the legacy function
AddMessageWithParams(messageParams)
QueueMessage(messageParams)
DisplayMessage(messageParams)



ZO_CenterScreenMessageParams functions:

Reset()
SetSound(sound)
GetSound()
SetText(mainText, secondaryText)
GetMainText()
GetSecondaryText()
SetIconData(icon, iconBg)
GetIconData()
SetExpiringCallback(callback)
GetExpiringCallback()
SetBarParams(barParams)
GetBarParams()
SetLifespanMS(lifespanMS)
GetLifespanMS()
MarkSuppressIconFrame()
GetSuppressIconFrame()
MarkQueueImmediately(reinsertStompedMessage)
GetQueueImmediately()
MarkShowImmediately()
GetShowImmediately()
GetMostUniqueMessage()
SetCategory(category)
GetCategory()
SetObjectPoolKey(key)
SetCSAType(csaType)
GetCSAType()
SetPriority(priority)
GetPriority()
SetQueuedOrder(queuedOrder)
GetQueuedOrder()
SetEndOfRaidData(endOfRaidData)
GetEndOfRaidData()
CallExpiringCallback()
PlaySound()
ConvertOldParams(sound, message, combinedMessage, icon, iconBg, expiringCallback, barParams, lifespan, suppressFrame, queueImmediately, showImmediately, reinsertStompedMessage)



You can also add your types with priorities with this function:

ZO_CenterScreenAnnounce_SetPriority(csaType, priority)
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox