Needed for NEARLY all commands: What is the UUID of the player invoking command? ws info -- INFORMATION -- Plugin: Wulfenrat Survey v1.0 Developed by: RuggedSurvivor (Glen Barratt) Contact: (RuggedSurvivor@wulfenrat.com) ws help -- HELP (Command Listing) -- ws help - This help/command listing ws info - Basic information about the plugin ws list {option} - List surveys. Options: untaken, taken, open, closed, all ws p - Participate in a survey ws q {q_sequence} - Display a survey question (and switch to a specified question) ws r ... - Respond to the current survey question ws review - Review your own responses to a survey ws results - Review the general survey results ws list {untaken/taken/open/closed/all} default option is all? WSQ1 {option }Surveys: ws p current_s set to survey with id/alias given Get the survey's question information from the database for the survey with the survey_id -> WSQ2 Have they already participated in this survey? If so, and there is a limit to how many times the survey can be taken, make sure that the limit is not already reached. If so current_q is set to question with the lowest sequence for survey specified then issue ws q ws q {q_sequence} if q_sequence given then switch current_q to question with that sequence display: Survey , Question () is: Who gets your vote for president? Your response options for this question () are: 1 No President (You prefer there not be a president) 2 Panda_Girl1487 3 _Dom1no99_ 4 vanessa_rose_18 ... 10 Rushi_Of_Flames To respond to this question, use: "ws r ", "ws r ", "ws r <[y]es or [n]o>", "ws r <[t]rue or [f]alse>" ws r {...} if param_1 is "skip" or blank then just advance the current_q and exit. if current_q type is multiple_choice then ensure that there is only param_1 set the response for the current_q to be the response for the current_q and sequence of param 1 if current_q type is true_false, then ensure that the strtolower(param_1)[0] is either t or f if (strtolower(param_1)[0]=='t') then set the response to 'true' if (strtolower(param_1)[0]=='f') then set the response to 'false' if current_q type is yes_no, then ensure that the strtolower(param_1)[0] is either y or n if (strtolower(param_1)[0]=='y') then set the response to 'yes' if (strtolower(param_1)[0]=='n') then set the response to 'no' if current_q type is anything else (free, open) then put all the params beyond "r" into a string and thave that be the response if the result for current_q has been successfully set, then advance the current_q TODO LATER: ws delr {q_sequence} ws rc WSQ1: SELECT IFNULL(lt.last_taken, 'NOT TAKEN') AS when_taken, s.id, s.alias, s.name, s.open_date, s.close_date FROM ws_surveys s LEFT JOIN (SELECT survey_id, MAX(when_submitted) AS last_taken FROM ws_responses WHERE player_uuid = '58dc870ec3994cb3badc3dd30b2f1964' GROUP BY survey_id) lt ON lt.survey_id = s.id WHERE (s.open_date IS NULL OR s.open_date < NOW()) AND (s.close_date IS NULL OR s.close_date > NOW()) WSQ1: SELECT s.id AS s_id, s.alias AS s_alias, s.name AS s_name, sq.question_id AS q_id, sq.sequence AS sequence, r.value AS response, r.when_submitted AS response_time, q.type, q.label, q.option_set_id, q.default_response FROM ws_surveys s INNER JOIN ws_survey_questions sq ON sq.survey_id = s.id LEFT JOIN ws_responses r ON (r.survey_id = s.id AND r.question_id = sq.question_id AND r.player_uuid = '58dc870ec3994cb3badc3dd30b2f1964') INNER JOIN ws_questions q ON q.id = sq.question_id ORDER BY sq.sequence Times Taken get_times_taken(uuid, survey_id)