SL Scripter comments, is this accurate

Creating scripts
Jean Swashbuckler
Posts: 39
Joined: Wed Oct 30, 2013 1:23 pm
Has thanked: 62 times
Been thanked: 48 times

Re: SL Scripter comments, is this accurate

Post by Jean Swashbuckler »

Graham Mills wrote:I have to say that my favourite scripting difference between SL and Kitely is the ability in OSSL to create rather than just read notecards.
Graham, please help me understand OSSL. I will definitely look it up for the detail but if you can give me the quick cliff notes that would be appreciated.
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Re: SL Scripter comments, is this accurate

Post by Sherrie Melody »

Marstol Nitely wrote:
Sherrie Melody wrote:I do have a boat script that uses the LSL vehicle functions. You sit in the boat (not wear it) and then drive it and it does works.
Are you selling your boat script Sherrie? If you are, I'd love to buy it. The only boat script I've found that works sinks my boats after I take a ride.
Nope, not selling it, LOL. It's only "mine" in the sense that I have it in my inventory :D

It's on the vehicles page on the opensim website: http://opensimulator.org/wiki/Vehicles

There are two scripts on that page, the top one is for a car I think. The second one is a modified version by Hiro Protagonist to function as a simple boat. That's the one I have. You use your arrow keys (up, down, left, right) to drive the boat.

If I remember correctly, the script should go in the root prim of the boat. Note that the size and position of the root prim will determine how high the boat sits on the water. If, as I did at first, you for example put the script in the driver's seat, the sit position might be good but the boat will probably sit too low in the water.

The script sets a sit position for the person driving the boat, so you may need to adjust that so that you are sitting in the correct spot.

Stay away from the edges of your world and stay in waters deep enough for the boat, and you should be good.

It could definitely be improved:
After turning left or right, sometimes the boat doesn't return to level. I think the script could be modified to detect release of controls, and right itself.
It could be modified to allow for additional passengers. Right now, it just checks whether an avatar has sat, doesn't care where, assumes it is the driver.
These users thanked the author Sherrie Melody for the post:
Marstol Nitely
User avatar
Boo Rojyo
Posts: 29
Joined: Wed Sep 04, 2013 7:47 pm
Has thanked: 60 times
Been thanked: 38 times

Re: SL Scripter comments, is this accurate

Post by Boo Rojyo »

I've got a working boat and a working flying vehicle (physics not the 'wear' one I sell), that I brought over from osgrid and adapted. Drop by Booland and give them a try by all means. They have been a bit of a fiddle to reconstruct here and make to work properly, but are pretty stable.
These users thanked the author Boo Rojyo for the post (total 2):
Marstol NitelyJean Swashbuckler
User avatar
Constance Peregrine
Posts: 2352
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2780 times
Been thanked: 1487 times

Re: SL Scripter comments, is this accurate

Post by Constance Peregrine »

Code: Select all

//############################ OpenSim - Physical Boat Script v2.1 ###############################


//---------------------- Set Aktion-Range here (Simborder-crossing Protection) -------------------

integer EN = 1; // Switcher:  EN = 1 (enables Protection),  EN = 0 (disables Protection)
integer RX = 1; // how many Regions in X-Direction (West  to East)  default for single Region is 1
integer RY = 1; // how many Regions in Y-Direction (South to North) default for single Region is 1
integer VL =10; // Minimum Distance to a Simborder (is one length of the Vehicle in Meters)
float   HH =21; // Hoverhigh of the Vehicle in Meters ( default is Waterhigh + 1 Meter)

//------------------------------------------------------------------------------------------------


