Fancy Skate Script

This will need a skate animation :D

string gAnimName = "skate012";
float gStopTimeout = 1.0;

integer gInTimeout;


default
{
    state_entry()
    {
        //llSay(0, "Hello, Avatar!");
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS | PERMISSION_ATTACH );
        gInTimeout = FALSE;
    }

    //touch_start(integer total_number)
    //{
    //    llSay(0, "Touched.");
    //}

    run_time_permissions(integer perms) {
        llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, TRUE);
    }

    on_rez(integer param) {
        llResetScript();
    }    
    control(key name, integer levels, integer edges) {
        //llSay(0, "control");
        if (edges & levels & (CONTROL_FWD | CONTROL_BACK)) {
            //llSay(0, "Debug: on");
            llStartAnimation(gAnimName);
            gInTimeout = FALSE;
            llSetTimerEvent(gStopTimeout/2);
        }
        
        if (edges & ~levels & (CONTROL_FWD | CONTROL_BACK)) {
            //llSay(0, "Debug: off");
            //llStopAnimation(gAnimName);
            gInTimeout = TRUE;
            llSetTimerEvent(gStopTimeout);
        }
    }

    timer() {
        //llSay(0,"Timer");
        if (gInTimeout) {
            //llSay(0,"intimeout");
            llStopAnimation(gAnimName);
            llSetTimerEvent(0.0);
        }        
        else {
            //llSay(0,"notintimeout");
            llStartAnimation(gAnimName);
        }            
    }            
                                    
    attach(key id) {
        //llSay(0, "ok...");
        integer perm = llGetPermissions();
        
        if (id != NULL_KEY) {
            //llSay(0, "yep...");
            if (! (perm & PERMISSION_TRIGGER_ANIMATION & PERMISSION_TAKE_CONTROLS)) {
                llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | 
                                                   PERMISSION_TAKE_CONTROLS |
                                                   PERMISSION_ATTACH);
            }
        }
        else {
            //llSay(0, "nope...");
            if (perm & PERMISSION_TRIGGER_ANIMATION) {
                llStopAnimation(gAnimName);   
            }         
        }
    }

}

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool