X-Flight, Carbon Rod X(2)

Expired

Flight Script needs 2 notecards along with the script in a prim to work and are included after the script:

//X-flight script for increased flying speed and control
//Developed by Goodwill Epoch on 6/12/2003
//Revision 1.9a
//For explicit use only by members of the Kazenojin Airship guild
//
//May be sold with explicit permission from Goodwill Epoch to non-members
//Settings must be set to no-modify no view to prevent theft of script
//script may not be modified without permission from Goodwill Epoch

//List of customizable commands
list commands = ["X", "go", "stop", "status", "speed", "accel", "pos", "accelmode", "turnmode", "hovermode", "posmode"];

//Help for commands
list com_help = ["Trigger for any commands to be entered", "Enable flight enhancements", "Disable flight enhancements", "List current modes and their state", "Current impulse, place a number after to set. limit 1-500", "Current acceleration, place a number after to set. limit 10-100",  "Current coordinates", "Acceleration of movement. Use 'on' or 'off' to set.", "Slow down while turning. Use 'on' or 'off' to set.", "Allows hovering at all heights. Use 'on' or 'off' to set.", "Displays position over object. Use 'on' or 'off' to set."];

//Default movement variables
float speed = 200;
float accel = 25;
float move = 0;
float attached = 0;

//Counters and temp variables
float accel_count = 0;
string temp_newcommand;
integer temp_newcom_pos;
integer wait_for_conf = FALSE;
integer test_move = FALSE;

//Simplified say strings
string off = "off";
string on = "on";

//Default settings
integer accelmode = TRUE;
integer turnmode = TRUE;
integer hovermode = TRUE;
integer posmode = FALSE;

//Other variables
integer listen_num;
string notecard = "X-Flight enhanced flight info";
string notehelp = "X-Flight enhanced flight help";

//Returns a on/off string from a true/false pass
string on_off(integer test)
{
    if(test)
    {
        return on;
    }
    else
    {
        return off;
    }
}

//Returns a true/fals from an on/off string
integer true_false(string test)
{
        if(test == on)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

//Help menu handler
help()
{
    llSay(0, "Current help");
    integer a;
    for(a = 0; a , 0);
    llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}

//Handle Commands
com_handle(integer com_num, string message)
{
    if(com_num == 1) //Go
    {
        get_controls();
    }
    else if(com_num == 2) //Stop
    {
        llReleaseControls();
        llSay(0, "All stop");
    }
    else if(com_num == 3) //Status
    {
        llSay(0, "Current settings:");
        llSay(0, llList2String(commands, 4) + " - " + (string)((integer)speed));
        llSay(0, llList2String(commands, 5) + " - " + (string)((integer)accel));
        llSay(0, llList2String(commands, 7) + " - " + on_off(accelmode));
        llSay(0, llList2String(commands, 8) + " - " + on_off(turnmode));
        llSay(0, llList2String(commands, 9) + " - " + on_off(hovermode));
        llSay(0, llList2String(commands, 10) + " - " + on_off(posmode));
    }
    else if(com_num == 4) //Speed
    {
        float tempvar = (integer)message;
        if((tempvar > 0) && (tempvar <= 500))
        {
            speed = tempvar;
            llSay(0, llList2String(commands, com_num) + " is now " + (string)((integer)speed));
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + (string)((integer)speed));
        }
    }
    else if(com_num == 5) //Acceleration
    {
        float tempvar = (integer)message;
        if((tempvar >= 10) && (tempvar <= 100))
        {
            accel = tempvar;
            llSay(0, llList2String(commands, com_num) + " is now " + (string)((integer)accel));
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + (string)((integer)accel));
        }
    }
    else if(com_num == 6) //current pos
    {
        vector pos = llGetPos();
        llSay(0, "<" + (string)((integer)pos.x) + ", " + (string)((integer)pos.y) + ", " + (string)((integer)pos.z) + ">");
    }
    else if(com_num == 7) //Acceleration mode
    {
        if((message == "off") || (message == "on"))
        {
            accelmode = true_false(message);
            llSay(0, llList2String(commands, com_num) + " is now " + message);
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + on_off(accelmode));
        }
    }
    else if(com_num == 8) //Turning mode
    {
        if((message == "off") || (message == "on"))
        {
            turnmode = true_false(message);
            llSay(0, llList2String(commands, com_num) + " is now " + message);
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + on_off(turnmode));
        }
    }
    else if(com_num == 9) //Hover Mode
    {
        if((message == "off") || (message == "on"))
        {
            hovermode = true_false(message);
            llSay(0, llList2String(commands, com_num) + " is now " + message);
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + on_off(hovermode));
        }
        
    }
    else if(com_num == 10) //Position display mode
    {
        if((message == "off") || (message == "on"))
        {
            posmode = true_false(message);
            llSay(0, llList2String(commands, com_num) + " is now " + message);
        }
        else
        {
            llSay(0, llList2String(commands, com_num) + " is currently " + on_off(posmode));
        }
    }
}