//
// GLOBAL VARIABLES FOR PILOT SEATING AND CAMERA VIEWPOINT
//
string PILOT_ANIM = "cartdriver3";       // current Sit-Animation (must be in Vehicle Content)
vector SIT_POSITION =<-0.65, 1.7, -0.63> ; // position of pilot on sit prim
vector SIT_ROTATION = <0, 0, 90>;        // rotation of pilot on sit prim
integer Private = 0;                     // 1= Owner Only Pilot. 0= Anyone can be Pilot.
float CAM_ZOOM  = 12.0;                  // How far back the pilot's camera follows
float CAM_ANGLE = 12.0;                  // Vertical angle pilot's camera follows
float CZ;
//
// GLOBAL VARIABLES FOR TEXT & DIALOG
//
string sit_message = "Ride !";
string not_owner_message = "Sorry. You are not the owner.";
string TITLE="Speedboat";
string StartUpText = "  Use Arrows:    Fwd/Rew,  Left/Right,  PageUp/Down";
//
// GLOBAL VARIABLES FOR VEHICLE MOTION
//
integer hps = 4;                         // Minimum horizontal Power-Rate
float hpm = 32;                          // Maximum horizontal Power-Rate
float hpr = 4;                           // Power change Factor
float hp; 
float hp_old; 
float vmin = 0.75;                       // minimum Hoverhigh over Water
float Curveangl = 7.5;                   // Angle of Vihicle at Curves
float angz = 0.5;                        // Sharpness of turns/curves (practical values 0.5 to 1.0)
float angz_low = 0.2;
float angz_high = 0.5;
//
//  GLOBAL VARIABLES FOR PARTICLES
//
vector  HE_start_color = <1.0, 1.0, 1.0>;
vector  HE_end_color;
float   HE_start_alpha = 1.0;
float   HE_end_alpha;
vector  HE_start_scale;
vector  HE_end_scale;
string  HE_texture      = "Light Flare";
float   HE_source_max_age = 0.0;
float   HE_particle_max_age;
float   HE_burst_rate = 0.0;
integer HE_burst_particle_count;
float   HE_burst_radius = 0.25;
float   HE_angle_begin = 0;
float   HE_angle_end = 20 * DEG_TO_RAD;
float   HE_speed_min;
float   HE_speed_max; 
//------------------------------------
integer H_dir = 1; // Indicator for Vihicle Horizontal moving Back = -1 or FWD = 1 or stop = 0
float HS;
integer HPC;
//
//  GENEREL GLOBAL VARIABLES  (DO NOT CHANGE !!!)
//
float ALTITUDE;
vector ANGULAR_MOTOR;
integer RUN;
key AVATAR;
float SPEED;
float OFFSET;
integer HELD;
integer P;
integer H_Gear;
float SB;
float HGfac = 2.0;
float PXY_S;
integer ME = 1;
integer dir;                  // Indicator for Vehicle Direction FWD/BACK used at XYrotation
float HF = DEG_TO_RAD * 90;
float HB = DEG_TO_RAD * 270;
float L2;

//----------------------------------- Subroutines ----------------------------------------

  
MOVE_ENABLE_FWD()
{
 vector R_Pos = llGetPos(); vector R_Rot = llRot2Euler(llGetRot()); float AZ = R_Rot.z * RAD_TO_DEG;
 float sin = llFabs(llSin(R_Rot.z)); float cos = llFabs(llCos(R_Rot.z));
 
 float PXL = VL + PXY_S * sin; float PXH = RX * 256 - (VL + PXY_S * sin);
 float PYL = VL + PXY_S * cos; float PYH = RY * 256 - (VL + PXY_S * cos);
 
 if((AZ >= 0) && (AZ < 90))
 {
  if((R_Pos.x <= PXL) || (R_Pos.y >= PYH)) {ME = 0;}
 }
 
 if(AZ >= 90)
 {
  if((R_Pos.x <= PXL) || (R_Pos.y <= PYL)) {ME = 0;}
 }

 if((AZ < 0) && (AZ > -90))
 {
  if((R_Pos.x >= PXH) || (R_Pos.y >= PYH)) {ME = 0;}
 }
 
 if(AZ <= -90)
 {
  if((R_Pos.x >= PXH) || (R_Pos.y <= PYL)) {ME = 0;}
 }
 
}


