API:AddSelectedReward
From RoR Wiki
UI Lua API · Interact functions
Version: WAR 1.4.8
Marks one choice reward of the current quest as selected.
AddSelectedReward(rewardIndex)
Arguments
- rewardIndex
number– Number of the choice reward,1to25.
Returns
Nothing useful. See Details.
Details
- The client keeps a set of selected choice rewards. This function adds
rewardIndexto it. Values outside 1–25 are ignored. - Nothing is sent to the server by this call. The client reads the selection later, when it builds the interaction request that completes the quest. The stock quest window selects rewards first and then broadcasts
SystemData.Events.INTERACT_COMPLETE_QUEST. - The client does not check how many rewards the quest allows. The stock UI compares against
GameData.InteractQuestData.maxChoicesitself. - After a successful call the function reports one return value without pushing one, so Lua receives the value on top of the stack, which is the last argument passed. Do not rely on this.
- The function needs at least one argument and only reads the last one.
Errors
None besides the generic Invalid Parameters message when the argument is not a number.
Example
Selecting the only allowed reward, from default/ea_interactionwindow/source/interactionquestwindow.lua:
if( EA_Window_InteractionQuest.choiceRewardsData[btn].selected == true )
then
ClearSelectedRewards()
AddSelectedReward( btn )
end