//Check for flight and altitude for hover
set_flight()
{
    vector pos = llGetPos();
    float ground = llGround(<0,0,0>);
    if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
    {
        move = 1;
        if(hovermode && ((pos.z > 55) && (pos.z > (ground + 35))))
        {
            llSetForce(<0,0,9.8> * llGetMass(), FALSE);
        }
        else
        {
            llSetForce(<0,0,0>, FALSE);
        }
    }
    else
    {
        move = 0;
        llSetForce(<0,0,0>, FALSE);
    }
    // Display position over object if position mode is on
    if(posmode)
    {
        llSetText("<" + (string)((integer)pos.x) + ", " + (string)((integer)pos.y) + ", " + (string)((integer)pos.z) + "> \n \n \n", <1 ,1,1>, 1);
    }
    else
    {
        llSetText("", <0,0,0>, 0);
    }
}

//Handle Listen Messages
listen_handler(string message)
{
    list lst_msg = llParseString2List(message, [" "],[]);
    if(llList2String(lst_msg, 0) == llList2String(commands, 0))
    {
        wait_for_conf = FALSE;
        if(llList2String(lst_msg, 1) == "help")   //If help pass to help
        {
            help();
        }
        //If customize pass to customize
        else if(llList2String(lst_msg, 1) == "customize")  
        {
            customize(llList2String(lst_msg, 2), llList2String(lst_msg, 3));
        }
        //If reset reset script
        else if(llList2String(lst_msg, 1) == "reset")  
        {
            llSay(0, "Reseting Script");
            llResetScript();
        }
        //Pass to command handler if a command
        else
        {
            integer listpos = llListFindList(commands, llList2List(lst_msg, 1, 1));
            if(listpos != -1)
            {
                com_handle(listpos, llList2String(lst_msg, 2));
            }
        }
    }
    //If Response to customize, confirm
    else if((llList2String(lst_msg, 0) == "yes") && wait_for_conf)  
    {
        llSay(0, "Changing command to " + temp_newcommand);
        commands = llDeleteSubList(commands, temp_newcom_pos, temp_newcom_pos);
        commands = llListInsertList(commands, [temp_newcommand], temp_newcom_pos);
    }
    else
    {
        wait_for_conf = FALSE;
    }
}

control_handler(integer levels, integer edges)
{
    test_move =TRUE;
    accel_count ++;
    if(accel_count > accel)
    {
        accel_count = accel;
    }
    float acc_percent = 1;
    if(accelmode)
    {
        accel_count ++;
        if(accel_count > accel)
        {
            accel_count = accel;
        }
        acc_percent = accel_count / accel;
    }
    float turning = 1;
    vector impulse = <0,0,0>;
    if (levels & CONTROL_UP)
    {
        impulse += <0,0,speed>;
    }
    if (levels & CONTROL_DOWN)
    {
        impulse += <0,0,-speed>;
    }
    if (levels & CONTROL_FWD)
    {
        impulse += ;
    }
    if (levels & CONTROL_BACK)
    {
        impulse += <-speed,0,0>;
    }
    if (levels & CONTROL_LEFT)
    {
        impulse += <0,speed,0>;
    }
    if (levels & CONTROL_RIGHT)
    {
        impulse += <0,-speed,0>;
    }
    if (levels & CONTROL_ROT_RIGHT)
    {
        if(turnmode)
        {
            turning = 0;
        }
    }
    if (levels & CONTROL_ROT_LEFT)
    {
        if(turnmode)
        {
            turning = 0;
        }
    }
    llApplyImpulse((vector)(impulse * move * turning * acc_percent), TRUE);
}

