API:LCDRegisterEventHandler
From RoR Wiki
UI Lua API · LCD functions
Version: WAR 1.4.8
Registers a Lua function that an LCD page calls when a game event fires.
LCDRegisterEventHandler(pageName, eventId, callbackName)
Arguments
- pageName
string– Name of the page.- eventId
number– The event, aSystemData.Eventsvalue.- callbackName
string– Name of the Lua function to call, for example"EA_LCDKeyboard.UpdateHP".
Returns
Nothing.
Details
- Each page can have one handler per event. If the page already has a handler for this event, the error below is logged and the old handler stays.
- Input events (event ids 4 to 21) are not accepted for LCD pages. For those the client logs
Warning: LCD pages (%s) do not handle input events, so the %s callback %s() will never be executed. - The handler receives the event's normal arguments. The stock handler for
CHARACTER_QUEUE_UPDATEDis declared asUpdateServerQueueStatus(waitSeconds, queuePos, queueSize). - Remove a handler with LCDUnregisterEventHandler.
- The function needs at least three arguments and only reads the last three.
Errors
Error in function call 'LCDRegisterEventHandler': Page '%s' does not exist.Error in function call 'LCDRegisterEventHandler': Page %s already has an event handler (%s) for event %d.
Example
From ea_lcdkeyboard/source/g15test.lua:
LCDRegisterEventHandler( EA_LCDKeyboard.Page1, SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "EA_LCDKeyboard.UpdateHP" ) LCDRegisterEventHandler( EA_LCDKeyboard.Page1, SystemData.Events.PLAYER_CUR_ACTION_POINTS_UPDATED, "EA_LCDKeyboard.UpdateAP" ) LCDRegisterEventHandler( EA_LCDKeyboard.Page1, SystemData.Events.PLAYER_CAREER_RESOURCE_UPDATED, "EA_LCDKeyboard.UpdateCareerPoints" )
