while循环
作者:梦翔儿 日期:2007-7-23 17:13:00

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

  • 标签:while second life 
  • 发表评论:

      大名:
      密码: (游客无须输入密码)
      主页:
      标题:
    Powered by Oblog.