MOVE_ENABLE_REW()
{
 vector R_Pos = llGetPos(); vector R_Rot = llRot2Euler(llGetRot()); float AZ = R_Rot.z * RAD_TO_DEG;
 float sin = llFabs(llSin(R_Rot.z)); float cos = llFabs(llCos(R_Rot.z));
 
 float PXL = VL + PXY_S * sin; float PXH = RX * 256 - (VL + PXY_S * sin);
 float PYL = VL + PXY_S * cos; float PYH = RY * 256 - (VL + PXY_S * cos);
 
 if((AZ >= 0) && (AZ < 90))
 {
  if((R_Pos.x >= PXH) || (R_Pos.y <= PYL)) {ME = 0;}
 }
 
 if(AZ >= 90)
 {
  if((R_Pos.x >= PXH) || (R_Pos.y >= PYH)) {ME = 0;}
 }

 if((AZ < 0) && (AZ > -90))
 {
  if((R_Pos.x <= PXL) || (R_Pos.y <= PYL)) {ME = 0;}
 }
 
 if(AZ <= -90)
 {
  if((R_Pos.x <= PXL) || (R_Pos.y >= PYH)) {ME = 0;}
 }
 
}

 
SetParticle_HL()
{
    llLinkParticleSystem(29,[ 
 
        //System Behaviour
        PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK 
                         | PSYS_PART_FOLLOW_SRC_MASK 
                         | PSYS_PART_FOLLOW_VELOCITY_MASK 
                         | PSYS_PART_INTERP_COLOR_MASK 
                         | PSYS_PART_INTERP_SCALE_MASK 
                         ,
 
        //System Presentation
        PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
        PSYS_SRC_BURST_RADIUS, HE_burst_radius,
        PSYS_SRC_ANGLE_BEGIN,  HE_angle_begin,
        PSYS_SRC_ANGLE_END,    HE_angle_end,
  
        //Particle appearance
        PSYS_PART_START_COLOR, HE_start_color,
        PSYS_PART_END_COLOR,   HE_end_color,
        PSYS_PART_START_ALPHA, HE_start_alpha,
        PSYS_PART_END_ALPHA,   HE_end_alpha,
        PSYS_PART_START_SCALE, HE_start_scale,
        PSYS_PART_END_SCALE,   HE_end_scale,
        PSYS_SRC_TEXTURE,      HE_texture,
 
        //Particle Flow
        PSYS_SRC_MAX_AGE,          HE_source_max_age,
        PSYS_PART_MAX_AGE,         HE_particle_max_age,
        PSYS_SRC_BURST_RATE,       HE_burst_rate,
        PSYS_SRC_BURST_PART_COUNT, HE_burst_particle_count, 
 
        //Particle Motion
        PSYS_SRC_BURST_SPEED_MIN, HE_speed_min,
        PSYS_SRC_BURST_SPEED_MAX, HE_speed_max
 
        ]);
}

SetParticle_HR()
{
    llLinkParticleSystem(27,[ 
 
        //System Behaviour
        PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK 
                         | PSYS_PART_FOLLOW_SRC_MASK 
                         | PSYS_PART_FOLLOW_VELOCITY_MASK 
                         | PSYS_PART_INTERP_COLOR_MASK 
                         | PSYS_PART_INTERP_SCALE_MASK 
                         ,

        //System Presentation
        PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
        PSYS_SRC_BURST_RADIUS, HE_burst_radius,
        PSYS_SRC_ANGLE_BEGIN,  HE_angle_begin,
        PSYS_SRC_ANGLE_END,    HE_angle_end,
  
        //Particle appearance
        PSYS_PART_START_COLOR, HE_start_color,
        PSYS_PART_END_COLOR,   HE_end_color,
        PSYS_PART_START_ALPHA, HE_start_alpha,
        PSYS_PART_END_ALPHA,   HE_end_alpha,
        PSYS_PART_START_SCALE, HE_start_scale,
        PSYS_PART_END_SCALE,   HE_end_scale,
        PSYS_SRC_TEXTURE,      HE_texture,
 
        //Particle Flow
        PSYS_SRC_MAX_AGE,          HE_source_max_age,
        PSYS_PART_MAX_AGE,         HE_particle_max_age,
        PSYS_SRC_BURST_RATE,       HE_burst_rate,
        PSYS_SRC_BURST_PART_COUNT, HE_burst_particle_count, 
 
        //Particle Motion
        PSYS_SRC_BURST_SPEED_MIN, HE_speed_min,
        PSYS_SRC_BURST_SPEED_MAX, HE_speed_max
 
        ]);
}


SetParticle_HFL()
{
    llLinkParticleSystem(30,[ 
 
        //System Behaviour
        PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK 
                         | PSYS_PART_FOLLOW_SRC_MASK 
                         | PSYS_PART_FOLLOW_VELOCITY_MASK 
                         | PSYS_PART_INTERP_COLOR_MASK 
                         | PSYS_PART_INTERP_SCALE_MASK 
                         ,
 
        //System Presentation
        PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
        PSYS_SRC_BURST_RADIUS, HE_burst_radius,
        PSYS_SRC_ANGLE_BEGIN,  HE_angle_begin,
        PSYS_SRC_ANGLE_END,    HE_angle_end,
  
        //Particle appearance
        PSYS_PART_START_COLOR, HE_start_color,
        PSYS_PART_END_COLOR,   HE_end_color,
        PSYS_PART_START_ALPHA, HE_start_alpha,
        PSYS_PART_END_ALPHA,   HE_end_alpha,
        PSYS_PART_START_SCALE, HE_start_scale,
        PSYS_PART_END_SCALE,   HE_end_scale,
        PSYS_SRC_TEXTURE,      HE_texture,
 
        //Particle Flow
        PSYS_SRC_MAX_AGE,          HE_source_max_age,
        PSYS_PART_MAX_AGE,         HE_particle_max_age,
        PSYS_SRC_BURST_RATE,       HE_burst_rate,
        PSYS_SRC_BURST_PART_COUNT, HE_burst_particle_count, 
 
        //Particle Motion
        PSYS_SRC_BURST_SPEED_MIN, HE_speed_min,
        PSYS_SRC_BURST_SPEED_MAX, HE_speed_max
 
        ]);
}


SetParticle_HFR()
{
    llLinkParticleSystem(23,[ 
 
        //System Behaviour
        PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK 
                         | PSYS_PART_FOLLOW_SRC_MASK 
                         | PSYS_PART_FOLLOW_VELOCITY_MASK 
                         | PSYS_PART_INTERP_COLOR_MASK 
                         | PSYS_PART_INTERP_SCALE_MASK 
                         ,

        //System Presentation
        PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
        PSYS_SRC_BURST_RADIUS, HE_burst_radius,
        PSYS_SRC_ANGLE_BEGIN,  HE_angle_begin,
        PSYS_SRC_ANGLE_END,    HE_angle_end,
  
        //Particle appearance
        PSYS_PART_START_COLOR, HE_start_color,
        PSYS_PART_END_COLOR,   HE_end_color,
        PSYS_PART_START_ALPHA, HE_start_alpha,
        PSYS_PART_END_ALPHA,   HE_end_alpha,
        PSYS_PART_START_SCALE, HE_start_scale,
        PSYS_PART_END_SCALE,   HE_end_scale,
        PSYS_SRC_TEXTURE,      HE_texture,
 
        //Particle Flow
        PSYS_SRC_MAX_AGE,          HE_source_max_age,
        PSYS_PART_MAX_AGE,         HE_particle_max_age,
        PSYS_SRC_BURST_RATE,       HE_burst_rate,
        PSYS_SRC_BURST_PART_COUNT, HE_burst_particle_count, 
 
        //Particle Motion
        PSYS_SRC_BURST_SPEED_MIN, HE_speed_min,
        PSYS_SRC_BURST_SPEED_MAX, HE_speed_max
 
        ]);
}


SetPartVar_H0()
{
 HE_end_color   = <1.0,1.0,1.0>;
 HE_end_alpha   = 1.0;
 HE_start_scale = <0.2, 0.2, 0.2>;
 HE_end_scale   = <0.3, 0.3, 0.3>;
 HE_particle_max_age     = 0.5;
 HE_burst_particle_count = 1;
 HE_speed_min    = 0.0;
 HE_speed_max    = 0.2; 
}


SetPartVar_H1()
{
 HE_end_color   = <1.0,1.0,1.0>;
 HE_end_alpha   = 0.0;
 HE_start_scale = <0.0, 0.0, 0.0>;
 HE_end_scale   = <0.7, 0.7, 0.7>;
 HE_particle_max_age     = 1.0;
 HE_burst_particle_count = 16 + HPC;
 HE_speed_min    = 0.5;
 HE_speed_max    = 0.5 + HS;
}


