Pendulum Script

From The SchomEmunity Wiki
Jump to: navigation, search
rotation a;
float x;

default
{
    state_entry()
    {
        a=llGetRot();
        llSay(0,(string)a);
        llSetStatus(STATUS_ROTATE_X,FALSE);
        llSetStatus(STATUS_ROTATE_Y,FALSE);
    }

    touch_start(integer total_number)
    {
        llSay(0,"touched");
        llSetRot(<0.5,0.5,0.5,0.5>);
        llSetStatus(STATUS_PHYSICS,TRUE);
        while(1==1) {
        rotation b=llGetRot();
            x=b.x;
        if(x>=-0.01&&x<=0.01) jump ti;
                    }
        @ti;
        integer i;
        integer h;
        list t=["test"];
        llResetTime();
        while(1==1) {
            rotation c=llGetRot();
            x=c.x;
        if(x>=-0.005&&x<=0.005) {
            llSay(0,(string)llGetTime());
            t=t+[(float)llGetAndResetTime()];
            h++;
        if(h==50) jump Say;
            
                                    }
                            }
@Say;
        integer p;
        integer l=llGetListLength((list)t);
            for(p=0; p==l; p++) 
        llSay(0,(string)llList2String(t,p));
        
    }
}