_rezzer.lslp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. // LSL script generated: mod.set-1.0.rezzer_reset_btn.lslp Tue Nov 15 15:49:28 Tokyo Standard Time 2011
  4. /*
  5. * Part of the Sloodle project (www.sloodle.org)
  6. *
  7. * Copyright (c) 2011-06 contributors (see below)
  8. * Released under the GNU GPL v3
  9. * -------------------------------------------
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * All scripts must maintain this copyrite information, including the contributer information listed
  25. *
  26. * Contributors:
  27. * Paul Preibisch
  28. *
  29. * DESCRIPTION
  30. * Rezzer.lslp
  31. * This script is responsible for:
  32. * *** initiating the loading of a quiz
  33. * *** getting the first question and loading the options as texture maps on the child prims (pie_slices)
  34. * *** initiating a countdown in the timer.lslp script
  35. * *** starting a sensor, and using hovertext to display which pie_slice a user is standing over
  36. * *** determining the value of each option and telling each pie_slice to open or close when the count down timer reaches zero
  37. * *** determining which pie_slice a user is standing over at the end of the countdown, and submitting their answers to the notify_server.lslp script
  38. * *** rezzing orbs on each of its edges which are clickable by avatars who answered correctly
  39. * *** receive linked messages from the orbs which indicate touch events from avatars who have answered the question correctly, and rez
  40. * rezzing child hexagons along the touched edges
  41. * *** Receive GET QUESTION command from a child hex when its center orb has been touched by an avatar
  42. * *** requesting questions from question_handler.lslp and passing retrieved question along to the requesting child hexagon
  43. *
  44. *
  45. */
  46. float edge_length;
  47. float tip_to_edge;
  48. list QUESTIONS_ASKED;
  49. float edge_length_half;
  50. string CONFIG;
  51. list rezzed_hexes;
  52. list opids;
  53. integer PIN=7961;
  54. integer doRepeat;
  55. integer doRandomize;
  56. integer doPlaySound;
  57. integer quiz_id;
  58. integer ALREADY_REZZED=FALSE;
  59. string quiz_name;
  60. integer question_id;
  61. integer NO_REZ_ZONE;
  62. list ORBS_TOUCHED;
  63. integer SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC = 0;
  64. integer SLOODLE_OBJECT_ACCESS_LEVEL_OWNER = 1;
  65. integer SLOODLE_OBJECT_ACCESS_LEVEL_GROUP = 2;
  66. integer SLOODLE_CHANNEL_QUIZ_NO_PERMISSION_USE= -1639271118; //user has tried to use the chair but doesnt have permission to do so.
  67. integer SLOODLE_CHANNEL_QUIZ_LOAD_QUIZ= -1639277003;//user touched object
  68. integer SLOODLE_CHANNEL_SET_CLEANUP_AND_DEREZ = -1639270131; // linked message to tell the object to derez if it has some object-specific cleanup tasks.
  69. list question_ids;
  70. integer num_questions;
  71. list DETECTED_AVATARS;
  72. list DETECTED_AVATARS_POSITION;
  73. list DETECTED_AVATARS_OP_IDS;
  74. list DETECTED_AVATARS_SCORE_CHANGE;
  75. integer current_question;
  76. string sloodleserverroot = "";
  77. integer sloodlecontrollerid = 0;
  78. string sloodlepwd = "";
  79. integer sloodlemoduleid = 0;
  80. integer sloodleobjectaccessleveluse = 0; // Who can use this object?
  81. integer sloodleobjectaccesslevelctrl = 0; // Who can control this object?
  82. integer sloodleserveraccesslevel = 0; // Who can use the server resource? (Value passed straight back to Moodle)
  83. integer isconfigured = FALSE; // Do we have all the configuration data we need?
  84. integer eof = FALSE; // Have we reached the end of the configuration data?
  85. string SLOODLE_EOF = "sloodleeof";
  86. string sloodle_quiz_url = "/mod/sloodle/mod/quiz-1.0/linker.php";
  87. list sides_rezzed;
  88. string QUIZ_DATA;
  89. integer TIME_LIMIT;
  90. list GRAND_CHILDREN;
  91. integer SLOODLE_REMOTE_LOAD_SCRIPT=1639277018;
  92. string HEX_CONFIG_SEPARATOR="*^*^*^";
  93. integer SLOODLE_CHANNEL_ANIM= -1639277007;
  94. integer SLOODLE_CHANNEL_OBJECT_DIALOG = -3857343; // an arbitrary channel the sloodle scripts will use to talk to each other. Doesn't atter what it is, as long as the same thing is set in the sloodle_slave script.
  95. integer SLOODLE_CHANNEL_ANSWER_SCORE_FOR_AVATAR = -1639271113; // Tells anyone who might be interested that we scored the answer. Score in string, avatar in key.
  96. integer SLOODLE_SET_TEXTURE= -1639277010;
  97. integer SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE= -1639277008;
  98. integer SLOODLE_CHANNEL_QUIZ_MASTER_REQUEST= -1639277006;
  99. integer SLOODLE_CHANNEL_USER_TOUCH = -1639277002;//user touched object
  100. integer SLOODLE_CHANNEL_QUIZ_LOADING_QUIZ = -1639271109;
  101. string SLOODLE_TRANSLATE_HOVER_TEXT = "hovertext"; // 2 output parameters: colour <r,g,b>, and alpha value
  102. string SLOODLE_TRANSLATE_WHISPER = "whisper"; // 1 output parameter: chat channel number
  103. string SLOODLE_TRANSLATE_SAY = "say"; // 1 output parameter: chat channel number
  104. string SLOODLE_TRANSLATE_OWNER_SAY = "ownersay"; // No output parameters
  105. string SLOODLE_TRANSLATE_DIALOG = "dialog"; // Recipient avatar should be identified in link message keyval. At least 2 output parameters: first the channel number for the dialog, and then 1 to 12 button label strings.
  106. string SLOODLE_TRANSLATE_LOAD_URL = "loadurl"; // Recipient avatar should be identified in link message keyval. 1 output parameter giving URL to load.
  107. string SLOODLE_TRANSLATE_IM = "instantmessage"; // Recipient avatar should be identified in link message keyval. No output parameters.
  108. integer SLOODLE_CHANNEL_TRANSLATION_REQUEST = -1928374651;
  109. integer SLOODLE_CHANNEL_QUIZ_ASK_QUESTION = -1639271112; //used when this script wants to ask a question and have the results sent to the child hex
  110. integer SLOODLE_CHANNEL_QUESTION_ASKED_AVATAR = -1639271105; //Sent by main quiz script to tell UI scripts that question has been asked to avatar with key. String contains question ID + "|" + question text
  111. integer SLOODLE_CHANNEL_QUIZ_LOADED_QUIZ = -1639271110;
  112. integer SLOODLE_CHANNEL_QUIZ_NOTIFY_SERVER_OF_RESPONSE= -1639277004;
  113. integer SLOODLE_CHANNEL_QUIZ_STATE_ENTRY_LOAD_QUIZ_FOR_USER = -1639271116; //mod quiz script is in state CHECK_QUIZ
  114. string SLOODLE_TRANSLATE_HOVER_TEXT_LINKED_PRIM= "hovertext_linked_prim"; // 3 output parameters: colour <r,g,b>, alpha value, link number
  115. string HEXAGON_PLATFORM="Hexagon Quizzer";
  116. integer TIMES_UP=FALSE;
  117. integer num_options=0;
  118. list CORRECT_AVATARS;
  119. list options;//store pie slice correlation. Therefore option[0]=pie_slice#
  120. integer quiz_loaded=FALSE;
  121. vector RED =<1.00000, 0.00000, 0.00000>;
  122. vector ORANGE=<1.00000, 0.43763, 0.02414>;
  123. vector YELLOW=<1.00000, 1.00000, 0.00000>;
  124. vector GREEN=<0.00000, 1.00000, 0.00000>;
  125. vector BLUE=<0.00000, 0.00000, 1.00000>;
  126. vector BABYBLUE=<0.00000, 1.00000, 1.00000>;
  127. vector PINK=<1.00000, 0.00000, 1.00000>;
  128. vector PURPLE=<0.57338, 0.25486, 1.00000>;
  129. vector BLACK= <0.00000, 0.00000, 0.00000>;
  130. vector WHITE= <1.00000, 1.00000, 1.00000>;
  131. vector AVCLASSBLUE= <0.06274,0.247058,0.35294>;
  132. vector AVCLASSLIGHTBLUG=<0.8549,0.9372,0.9686>;//#daeff7
  133. integer SLOODLE_TIMER_START= -1639277011; //shoudl be used to starts the timer from its current position
  134. integer SLOODLE_TIMER_RESTART= -1639277012;//should be used to set the counter to 0 and begin counting down again
  135. integer SLOODLE_TIMER_STOP= -1639277013;//should stop the timer at its current position
  136. integer SLOODLE_TIMER_STOP_AND_RESET= -1639277014;//should stop the timer at its current position and reset count to 0
  137. integer SLOODLE_TIMER_RESET= -1639277015;//shoudl reset the count back to zero but not restart the timer
  138. integer SLOODLE_TIMER_TIMES_UP= -1639277016;//used to transmit the timer reached its time limit
  139. list MY_SLICES;
  140. integer already_received_question=FALSE;
  141. integer my_start_param;
  142. list pie_slice_hover_text;
  143. string qdialogtext;
  144. list qdialogoptions;
  145. list option_points;
  146. debug (string message ){
  147. list params = llGetPrimitiveParams ([PRIM_MATERIAL ]);
  148. if (llList2Integer (params ,0)==PRIM_MATERIAL_FLESH){
  149. llOwnerSay("memory: "+(string)llGetFreeMemory()+" Script name: "+llGetScriptName ()+": " +message );
  150. }
  151. }
  152. integer sloodle_check_access_use(key id){
  153. // Check the access mode
  154. if (sloodleobjectaccessleveluse == SLOODLE_OBJECT_ACCESS_LEVEL_GROUP) {
  155. return llSameGroup(id);
  156. } else if (sloodleobjectaccessleveluse == SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC) {
  157. return TRUE;
  158. }
  159. // Assume it's owner mode
  160. return (id == llGetOwner());
  161. }
  162. //returns the pie_slice the avatar is standing near
  163. string get_detected_pie_slice(vector avatar){
  164. //returns name of pie_slice
  165. integer i;
  166. float closest_orb_distance=100.0;
  167. string name_of_closest_orb="";
  168. integer closest_orb_link_number;
  169. integer root_orb= get_prim("Hexagon Quizzer");
  170. for (i=1;i<=6;i++){
  171. integer orb_link_number = get_prim("orb"+(string)i);
  172. list orb_data=llGetLinkPrimitiveParams(orb_link_number, [PRIM_POSITION]);
  173. vector orb_pos = llList2Vector(orb_data, 0);
  174. float detected_distance_from_avatar_to_orb = llVecDist(orb_pos, avatar);
  175. if (detected_distance_from_avatar_to_orb<closest_orb_distance){
  176. closest_orb_distance = detected_distance_from_avatar_to_orb;
  177. name_of_closest_orb="orb"+(string)i;
  178. }
  179. }
  180. return name_of_closest_orb;
  181. }
  182. /*
  183. * This function will determine how much a particular pie_slice is worth.
  184. *
  185. *
  186. */
  187. integer question_prim;
  188. integer num_links;
  189. set_prim_text(integer prim,string text,vector color){
  190. llSetLinkPrimitiveParamsFast(prim, [PRIM_TEXT,text,color,1] );
  191. }
  192. /*
  193. Search through all linked prims, and returns the prims link number which matches the name
  194. */
  195. integer get_prim(string name){
  196. num_links=llGetNumberOfPrims();
  197. integer i;
  198. integer prim=-1;
  199. for (i=0;i<=num_links;i++){
  200. if (llGetLinkName(i)==name){
  201. prim=i;
  202. }else{
  203. }
  204. }
  205. return prim;
  206. }
  207. string strReplace(string str, string search, string replace) {
  208. return llDumpList2String(llParseStringKeepNulls(str, [search], []), replace);
  209. }
  210. // Send a translation request link message
  211. sloodle_translation_request(string output_method, list output_params, string string_name, list string_params, key keyval, string batch){
  212. llMessageLinked(LINK_THIS, SLOODLE_CHANNEL_TRANSLATION_REQUEST, output_method + "|" + llList2CSV(output_params) + "|" + string_name + "|" + llList2CSV(string_params) + "|" + batch, keyval);
  213. }
  214. // Configure by receiving a linked message from another script in the object
  215. // Returns TRUE if the object has all the data it needs
  216. integer sloodle_handle_command(string str){
  217. list bits = llParseString2List(str,["|"],[]);
  218. integer numbits = llGetListLength(bits);
  219. string name = llList2String(bits,0);
  220. string value1 = "";
  221. string value2 = "";
  222. if (numbits > 1) value1 = llList2String(bits,1);
  223. if (numbits > 2) value2 = llList2String(bits,2);
  224. if (name == "set:sloodleserverroot") sloodleserverroot = value1;
  225. else if (name == "set:sloodlepwd") {
  226. // The password may be a single prim password, or a UUID and a password
  227. if (value2 != "") {
  228. sloodlepwd = value1 + "|" + value2;
  229. }
  230. else {
  231. sloodlepwd = value1;
  232. }
  233. }
  234. else if (name == "set:questiontimelimit"){
  235. TIME_LIMIT= (integer)value1;
  236. debug("\n\n\n\n\n we got time limit is: "+(string)TIME_LIMIT);
  237. }
  238. else if (name == "set:sloodlecontrollerid") sloodlecontrollerid = (integer)value1;
  239. else if (name == "set:sloodlemoduleid") sloodlemoduleid = (integer)value1;
  240. else if (name == "set:sloodleobjectaccessleveluse") sloodleobjectaccessleveluse = (integer)value1;
  241. else if (name == "set:sloodleserveraccesslevel") sloodleserveraccesslevel = (integer)value1;
  242. else if (name == "set:sloodlerepeat") doRepeat = (integer)value1;
  243. else if (name == "set:sloodlerandomize") doRandomize = (integer)value1;
  244. else if (name == "set:sloodleplaysound") doPlaySound = (integer)value1;
  245. else if (name == SLOODLE_EOF) eof = TRUE;
  246. return (sloodleserverroot != "" && sloodlepwd != "" && sloodlecontrollerid > 0 && sloodlemoduleid > 0);
  247. }
  248. default {
  249. on_rez(integer start_param){
  250. llResetScript();
  251. }
  252. state_entry() {
  253. integer n=llGetNumberOfPrims();
  254. integer j=0;
  255. for (j=0;j<n;j++){
  256. llSetLinkPrimitiveParamsFast( j,[PRIM_TEXT," ",GREEN,1]);
  257. }
  258. llSetScriptState( "_platform.lslp", FALSE);
  259. }
  260. link_message(integer sender_num, integer num, string str, key id) {
  261. if (num==SLOODLE_CHANNEL_OBJECT_DIALOG){
  262. CONFIG=str;
  263. list lines = llParseString2List(CONFIG, ["\n"], []);
  264. integer numlines = llGetListLength(lines);
  265. integer i = 0;
  266. for (i=0; i < numlines; i++) {
  267. isconfigured = sloodle_handle_command(llList2String(lines, i));
  268. }
  269. // If we've got all our data AND reached the end of the configuration data (eof), then move on
  270. if (eof == TRUE) {
  271. if (isconfigured == TRUE) {
  272. sloodle_translation_request ( SLOODLE_TRANSLATE_SAY , [0], "script_configurationreceived" , [ llGetScriptName()], NULL_KEY , "hex_quizzer");
  273. state ready;
  274. }
  275. }
  276. }else
  277. if (num == SLOODLE_CHANNEL_SET_CLEANUP_AND_DEREZ) {
  278. llDie(); // You should always do this once you're finished.
  279. }
  280. }
  281. }
  282. state ready{
  283. on_rez(integer start_param){
  284. llResetScript();
  285. }
  286. state_entry() {
  287. llTriggerSound("SND_STARTING_UP", 1);
  288. debug("in ready state - touch to load quiz");
  289. integer status_prim=get_prim("status_prim");
  290. debug("statusprim: "+(string)status_prim);
  291. sloodle_translation_request(SLOODLE_TRANSLATE_HOVER_TEXT_LINKED_PRIM, [ORANGE, 1.0,status_prim], "click_to_load", [], "", "hex_quizzer");
  292. }
  293. touch_start(integer num_detected) {
  294. key user_key=llDetectedKey(0);
  295. if (quiz_loaded==FALSE){
  296. sloodle_translation_request(SLOODLE_TRANSLATE_HOVER_TEXT_LINKED_PRIM, [ORANGE, 1.0,get_prim("status_prim")], "loadingquiz", [], "", "hex_quizzer");
  297. if (!sloodle_check_access_use(user_key)) {
  298. sloodle_translation_request(SLOODLE_TRANSLATE_SAY, [0], "nopermission:use", [llKey2Name(user_key)], NULL_KEY, "");
  299. llMessageLinked(LINK_SET, SLOODLE_CHANNEL_QUIZ_NO_PERMISSION_USE, "", user_key);
  300. return;
  301. }
  302. sloodle_translation_request(SLOODLE_TRANSLATE_SAY, [0], "starting", [llKey2Name(user_key)], NULL_KEY, "quiz");
  303. /*
  304. * Tell load_quiz.lslp to load the quiz, it will do so, then pass us a message SLOODLE_CHANNEL_QUIZ_LOADED_QUIZ with all the quiz data
  305. * this data will be locked for this hex
  306. */
  307. llMessageLinked(LINK_SET, SLOODLE_CHANNEL_QUIZ_LOAD_QUIZ, "", user_key);
  308. }
  309. }
  310. link_message(integer link_set, integer channel, string str, key id) {
  311. list data= llParseString2List(str, ["|"], []);
  312. if (channel == SLOODLE_CHANNEL_OBJECT_DIALOG) {
  313. // Split the message into lines
  314. CONFIG = str;
  315. }
  316. if (channel==SLOODLE_CHANNEL_QUIZ_LOADED_QUIZ){
  317. QUIZ_DATA = str;
  318. data = llParseString2List(str, ["|"], []);
  319. quiz_id=llList2Integer(data,0);
  320. quiz_name=llList2String(data,1);
  321. num_questions=llList2Integer(data,2);
  322. question_ids=llParseString2List(llList2String(data,3), [","], []);
  323. debug("------quiz loaded: "+(string)quiz_id+" quiz name: "+quiz_name+" num questions: "+(string)num_questions);
  324. state quiz_loaded;
  325. }else
  326. if (channel == SLOODLE_CHANNEL_SET_CLEANUP_AND_DEREZ) {
  327. llDie(); // You should always do this once you're finished.
  328. }
  329. }
  330. }
  331. state quiz_loaded{
  332. on_rez(integer start_param) {
  333. llResetScript();
  334. }
  335. state_entry() {
  336. debug("********************************************************************quiz loaded");
  337. sloodle_translation_request(SLOODLE_TRANSLATE_HOVER_TEXT_LINKED_PRIM, [ORANGE, 1.0,get_prim("status_prim")], "quizloaded", [], "", "hex_quizzer");
  338. llRezObject(HEXAGON_PLATFORM, llGetPos()+<0,0,2>, ZERO_VECTOR, llGetRot(), 0);
  339. ALREADY_REZZED=TRUE;
  340. }
  341. touch_start(integer num_detected) {
  342. if (llGetListLength(QUESTIONS_ASKED)>=num_questions){
  343. //quiz finished
  344. if (doRepeat==TRUE){
  345. current_question=0;
  346. QUESTIONS_ASKED=[];
  347. }else{
  348. sloodle_translation_request(SLOODLE_TRANSLATE_IM, [0], "no_more_questions", [llDetectedName(0)], llDetectedKey(0), "hex_quizzer");
  349. return;
  350. }
  351. }
  352. //if (!ALREADY_REZZED){
  353. llRezAtRoot(HEXAGON_PLATFORM, llGetPos()+<0,0,2>, ZERO_VECTOR, llGetRot(), 0);
  354. ALREADY_REZZED=TRUE;
  355. // }
  356. }
  357. object_rez(key platform) {
  358. //a new hex was rezzed, listen to the new hex platform
  359. llListen(SLOODLE_CHANNEL_QUIZ_MASTER_REQUEST, "", platform, "");
  360. rezzed_hexes+=platform;
  361. llGiveInventory(platform, HEXAGON_PLATFORM);
  362. debug("giving platform script");
  363. //since llRemoteLoadScriptPin makes a script sleep for 3 seconds, we need to offload the remote loading of the scripts to a seperate loader script
  364. llRemoteLoadScriptPin(platform, "sloodle_translation_hex_quizzer_en",PIN, TRUE, 0);
  365. llRemoteLoadScriptPin(platform, "_platform.lslp",PIN, TRUE, 0);
  366. }
  367. link_message(integer sender_num, integer num, string str, key id) {
  368. if (num == SLOODLE_CHANNEL_SET_CLEANUP_AND_DEREZ) {
  369. integer k=0;
  370. integer len = llGetListLength(rezzed_hexes);
  371. for(k=0;k<len;k++){
  372. key hex=llList2Key(rezzed_hexes,k);
  373. llRegionSayTo(hex,SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE, "die"+HEX_CONFIG_SEPARATOR+CONFIG);
  374. }
  375. k=0;
  376. len = llGetListLength(GRAND_CHILDREN);
  377. for(k=0;k<len;k++){
  378. key hex=llList2Key(GRAND_CHILDREN,k);
  379. llRegionSayTo(hex,SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE, "die"+HEX_CONFIG_SEPARATOR+CONFIG);
  380. }
  381. llSleep(2);
  382. llDie(); // You should always do this once you're finished.
  383. }
  384. }
  385. listen(integer channel, string name, key id, string message) {
  386. list data = llParseString2List(message, ["|"], []);
  387. string command = llList2String(data, 0);
  388. debug("************************** command is: "+command);
  389. if (command=="rezzed grandchild"){
  390. debug("a grandchild.. ");
  391. key grandchild=llList2Key(data,1);
  392. llListen(SLOODLE_CHANNEL_QUIZ_MASTER_REQUEST, "",grandchild, "");
  393. if (llListFindList(GRAND_CHILDREN,[grandchild])==-1){
  394. GRAND_CHILDREN+=grandchild;
  395. }
  396. debug("\n\n\n\nYay! a grandchild! listening to "+llList2CSV(GRAND_CHILDREN));
  397. }
  398. if (channel==SLOODLE_CHANNEL_QUIZ_MASTER_REQUEST){
  399. if (command=="GET CONFIG"){
  400. debug("sending config data");
  401. llRegionSayTo(id,SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE, "receive config"+HEX_CONFIG_SEPARATOR+CONFIG);
  402. }else
  403. if (command=="LOAD QUIZ"){
  404. key user_key = llList2Key(data,1);
  405. debug("received load quiz - current question is: "+(string)current_question+ " num questions is : "+(string)num_questions);
  406. if (current_question>=num_questions){
  407. if (doRepeat==TRUE){
  408. current_question=0;
  409. QUESTIONS_ASKED=[];
  410. }else{
  411. //TODO finish quiz for all avatars
  412. sloodle_translation_request (SLOODLE_TRANSLATE_DIALOG, [1 , "Ok"], "no_more_questions" , ["Ok"], user_key , "hex_quizzer");
  413. sloodle_translation_request(SLOODLE_TRANSLATE_SAY, [0], "no_more_questions", [], user_key, "hex_quizzer");
  414. llRegionSayTo(id,SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE, "die no more questions");
  415. return;
  416. }
  417. }
  418. integer question_id = llList2Integer(question_ids,current_question);
  419. QUESTIONS_ASKED+=question_id;
  420. current_question++;
  421. debug("sending quiz data");
  422. debug("sending: "+"receive quiz data"+HEX_CONFIG_SEPARATOR+QUIZ_DATA+"|"+(string)question_id+"|"+(string)current_question);
  423. llRegionSayTo(id,SLOODLE_CHANNEL_QUIZ_MASTER_RESPONSE, "receive quiz data"+HEX_CONFIG_SEPARATOR+QUIZ_DATA+"|"+(string)question_id+"|"+(string)current_question);
  424. }
  425. }
  426. }
  427. }