SETUP_CAMERA()
{
    llSetCameraParams([
        CAMERA_ACTIVE, 1,                     // 1 is active, 0 is inactive
        CAMERA_BEHINDNESS_ANGLE, 0,           // (0 to 180) degrees
        CAMERA_BEHINDNESS_LAG, 0.0,           // (0 to 3) seconds
        CAMERA_DISTANCE, CZ,                  // ( 1 to 30) meters
        CAMERA_FOCUS_LAG, 0.0 ,               // (0 to 3) seconds
        CAMERA_FOCUS_LOCKED,FALSE,            // (FALSE)
        CAMERA_FOCUS_THRESHOLD, 0.0,          // (0 to 4) meters
        CAMERA_PITCH, CAM_ANGLE,              // (-45 to 80) degrees
        CAMERA_POSITION_LAG, 0.0,             // (0 to 3) seconds
        CAMERA_POSITION_LOCKED, FALSE,        // (TRUE or FALSE)
        CAMERA_POSITION_THRESHOLD, 0.0,       // (0 to 4) meters
        CAMERA_FOCUS_OFFSET, <0.0, 0.0, 0.5>  // <-10,-10,-10> to <10,10,10> meters
    ]);
}


SETUP_VEHICLE()
{
        // Vehicle Type
        llSetVehicleType(VEHICLE_TYPE_BOAT);                                         // in use
        
        // Type Vector --------------------------------------------------------------
        
        // friction
        llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1.0, 1.0, 1.0>);// z in use
        llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1.0, 1.0, 1.0>); // x,y in use
        // motor
        llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0>);         // in use
        llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0>);          // in use
        llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_OFFSET, <0, 0, 0>);             // ???
        
        // Type Float -------------------------------------------------------
        
        // hover
        llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, ALTITUDE);              // in use
        llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 1.0);               // ???
        llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 1.0);                // ???
        llSetVehicleFloatParam(VEHICLE_BUOYANCY, 1.0);                       // ???
        // friction
        llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, 1.0);     // ???
        // motor
        llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.1);         // in use
        llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.2);   // in use
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);        // in use
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 1.0);  // in use
        //deflection
        llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 1.0);   // ???
        llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1.0);    // ???
        llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 1.0);  // ???
        llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 1.0);   // ???
        // attraction
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1.0); // ???
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1.0);  // ???
        // banking
        llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 1.0);             // ???
        llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 1.0);                    // ???
        llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 1.0);              // ???
}

//------------------------------------ Default Programm -----------------------------------------

