API:InteractSelect
From RoR Wiki
UI Lua API · Interact functions
Version: WAR 1.4.8
Selects an option or a quest from the interaction menu returned by InteractGetBaseInteractionData.
InteractSelect(interactionId, type, slot)
Arguments
- interactionId
number– Id of the current interaction, the same value passed to InteractGetBaseInteractionData. Only its low 16 bits are compared.- type
number– Thetypefield of the chosen option or quest.- slot
number– For quests (type6), the quest'sslotfield. The stock UI passes0for other options.
Returns
Nothing.
Details
- If
interactionIddoes not match the current interaction, nothing happens. - The client runs the action for
type. For quests, aslotoutside the quest list does nothing; otherwise the client sends the server a request for that quest. typeis not range-checked. The client looks it up in a table of handlers for types 0 to 22; the entries for 16 and 17 are empty, and values outside 0–22 are read past the end of the table. Only passtypevalues received from InteractGetBaseInteractionData.- The function needs at least three arguments and only reads the last three.
Errors
None besides the generic Invalid Parameters message when an argument is missing or not a number.
Example
From default/ea_interactionwindow/source/interactionbase.lua:
function EA_Window_InteractionBase.QuestLButtonUp()
local buttonIndex = WindowGetId(SystemData.ActiveWindow.name)
local dataIndex = ListBoxGetDataIndex("EA_Window_InteractionBaseQuestList", buttonIndex)
local optionData = EA_Window_InteractionBase.questListData[dataIndex]
InteractSelect(EA_Window_InteractionBase.tempTarget, optionData.type, optionData.slot)
end
From the same file, for a menu option:
InteractSelect(EA_Window_InteractionBase.tempTarget, optionData.type, 0)
