From 0e81a91664eabc64a38765392960405218e9a8f1 Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 19 Nov 2017 16:10:04 -0500 Subject: fix the stranger quiz --- world/map/npc/functions/quiz.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'world/map/npc/functions/quiz.txt') diff --git a/world/map/npc/functions/quiz.txt b/world/map/npc/functions/quiz.txt index 0f2f7c87..3deddd0a 100644 --- a/world/map/npc/functions/quiz.txt +++ b/world/map/npc/functions/quiz.txt @@ -5,10 +5,10 @@ function|script|MultiQuiz { - if((getarraysize(@quiz_answers$) != getarraysize(@quiz_questions$)) || + if((getarraysize(@quiz_answers$[0]) != getarraysize(@quiz_questions$[0])) || (@quiz_answers$[0] == "") || (@quiz_questions$[0] == "")) goto L_ArrayError; set @setindex, 1; - set @index, rand(0,(getarraysize(@quiz_answers$) - 1)); + set @index, rand(0,(getarraysize(@quiz_answers$[0]) - 1)); set @question$, @quiz_questions$[@index]; mes "\""+ @question$ + "\""; next; @@ -19,25 +19,24 @@ function|script|MultiQuiz L_ArrayError: if(@quiz_answers$[0] == "") debugmes "@quiz_answers$ is empty"; if(@quiz_questions$[0] == "") debugmes "@quiz_questions$ is empty"; - if(getarraysize(@quiz_answers$) != getarraysize(@quiz_questions$)) debugmes "Size of @quiz_answers$ is not equal to size of @quiz_questions$"; - mapexit; + if(getarraysize(@quiz_answers$[0]) != getarraysize(@quiz_questions$[0])) debugmes "Size of @quiz_answers$ is not equal to size of @quiz_questions$"; + close; } function|script|Quiz { if((@choices_nr < 1) || (@choices_nr > 8)) set @choices_nr, 3; - if(@choices_nr > getarraysize(@quiz_answers$)) set @choices_nr, getarraysize(@quiz_answers$); + if(@choices_nr > getarraysize(@quiz_answers$[0])) set @choices_nr, getarraysize(@quiz_answers$[0]); if(@quiz_answers$[0] == "") goto L_ArrayError; set @success, 0; if(@setindex < 1) set @index, @answer; set @good, rand(0,(@choices_nr - 1)); - setarray @choices$, ""; - cleararray @choices$, "", getarraysize(@choices$); + cleararray @choices$, "", getarraysize(@choices$[0]); set @loop, 0; goto L_Shuffle; L_Shuffle: - set @nindex, rand(0,(getarraysize(@quiz_answers$) - 1)); + set @nindex, rand(0,(getarraysize(@quiz_answers$[0]) - 1)); if(@nindex == @index) goto L_Shuffle; // do not get the good definition set @loop2, 0; goto L_Search; -- cgit v1.2.3-60-g2f50