default
{
    state_entry()
    {
     llSetStatus(STATUS_PHANTOM, FALSE);
     llSetLinkPrimitiveParams(LINK_ALL_OTHERS, [PRIM_PHANTOM,FALSE]); 
     llSetStatus(STATUS_PHYSICS, FALSE);
     llSetLinkPrimitiveParams(LINK_ALL_OTHERS, [PRIM_PHYSICS,FALSE]); 
     llSetSitText(sit_message);
     llSetText(TITLE, <0.5, 0.5, 1.0>, 1.0);
     llSitTarget(SIT_POSITION,llEuler2Rot(DEG_TO_RAD * SIT_ROTATION));
    }


   on_rez(integer rn)
    {
     llResetScript();
    }


//----------------------------------- Changed Watcher ---------------------------------------------        
            
    changed(integer change)
    {
        if ((change & CHANGED_LINK) == CHANGED_LINK)
        {
            AVATAR = llAvatarOnSitTarget();
            if (AVATAR != NULL_KEY)
            {                
                if( (AVATAR != llGetOwner()) & (Private == 1))
                {
                    llSay(0, not_owner_message);
                    llUnSit(AVATAR);    
                }
                else
                {
                 vector posv = llGetPos(); ALTITUDE = (posv.z - 20.00);
                 SETUP_VEHICLE(); llSleep(0.3);
                 llSetStatus(STATUS_PHANTOM, FALSE);
                 llSetLinkPrimitiveParams(LINK_ALL_OTHERS, [PRIM_PHANTOM,FALSE]); 
                 llSetStatus(STATUS_PHYSICS, TRUE);
                 llSetLinkPrimitiveParams(LINK_ALL_OTHERS, [PRIM_PHYSICS, TRUE]); 
                 llRequestPermissions(AVATAR,
                 PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS | PERMISSION_CONTROL_CAMERA);
                 
                 RUN = 1; OFFSET=0; L2 = llLog(2); hp = hps; H_Gear = 1;
                 PXY_S = HGfac * llPow(2, llLog(hps) / L2 - 2);
                 dir = 1; H_dir = 0; angz = angz_high; P = 1;
                 HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
                 llStartAnimation(PILOT_ANIM); 
                 llSay(0, StartUpText);
                 llSetText("", <0.5, 0.5, 1.0>, 1.0);
                 llMessageLinked(10, 0, "on-1", "");
                 CZ  = 4.0; SETUP_CAMERA(); llSleep(3.5); CZ = CAM_ZOOM; SETUP_CAMERA();
                 llSetTimerEvent(0.2);
                 llSetLinkPrimitiveParamsFast(29, [PRIM_ROT_LOCAL, llEuler2Rot(<HB, 0, 0>)]); llSleep(0.1);
                 llSetLinkPrimitiveParamsFast(29, [PRIM_ROT_LOCAL, llEuler2Rot(<HF, 0, 0>)]);
                 llSetLinkPrimitiveParamsFast(27, [PRIM_ROT_LOCAL, llEuler2Rot(<HB, 0, 0>)]); llSleep(0.1);
                 llSetLinkPrimitiveParamsFast(27, [PRIM_ROT_LOCAL, llEuler2Rot(<HF, 0, 0>)]);
                 llSetLinkPrimitiveParamsFast(30, [PRIM_ROT_LOCAL, llEuler2Rot(<HF, 0, 0>)]); llSleep(0.1);
                 llSetLinkPrimitiveParamsFast(30, [PRIM_ROT_LOCAL, llEuler2Rot(<HB, 0, 0>)]);
                 llSetLinkPrimitiveParamsFast(23, [PRIM_ROT_LOCAL, llEuler2Rot(<HF, 0, 0>)]); llSleep(0.1);
                 llSetLinkPrimitiveParamsFast(23, [PRIM_ROT_LOCAL, llEuler2Rot(<HB, 0, 0>)]);
                 SetPartVar_H0();
                 SetParticle_HL(); SetParticle_HR();
                 SetParticle_HFL(); SetParticle_HFR();
                }
            }
            else
            {
                RUN = 0;
                llReleaseControls();
                llStopAnimation(PILOT_ANIM);
                llMessageLinked(10, 0, "Standby", "");
                llSetText(TITLE, <0.5, 0.5, 1.0>, 1.0);
                llSetStatus(STATUS_PHYSICS, FALSE);
                llSetLinkPrimitiveParams(LINK_ALL_OTHERS, [PRIM_PHYSICS, FALSE]); 
                llSetVehicleType(VEHICLE_TYPE_NONE);
                vector pos = llGetPos(); llSetPos(<pos.x, pos.y, HH>);
                llSetTimerEvent((float)FALSE);
                llLinkParticleSystem(29,[]); llLinkParticleSystem(27,[]);
                llLinkParticleSystem(30,[]); llLinkParticleSystem(23,[]);
            }
        }
    }
    
//------------------------------------- Runtime declaration --------------------------------

    run_time_permissions(integer perm)
    {
     if (perm)
     {
      llTakeControls(CONTROL_FWD | CONTROL_BACK |
                     CONTROL_DOWN | CONTROL_UP |
                     CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_RIGHT, TRUE, FALSE);
     }
    }
    

//---------------------------------------- Speed - metering -------------------------------------
    
timer()
{
    if(RUN == 1)
    {
     SPEED = llVecMag(llGetVel());
     string SpeedText = ((string)llRound(SPEED * 1.852) + " Km/h");
     llMessageLinked(10, 0, SpeedText, "");
    }
}

  
//-------------------------------------- Keybord Control --------------------------------------------
    
    control(key id, integer level, integer edge)
    {
        if(RUN == 0) {return;}
        
//------------------ Parking Mode on/off

        if(level & CONTROL_RIGHT)
        {
         if(angz == angz_low)
         {
          angz = angz_high; hp = H_Gear * hpr; P = 0;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
          llWhisper(0, "Driving !");
         }
        
         if((angz == angz_high) && (P == 1)) 
         {
          angz = angz_low; hp = 4;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
          llWhisper(0, "Parking !");
         } 
         P = 1;           
        }

//------------------- Speed change

        if (level & CONTROL_UP)
        {
         H_Gear += 1; hp = H_Gear * hpr;
         if(hp >= hpm) {hp = hpm; H_Gear = 8;}
         PXY_S = HGfac * llPow(2, llLog(hp) / L2 - 2);
         HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
         llWhisper(0, " Speed-Gear: " + (string)H_Gear );
        }
        
        if (level & CONTROL_DOWN)
        {
         H_Gear -= 1; hp = H_Gear * hpr;
         if(hp < hps) {hp = hps; H_Gear = 1;}
         PXY_S = HGfac * llPow(2, llLog(hp) / L2 - 2);
         HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
         llWhisper(0, " Speed-Gear: " + (string)H_Gear );
        }
        
//------------------ move Fwd/Back

        if(level & CONTROL_FWD)
        {
         if(EN == 1) {MOVE_ENABLE_FWD();}
        
           if(ME == 1)
           {
            H_dir = 1; dir = 1;
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0, hp,0>); 
           }
        }
        
        if(level & CONTROL_BACK)
        {
         if(EN == 1) {MOVE_ENABLE_REW();}
        
           if(ME == 1)
           {
            H_dir = -1; dir = -1;
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0,-hp,0>);
           }
        }  