//Default State, sets up basic listens, and events
default
{
    state_entry()
    {
        get_controls();
    }
    
    on_rez(integer param)
    {
        get_controls();
    }

    listen(integer channel, string name, key id, string message)
    {
        listen_handler(message);
    }
    
    control(key id, integer levels, integer edges)
    {
        control_handler(levels, edges);
    }

    timer()
    {
        set_flight();
        if(!test_move)
        {
            accel_count = -1;
        }
        test_move = FALSE;
    }

    //Detect touch, if not owner then give info. If owner display help.
    touch(integer total_touched)
    {
        integer a = 0;
        key toucher;
        for(a = 0; a 
X-Flight enhanced flight help notecard:

X-Flight enhanced flight script help file
ver 1.98e

Basic help for commands:

   "X" - Trigger for any commands to be entered
   "go" - Enable flight enhancements
   "stop" - Disable flight enhancements
   "status" - List current modes and their state
   "speed" - Current impulse, place a number after to set. limit 1-500
   "accel" - Current acceleration, place a number after to set. limit 10-100
   "pos" - Current coordinates
   "accelmode" - Acceleration of movement. Use 'on' or 'off' to set.
   "turnmode" - Slow down while turning. Use 'on' or 'off' to set.
   "hovermode" - Allows hovering at all heights. Use 'on' or 'off' to set.
   "posmode" - Displays position over object. Use 'on' or 'off' to set.
   "customize" - Allows you to customize certain commands. 'X customize [old command] [new command]' Be sure to use full words without spaces for commands. You will then need to type 'yes' to confirm.
   "reset" - Resets entire script. WARNING: Will erase all customize data and settings.
   
   Default settings are:
   Speed = 200
   Accel = 25
   Acceleration mode = On
   Turning mode = On
   Hover mode = On
   Pos mode = Off

Created by Goodwill Epoch.
Please IM Goodwill Epoch if you have any questions or special requests for this script!

 

X-Flight enhanced flight info Notecard:

X-Flight enhanced flight script

Current Features now include:

Faster flying speeds
Acceleration to allow better control
Allows slowing down when turning for sharper corners at high speeds
Realtime updates on position
HOVER AT ALL ALTITUDES!!
Customizable options and commands


X-Flight enhanced items will be available at both the Kazenojin base of operations an Skeedalee Skidoo's mall.


Created by Goodwill Epoch.
Admiral of Kazenojin

Flight Assist

Expired

//
// Flight Assist Example
//
// Highlights:
//    - altitude-based assist (lower altitude == less assist, higher == more)
//    - horizontal movement gets relatively less assist than vertical.
//    - HUD color indication of movement mode
//      - brown: not flying (i.e. earth)
//      - green: flying w/ assist
//      - white: hovering w/ assist
//      - black: assist disabled


// gAssistParams enables altitude-based flight assist.   Lower altitudes
// will get less momentum assist so that the client updating overhead
// is less likely to harm controllability.  Plus it's a pain to collide
// with a building at high speed in a damage-enabled area.
//
// see increaseMomentumAssist() for more info
//
list    gAssistParams = [ <1 .1, 100, 200>, <1 .25, 1000, 800>, <1 .4, 10000, -1> ];
float   gInc = 0.1; // The increment to add to the momentum assist parameter on the next control key event
float   gMass;      // current mass (assuming it's constant; can imagine a variable mass assist tho :-) )
integer gMotor = FALSE; // Indicates whether momentum assistance is on
integer gAgentInfo; // A bitmask of the agent/avi current state
integer gReqKeys;  // A bitmask of the control keys required to operate
integer gReqPerms; // A bitmask of the required permissions to operate
key     gWearer;   // UUID of the avi who is wearing this attachment

float   gMomentumAssist = 0; // The current applied momentum assist
float increaseMomentumAssist(vector pos)
{
    integer iii;
    integer len;

    len = llGetListLength(gAssistParams);
    vector aParams;
    for (iii = 0; iii *llGetCameraRot(); // camera rotation leads forward direction; so use it to direct assist
    ret.z = 0;

    return llVecNorm(ret);
}

getPermissions()
{
    integer hasPerms = llGetPermissions();
    integer askPerms = (~hasPerms) & gReqPerms;
    if (hasPerms & PERMISSION_TAKE_CONTROLS)
    {
        llTakeControls(gReqKeys, TRUE, TRUE);
    }
    if (askPerms)
    {
        llRequestPermissions(gWearer, askPerms);
    }
}

gotControlInput(integer held)
{
    gAgentInfo = llGetAgentInfo(gWearer);
        
    if (!(held & gReqKeys))
    {
        if (gAgentInfo & AGENT_FLYING)
        {
            state hover;
        }
    }

    if (gAgentInfo & AGENT_FLYING)
    {
        if (held & gReqKeys)
        {
            vector p = llGetPos();
            vector dir;
            float assist;
            
            assist = increaseMomentumAssist(p);
            
            if (p.z > llGround(ZERO_VECTOR)+50.0)
            {
                llSetBuoyancy(1.0);
            }
            else
            {
                // For some reason, if you are below
                // llGround()+50.0 meters, you will
                // slowly rise to that height if you
                // llSetBuoyancy(1.0).  An avatar can maintain
                // hover below this height w/o assist; so
                // no buoyancy change.
                llSetBuoyancy(0.0);
            }
            
            if (held & CONTROL_FWD)
            {
                dir = getForwardDir();
                // flying too fast horizontally
                // typically makes the avatar
                // uncontrollable since lag is
                // high due to heavy updates;
                // Do a simple reduction of assist
                assist /= 3.0;
            }
            else if (held & CONTROL_BACK)
            {
                dir = -getForwardDir();
                assist /= 3.0;
            }
            else if (held & CONTROL_UP)
            {
                dir = <0,0,1>;
            }
            else if (held & CONTROL_DOWN)
            {
                dir = <0,0,-1>;
            }
                
            llPushObject(gWearer, assist*gMass*dir, ZERO_VECTOR, FALSE);
                
            gMotor = TRUE;
        }
    }
}

onAttach(key avatar)
{
    gWearer = avatar;
    if (gWearer != NULL_KEY)
    {
        getPermissions();
    }
}

default
{
    state_entry()
    {
        gReqKeys = CONTROL_FWD | CONTROL_UP | CONTROL_DOWN | CONTROL_BACK;
        gReqPerms = PERMISSION_TRACK_CAMERA|PERMISSION_TAKE_CONTROLS;
        gMass = llGetMass();
        llSetColor(<0,1,0>, ALL_SIDES);

        // Check if HUD is already attached
        gWearer = llGetOwner(); // for now
        if (llGetAttached() != 0)
        {
            getPermissions();
        }

        llSetTimerEvent(0.1);
    }

    on_rez(integer param)
    {
        llResetScript();
    }
 
    attach(key agent)
    {
        onAttach(agent);
    }
    
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(gReqKeys, TRUE, TRUE);
        }
        else
        {
            llWhisper(0, "The flight assist will not operate properly");
        }

        if (!(perm & PERMISSION_TRACK_CAMERA))
        {
            llWhisper(0, "The flight assist will not operate properly");
        }
    }
    
    touch_start(integer num)
    {
        state disabled;
    }

    control(key owner, integer held, integer change)
    {
        gotControlInput(held);
    }
    
    timer()
    {
        gAgentInfo = llGetAgentInfo(gWearer);
        
        if (!(gAgentInfo & AGENT_FLYING))
        {
            state landed;
        }
    }
}

state hover
{
    state_entry()
    {
        llSetColor(<1 ,1,1>, ALL_SIDES);

        gMotor = FALSE;
        gMomentumAssist = 0;
        gInc   = 0.1;
        // adjust a little for lag
        llMoveToTarget(llGetPos(), 0.1);
        vector pos = llGetPos();
        // you can hover unassisted at ground level + 50 meters
        // in fact, if you set buoyancy to 1.0 there, you will slowly
        // rise to ground level + 50 meters
        if (llGround(ZERO_VECTOR)+50.0 , ALL_SIDES);
        llSetTimerEvent(0.3);
    }

    on_rez(integer param)
    {
        llResetScript();
    }
 
    touch_start(integer num)
    {
        state disabled;
    }

    timer()
    {
        gAgentInfo = llGetAgentInfo(gWearer);

        if (gAgentInfo & AGENT_FLYING)
        {
            state default;
        }
    }
}

state disabled
{
    state_entry()
    {
        llSetBuoyancy(0.0);
        llStopMoveToTarget();    // just in case
        llSetColor(<0,0,0>, ALL_SIDES);
    }

    on_rez(integer param)
    {
        llResetScript();
    }
 
    touch_start(integer num)
    {
        state landed;
    }
}

 

Multi Speed Flight Assist

Expired

Here is a much requested script that enhances fly. Drop this script in any attachment that does not have a script in it (maybe your prim hair or something). It enhances fly in two ways

1. you can fly as high as you like and you should not drift down (much, it is not perfect).

2. say the word "fly" and it changes into a much faster flying mode. In this mode you can also say "speed 30" to double your speed (or any number, default is 15). say "fly" again, or just stop flying to get out of this mode. One annoying bug, when in fast fly mode you will see "release keys" button. If you push it, your attachment comes off.

// Script Name: Assisted_Flight.lsl
// Author: Ariane Brodie
// Multiple Speed Flight
// Downloaded from : http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1318
// This program is free software; you can redistribute it and/or modify it.
// Additional Licenes may apply that prevent you from selling this code
// You must leave any author credits and any headers intact in any script you use or publish.
///////////////////////////////////////////////////////////////////////////////////////////////////
// If you don't like these restrictions and licenses, then don't use these scripts.
//////////////////////// ORIGINAL AUTHORS CODE BEGINS ////////////////////////////////////////////
// Here is a much requested script that enhances fly. Drop this script in any attachment that does not have a script in it (maybe your prim hair or something).
//
//It enhances fly in two ways 1. you can fly as high as you like and you should not drift down (much, it is not perfect). 2. say the word "fly" and it changes into a much faster flying mode. In this mode you can also say "speed 30" to double your speed (or any number, default is 15). say "fly" again, or just stop flying to get out of this mode. One annoying bug, when in fast fly mode you will see "release keys" button. If you push it, your attachment comes off.
//ZeroFlight XLR8
//hacked together script by Burke Prefect, peices from other people's code.
//NOT RESPONSIBLE... FOR ANYTHING
float speed = 15; // this is starting speed.
set_hover() // this keeps you from falling at extreme altitudes. just 'fly' normally. works in either mode.
{
    vector pos = llGetPos();
    float ground = llGround(<0,0,0>);
    if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
    {
        if((pos.z > 75) && (pos.z > (ground + 35)))
        { 
            llSetForce(<0,0,9.8> * llGetMass(), FALSE);
        }
        else
        {
            llSetForce(<0,0,0>, FALSE);
        }
    }
    else
        {
            llSetForce(<0,0,0>, FALSE);
        }
}
default // this is where the script starts off. it's not active, it's just waiting for a command.
{
    state_entry()
    {
    key id = llGetOwner();
    llListen(0,"",id,"");
    llSetTimerEvent(.5);
    llReleaseControls();
    }
    timer()
    {
        set_hover();
    }
    
    listen( integer channel, string name, key id, string message ) {
        
        if (message == "fly")
            state freakpack;  
    }
}
    
//// By making 'freakpack' it's own state, we can control it much easier. 
state freakpack
{
    state_entry()
    {
        llSetTimerEvent(.5);
        llListen(0,"",llGetOwner(),"");
        llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);  
    }
    
    // on_rez(integer total_number)
    //{llResetScript();}
    
    touch_start(integer total_number)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            llReleaseControls();  
            state default;
        }
    }
     timer()
    {
     set_hover();   
    }
    
    run_time_permissions(integer perm)
    {
         if(perm & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(CONTROL_FWD|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT|CONTROL_UP|CONTROL_DOWN,TRUE,TRUE);
        }
    }
    
    control(key av, integer level, integer edge)
    {
         if(level & CONTROL_UP)
        {
            llApplyImpulse(<0,0,speed*3>,FALSE);
        }
         if(level & CONTROL_DOWN)
        {
            llApplyImpulse(<0,0,-speed*3>,FALSE);
        }
          if(level & CONTROL_LEFT)
        {
         if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
            {   llApplyImpulse(<0,speed,0>,TRUE);}
        }
          if(level & CONTROL_RIGHT)
        {
            if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
            {llApplyImpulse(<0,-speed,0>,TRUE);}
        }
         if(level & CONTROL_FWD)
        {
            if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
            {llApplyImpulse(,TRUE);}
        }
         if(level & CONTROL_BACK)
        {
            if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
            {llApplyImpulse(<-speed,0,0>,TRUE);}
        }
    }
    
    timer()
    {
        if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
            set_hover();
        
        else {
            llReleaseControls();  
            state default;
        }
    }
    
    changed(integer change)
    {
        llReleaseControls();  
        state default;
    }
    
    listen(integer channel, string name, key id, string m)
    {
        string ml = llToLower(m);
        list parsed = llParseString2List(ml,[" "],[]);
        if(llList2String(parsed,0) == "speed")
        {
            speed = (float)llList2String(parsed,1);
        }
         if (m=="fly")
        {
            llReleaseControls();
            state default;
        }
    }
}