API:SendSurveyResponse
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Sends the player's answers to a survey to the server.
SendSurveyResponse(surveyId, eventType, objectId, objectName, comment, submitted)
Arguments
- surveyId
number– ID of the survey (Survey.id).- eventType
number– Event type of the survey (Survey.event_type).- objectId
number– Object the survey is about (Survey.object_id).- objectName
wstring– Name of that object (Survey.object_name).- comment
wstring– Free-text comment.- submitted
boolean–truewhen the player submitted the survey,falsewhen it was closed without submitting.
Returns
Nothing.
Details
- Besides the arguments, the answers are read from the global Lua table
Survey: forn= 1 to 10,Survey.question[n].label(wstring) andSurvey.question[n].choice(number). Reading stops at the first question whose label is empty. Each choice is sent as a value from 0 to 255. - All six values and the list of choices are sent to the server in one message.
- The function needs at least six arguments and only reads the last six.
submittedmust be a real boolean.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_surveywindow/source/surveywindow.lua:
SendSurveyResponse(Survey.id, Survey.event_type, Survey.object_id, Survey.object_name, EA_Window_SurveyCommentText.Text, true) EA_Window_Survey.hasSubmitted = true
Sending the response with submitted = false when the window is closed without submitting, from the same file:
if( not EA_Window_Survey.hasSubmitted )
then
SendSurveyResponse(Survey.id, Survey.event_type, Survey.object_id, Survey.object_name, EA_Window_SurveyCommentText.Text, false)
end