//------------------ turn Right/Left

        if(level & CONTROL_ROT_RIGHT)
        {
         ANGULAR_MOTOR = <0, 0, -(angz + SPEED / (4 * hp))>; 
         OFFSET = Curveangl; HELD=1;
         llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, ANGULAR_MOTOR);
         ANGULAR_MOTOR = <0, 0, 0>;
        }
                        
        if(level & CONTROL_ROT_LEFT)
        {
         ANGULAR_MOTOR = <0, 0, (angz + SPEED / (4 * hp))>; 
         OFFSET = -Curveangl; HELD=1; 
         llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, ANGULAR_MOTOR);
         ANGULAR_MOTOR = <0, 0, 0>;
        }

//--------------------------------------------------------------------------------------------------

        if(HELD==0) {OFFSET=0;}
        vector rot = llRot2Euler(llGetRot());
        llSetRot(llEuler2Rot(<0, DEG_TO_RAD * OFFSET * dir, 0>)* llEuler2Rot(<0 ,0, rot.z>));
        
        if(H_dir == 0)
        {
         if(OFFSET == 0)
         {
          SetPartVar_H0(); SetParticle_HL(); SetParticle_HR(); SetParticle_HFL(); SetParticle_HFR();
         }
         
         if(OFFSET < 0)
         {
          hp_old = hp; hp = hps;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
          SetPartVar_H0(); SetParticle_HL(); SetParticle_HFR();
          SetPartVar_H1(); SetParticle_HFL(); SetParticle_HR();
          hp = hp_old;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
         }
         
         if(OFFSET > 0)
         {
          hp_old = hp; hp = hps;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
          SetPartVar_H1(); SetParticle_HL(); SetParticle_HFR();
          SetPartVar_H0(); SetParticle_HFL(); SetParticle_HR();
          hp = hp_old;
          HS = llLog(hp) / L2 - 1; HPC = llRound(2 * llPow(2, HS));
         }
            
        }
        
        if(H_dir == 1)
        {
         SetPartVar_H1(); SetParticle_HL(); SetParticle_HR();
         SetPartVar_H0(); SetParticle_HFL(); SetParticle_HFR();
        }
        
        if(H_dir == -1)
        {
         SetPartVar_H0(); SetParticle_HL(); SetParticle_HR();
         SetPartVar_H1(); SetParticle_HFL(); SetParticle_HFR();
        }
        
        if((H_dir != 0) || (OFFSET != 0)) {llPlaySound("Motor-05", 1.0);}
        
        dir = 1; HELD = 0; ME = 1; H_dir = 0;
        

    } // End Keybord Control
    
}// End Default

Code: Select all

################ using Vehicles in OpenSim #################

1. Do not cross Simborders.
2. To ride the Vehicle rightclick on the Rootprim, not on a linked Prim.

---------------------------------------------------------------------------------------------------

############### first Time rezzing a Prim or Vehicle #############

1. rezz the Vehicle to the Ground.
2. edit the Vehicle and place it where you want to use it (x ,y, z).
3. recompile Scripts of the Vehicle (LSL).

 --- R E A D Y ---    have Fun.

Code: Select all

Turning:                  Arrow Keys  Left / Right

Moving horizontal:  Arrow Keys  Forward / Back

Speed change:      Arrow Keys  Up / Down (8 Gears)
 
Parking Mode:       Arrow Keys  Shift + Right

############### Simcrossing - Protection ###############

1. Open the Flight-Script in Rootprim
2. Check Line Number 5, 6, 7, 8  and set the Values

