Here is a little simple script, that
will display a random question out of
a list of questions when pressing space.
Could be optimized using pointer arrays.
But I hope you will get the basic point behind it.
font ArialFont = "Arial", 1, 14;
Text Qustion_display
{
font = ArialFont;
layer = 3;
pos_x = 10;
pos_y = 10;
offset_y = 0;
strings = 1;
flags = visible;
}
string question_0="Are you smart?";
string question_1="Do you want to....?";
string question_2="11111";
string question_3="22222";
string question_4="33333";
string question_5="blabla";
string* the_question;
function select_question(number)
{
if(number==0){the_question=question_0;}
if(number==1){the_question=question_1;}
if(number==2){the_question=question_2;}
if(number==3){the_question=question_3;}
if(number==4){the_question=question_4;}
if(number==5){the_question=question_5;}
}
function display_question
{
select_question(int(random(6))); //chooses a random question between 0 and 5
Qustion_display.string[0]=the_question; //write the questionstring into the textpanel
}
on_space display_question();