API:SelectEventRewards
From RoR Wiki
UI Lua API · LiveEvent functions
Version: WAR 1.4.8
Sends the player's choice of live event rewards to the server.
SelectEventRewards(eventId, level1Choices, level2Choices, level3Choices)
Arguments
- eventId
number– Event id.- level1Choices, level2Choices, level3Choices
number-table– For each of the first three reward levels, an array of the chosen reward positions (1–4) in that level'sitemslist (see GetLiveEventTasks). Use an empty table for no choice.
Returns
Nothing.
Details
- Each table is turned into a set of flags; values outside 1–4 are ignored, and repeated values count once.
- The client sends the event id and the three sets to the server. It does not check them against the event's rewards.
- The function needs at least four arguments and only reads the last four.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_interactionwindow/source/interactioneventrewards.lua:
local rewardsArrays = {}
for level = 1, TomeWindow.NUM_REWARD_LEVELS
do
rewardsArrays[level] = {}
for reward = 1, TomeWindow.MAX_REWARDS_PER_LEVEL
do
if( ButtonGetPressedFlag("EA_Window_InteractionEventRewardsLevel"..level.."Reward"..reward) == true )
then
table.insert( rewardsArrays[level], reward )
end
end
end
SelectEventRewards( EA_Window_InteractionEventRewards.currentEvent, rewardsArrays[1], rewardsArrays[2], rewardsArrays[3] )
