Change font size
It is currently Fri Sep 25, 2020 9:08 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 3 posts ]
Author Message
 Post subject: Simple little boat script
PostPosted: Mon Dec 28, 2009 1:14 pm 

Joined: Mon Nov 02, 2009 5:33 pm
Posts: 27
I didn't write this script.. a friend put it in a boat I love on SL, it is sweet and simple. l get errors from it here.. is there something I can change in it to get it working?

float speed;
vector angular_motor;

key driver;

default
{
state_entry()
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
llSetSitText("Board");
llStopSound();
llSetTimerEvent(0.0);
speed=0;
llSitTarget(<0.5, -0.5, 0.4>, ZERO_ROTATION);
llSetCameraEyeOffset(<-5.0, 0.0, 2.0>);
llSetCameraAtOffset(<3.0, -0., 2.0>);
llSetVehicleType(VEHICLE_TYPE_BOAT);
llSetVehicleFlags(VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_HOVER_WATER_ONLY);
// remove these flags
llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_TERRAIN_ONLY
| VEHICLE_FLAG_LIMIT_ROLL_ONLY
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);

// least for forward-back, most friction for up-down
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <2, 3, 2> );

// uniform angular friction (setting it as a scalar rather than a vector)
llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 2 );

// linear motor wins after about five seconds, decays after about a minute
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );

// agular motor wins after four seconds, decays in same amount of time
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 2 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 5 );

// hover / float
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 1.2);
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY,.5 );
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0.5 );

// halfway linear deflection with timescale of 3 seconds
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 3 );

// angular deflection
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10 );

// somewhat bounscy vertical attractor
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 2 );

// weak negative damped banking
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.1 );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, .75 );

// default rotation of local frame
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
if (driver == NULL_KEY)
{
driver = agent;
// You sit and are owner so get controls
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, TRUE);
llRequestPermissions(agent,PERMISSION_TAKE_CONTROLS);
}
}
else
{
driver = NULL_KEY;
// You stand so boat stops
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llReleaseControls();
llStopSound();
llSetTimerEvent(0.0);
}
}

}

run_time_permissions(integer perm)
{
if (perm)
{
// Take these controls and lets go
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE);
llMessageLinked(LINK_ALL_CHILDREN, 0, "start", NULL_KEY);
// llLoopSound("",0.3);
llSetTimerEvent(0.3);
}
}
control(key id, integer level, integer edge)
{

if(level & CONTROL_FWD)
{
// Set cruising speed faster
if(speed < 20)
{
speed +=1;
}
}
if(level & CONTROL_BACK)
{
// Set cruising speed slower
if(speed > -8)
{
speed -=1;
}
}
if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
// Turn right
angular_motor.x += 5;
angular_motor.z -= 1;
}
if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
// Turn left
angular_motor.x -= 5;
angular_motor.z += 1;
}
if(level & CONTROL_UP)
{
// add features for when you press up
}
if(level & CONTROL_DOWN)
{
// Added feature for when you press down
// Stops boat when down is pressed
speed=0;
}

}

timer()
{
// the timer actually moves vehicle
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <speed,0,0>);
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
// reset turning angle or you would go around in circles
angular_motor=<0,0,0>;
}
}


Top
 Profile  
 
 Post subject: Re: Simple little boat script
PostPosted: Mon Dec 28, 2009 4:46 pm 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
SL Vehicle Scripts do not work in OpenSim

I suggest you get a BOAT with script from the General Store and examione that script or plunk it into your boat.

_________________
No further support of any kind, for any of my materials. Use as/is whereis.
PLEASE UNSTICKY Any Stickied Posting by myself.


Top
 Profile  
 
 Post subject: Re: Simple little boat script
PostPosted: Tue Dec 29, 2009 2:10 am 

Joined: Mon Nov 02, 2009 5:33 pm
Posts: 27
I went through the General Store and found the O Class Boat which has no mod/copy script and the Monotype de Chantou, the script is way more complicated with functions I don't care about like wind speed, sail trim etc. I'm not a scripter and it's way over my head, I probably need a simple motor boat script that I can just kill the sound on, I didn't see anything like that in the General Store, did I just miss it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 3 posts ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net