---- Default Settigs are for a single Region with Waterhigh 20m ----
These users thanked the author Constance Peregrine for the post (total 2):
Sherrie MelodyMarstol Nitely
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Re: SL Scripter comments, is this accurate

Post by Sherrie Melody »

Boo Rojyo wrote:I've got a working boat and a working flying vehicle (physics not the 'wear' one I sell), that I brought over from osgrid and adapted. Drop by Booland and give them a try by all means. They have been a bit of a fiddle to reconstruct here and make to work properly, but are pretty stable.
I tried a nice red and white one. I don't know anything about boats, so I'm not sure what kind of boat it should be called. Anyway, it works very nicely! It handles running into ground and to sim edges exactly as I would like, and it corrects the boat angle once you let go of the controls. It took me a while to figure out that PgUp and PgDown control the speed, but that was probably a good thing!

Oh, and the boat looks very nice too :D
These users thanked the author Sherrie Melody for the post:
Marstol Nitely
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Re: SL Scripter comments, is this accurate

Post by Sherrie Melody »

Minethere's script works great too. It handles running aground and world edges great! Thanks Minethere :) I'm gonna put this in my script library right now.
These users thanked the author Sherrie Melody for the post (total 2):
Constance PeregrineMarstol Nitely
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: SL Scripter comments, is this accurate

Post by Graham Mills »

Haha, I don't think I'd dare with Dundridge in the room. As far as I can tell they're just a set of functions like any other but they let you do things in a more obvious way than LSL, i.e. without some of the built-in limitations. You just use them in ordinary LSL scripts. Of course, some have the ability to impact sim performance or other griefing potential and they are therefore accompanied by a threat level (a few are disallowed in Kitely) or are limited in terms of who can deploy them, e.g. sim owner.

As an example, I have a gadget that rezzes multiple prims (up to 50) that correspond to scientific journal articles returned by a search of the PubMed bibliographic database. Using OSSL I can put text on the prim corresponding to the article's title and source. Students can examine prims to identify articles of interest and colour via touch those that are of interest. They can then generate a notecard with all the reference ids from that subset. Sometime later they can regenerate that subset of prims by dragging the notecard onto the rezzer. Very simple but the equivalent in SL would be using hovertext and copy/paste from chat. OpenSim plus OSSL is a much better, more seamless, less painful experience. And you have immersive multi-user search for minimal effort; students can take the prims away and incorporate them into their own builds (the prims link back to the relevant PubMed web page if more detail is required).
Jean Swashbuckler wrote:
Graham Mills wrote:I have to say that my favourite scripting difference between SL and Kitely is the ability in OSSL to create rather than just read notecards.
Graham, please help me understand OSSL. I will definitely look it up for the detail but if you can give me the quick cliff notes that would be appreciated.
These users thanked the author Graham Mills for the post (total 2):
Jean SwashbucklerDundridge Dreadlow
User avatar
Constance Peregrine
Posts: 2352
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2780 times
Been thanked: 1487 times

Re: SL Scripter comments, is this accurate

Post by Constance Peregrine »

Sherrie Melody wrote:Minethere's script works great too. It handles running aground and world edges great! Thanks Minethere :) I'm gonna put this in my script library right now.
The speedboat I took them out of shows Basil.Sosides as the creator, but I think the script is nebs...no attribution unfortunately on them.

The boat is given full perms in wright plaza of osgrid though...and no limitations given.
These users thanked the author Constance Peregrine for the post:
Sherrie Melody
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Re: SL Scripter comments, is this accurate

Post by Sherrie Melody »

Hey Minethere, who wrote that script? Was it you? Or someone from Metropolis?

I would like to add the script author in the comments of the script so we know who to thank.
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Re: SL Scripter comments, is this accurate

Post by Sherrie Melody »

Minethere Always wrote:
Sherrie Melody wrote:Minethere's script works great too. It handles running aground and world edges great! Thanks Minethere :) I'm gonna put this in my script library right now.
The speedboat I took them out of shows Basil.Sosides as the creator, but I think the script is nebs...no attribution unfortunately on them.

The boat is given full perms in wright plaza of osgrid though...and no limitations given.
Thanks Minethere, you answered before i even asked. :D
These users thanked the author Sherrie Melody for the post:
Constance Peregrine
Post Reply