Second Life Copybot
Flight Script - Final Flight 2.2 - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Avatar Augmentation Scripts (https://secondlifecopybot.com/forum-51.html)
+----- Thread: Flight Script - Final Flight 2.2 (/thread-8127.html)



Flight Script - Final Flight 2.2 - machinecode - 09-19-2014

Put in a prim and wear.

[To see links please register here]


PHP Code:
//Final Flight 2.2
 
float speed=10000;
 
default
{
    
attach(key on)
    {
        if (
on != NULL_KEY)
        {
            
llListen(0,"",llGetOwner(),"");
            
integer perm llGetPermissions();
            if (
perm != (PERMISSION_TAKE_CONTROLS))
            {
                
llRequestPermissions(onPERMISSION_TAKE_CONTROLS);
            }
            else
            {
                
llTakeControls(CONTROL_FWD TRUETRUE);
            }
        }
    }
 
    
listen(integer channelstring namekey idstring m)
    {
        list 
test llCSV2List(m);
        if(
llGetListLength(test)==2&&llList2String(test,0)=="speed")
            
speed=llList2Float(test,1);
    }
 
    
run_time_permissions(integer perm)
    {
        if (
perm)
        {
            
llTakeControls(CONTROL_FWDTRUETRUE);
        }
    }
 
    
control(key ownerinteger levelinteger edge)
    {
        if (!(
level CONTROL_FWD) || !(llGetAgentInfo(llGetOwner())&AGENT_FLYING))
        {
            
llSetForce(<0,0,0>, FALSE);
        }
        else
        {
            
vector fwdllRot2Fwd(llGetRot());
            
fwd llVecNorm(fwd);
            
fwd *= speed;
            
llSetForce(fwdFALSE);
        }
    }