Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:TextLogGetUpdateEventId

From RoR Wiki

UI Lua API · TextLog functions
Version: WAR 1.4.8

Returns the ID of the event that fires when a text log changes.

eventId = TextLogGetUpdateEventId(logName)

Arguments

logName
string – Name of the text log.

Returns

eventId
number – Event ID to pass to RegisterEventHandler.

Details

  • Every text log gets its own event ID when it is created.
  • The handler receives two arguments: updateType and filterType.
    • updateType is one of SystemData.TextLogUpdate.ADDED (0), REMOVED (1) or CLEAR (2).
    • An entry added with TextLogAddEntry fires ADDED with the entry's filter type. TextLogClear fires CLEAR.
  • Entries dropped because the log is disabled do not fire the event.

Errors

  • Error in function call 'TextLogGetUpdateEventId': Text Log %s does not exist

Example

Flashing chat tabs on new text, from ea_chatwindow/source/chatwindow.lua:

local function RegisterTextLogUpdate( textLog )
    -- Register text log update events so we can flash tabs
    local chatLogEventId = TextLogGetUpdateEventId( textLog )
    RegisterEventHandler( chatLogEventId, "EA_ChatWindow.OnTextLogUpdated" )
end

function EA_ChatWindow.OnTextLogUpdated( updateType, filterType )
    if( updateType ~= SystemData.TextLogUpdate.ADDED )
    then
        return
    end
    ...
end

See also