default
{
state_entry()
{
llSetText("While loop\ntouch to start loop",<1,1,1>,1);//say what this does
}
touch_start(integer total_number) // when touched
{
integer counter = 0; //set counter to 0
while(counter<=10) //start loop with condition that coubnter is smaller than or equal to 10
{
counter = counter+1; //increase counter by1
llSetText((string)counter,<1,1,1>,1); //set text showing the counter
llSleep(.5); //slow down the loop by waiting .5 s
}
llResetScript(); //when done with loops,reset script
}
}
//when someone clicks on the object it will count to ten,with one second in between