This commit is contained in:
Fred Beckhusen
2015-08-07 15:34:30 -05:00
parent ce47ec2f3e
commit fde850293c
8080 changed files with 0 additions and 2443112 deletions

View File

@@ -1,3 +0,0 @@
<Solution name="Helicopter Scripts">
<Project name="Helicopter Scripts" path="Helicopter Scripts\Helicopter Scripts.prj" active="true"/>
</Solution>

View File

@@ -1,12 +0,0 @@
<Project name="Helicopter Scripts" guid="82b975f6-9e84-4a65-972a-0baf961c38e5">
<Object name="Object" guid="92d36163-b660-4fa6-a039-d78af01062b3" active="true">
<Script name="controller.lsl" guid="07631913-ff00-4dc0-8dcd-790da7f19e95">
</Script>
<Script name="link message for seat.lsl" guid="bb86b8d8-36fa-4a7a-a43d-ccb45dcbf0f2">
</Script>
<Script name="seat.lsl" guid="2e10d985-9522-4b33-b32a-1ab3c7bfc948">
</Script>
<Script name="Simple bullet rezzer.lsl" guid="3440b773-4b7e-403f-a5c2-d374aba028ea">
</Script>
</Object>
</Project>

View File

@@ -1,162 +0,0 @@
// :CATEGORY:Helicopter
// :NAME:Helicopter scripts
// :AUTHOR:Anonymous
// :CREATED:2013-09-06
// :EDITED:2013-09-18 15:38:54
// :ID:377
// :NUM:524
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// bullet rezzer
// :CODE:
// simple cannon pointer script
// just go into mouselook, it will point wherever you look
// mouse button rezzes a bullet. Release the button to stop firing.
// can only fire 10 rounds per second, max.
// the bullet will be fired from center of the entire bullet or missile. To have the bullet rez from the center of the root prim,
// change llRezObject to llRezAtRoot instead.
integer debugon = FALSE; // set to TRUE for debug to owner only.
vector ANGLE = <0,0,90> ; // used to point the gun 90 degrees rotated around the Z axis, this may need to be changed. It depends upon your prim and how the gun sticks out of it.
string shoot = "shoot"; // the sound it makes when firing, must be in inventory. You can change this to:
// key shoot = "12345000-0000-0000-0000-000000000001"; // where this is a copied UUID from your inventory and then there is no need to give away the sound file.
// The avatar must be within 2 meters of the gun script, or it will not aim or fire
// the original value was 20, which is horrible laggy in comparison as it must scan an area 4 * PI R squared larger ( 100 times more work), for no good reason!
// But if it is made larger, you can shoot the gun from a greater distance
float DISTANCE = 2; // Make this as small as possible to control lag
float SPEED = 40.0; // how fast the bullet flies away, this is really fast! For a missile, set it to 0 and make the missile do its own acceleration
// code bgins
// general purpose Debug("some message");
Debug( string msg)
{
if (debugon)
llOwnerSay(msg);
}
default
{
state_entry()
{
// normally, this little bit of code is disabled by FALSE. It can be deleted entirely. But it is extremely handy!
// This routine lets you change hard coded rotations to vectors so humans can work on them
// It does not run unless you set this to TRUE
// When it runs, it takes whatever crap quaternion has been copied from old code into a vector
// It prints the vector in degrees
// a crap quaternion looks like this, and has 4 numbers:
// <0.00000, 0.00000, 0.70711, 0.70711> // bet you didn't know this is a rotation of 90 degrees around the Z axis!
// sample output when set to TRUE:
// original:<0.00000, 0.00000, 0.70711, 0.70711> This was the original, copied quaternion
// replacement:<0.00000, 0.00000, 90.00000> aha, its a 90 degree rotation about Z
// How to use it: Whenever you see a rotation hard-coded in like this, don't cuss at the programmer, they didn't know better.
// llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
// Paste the old crap rotation <..> in the arot line below, set the variable to TRUE, and then change the script to this line, where the <0,0,90> is whatever the script spits out:
// llSetRot(llEuler2Rot(<0,0,90> * DEG_TO_RAD)); // change <0,0,90> to the vector form
// much easier to change and the same as this unreadable crap:
// llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
// one last thing: <0.00000,0.0000, 0.00000, 1.0000> ( 0,0,0,1) is a ZERO rotation, or <0,0,0> as a vector. That's easy to remember so you can just change it to llSetRot(ZERO_VECTOR);
// you can comment this all out, but there is really no need, it just saves a few bytes of memory if you comment it out
if (FALSE) // set to TRUE to conver any 4-vector quaternion into a human readable 3-unit vector.
{
rotation arot = <0.00000, 0.00000, 0.70711, 0.70711>; // replace this with your crappy quaternion
llOwnerSay("original:" + (string) arot);
vector in_degrees = llRot2Euler(arot);
in_degrees *= RAD_TO_DEG;
llOwnerSay("replacement:" + (string) in_degrees); // output it as a vector in degrees instead of radians.
}
}
touch_start(integer total_number)
{
integer i;
// MUST scan over all people who touch, and only allow the owner to fire the weapon.
// many people can click at the same time, how many is in total_number
for (i = 0; i < total_number; i++)
{
// See if this person is the owner
if (llDetectedKey(i) == llGetOwner())
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
Debug("Requesting Permissions");
}
}
}
touch_end(integer total_number)
{
integer i;
for (i = 0; i < total_number; i++)
{
// See if this person is the owner
if (llDetectedKey(i) == llGetOwner())
{
llReleaseControls();
llSensorRemove();
llSetRot(llEuler2Rot(ANGLE * DEG_TO_RAD));
Debug("stopped firing");
}
}
}
sensor(integer sense)
{
rotation k = llDetectedRot(0);
llRotLookAt(k, 0.1, 0.1);
}
// oh dear, the avatar is out of range
no_sensor()
{
llReleaseControls();
llSensorRemove();
llSetRot(llEuler2Rot(ANGLE * DEG_TO_RAD)); // this is the same as the following line, but easily changed
//llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>); // old crap code, actually <0.00000, 0.00000, 90.00000>
Debug("No Owner nearby, check the DISTANCE variable");
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TAKE_CONTROLS)
{
Debug("Permissions to take controls has been granted");
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
llSensorRepeat("", llGetOwner(), AGENT, DISTANCE, TWO_PI, 0.1); // look for the owner only
}
}
control(key name, integer levels, integer edges)
{
// mouse left button pressed
if (levels & CONTROL_ML_LBUTTON)
{
rotation rot = llGetRot(); // mouselook rotation
vector vel = llRot2Fwd(rot); // forward direction only
vector pos = llGetPos(); // gun position
pos = pos + vel; // add to gun position the forward direction
pos.z += 0.0; // worthless by adding a 0, but by changing 0.0 to another number you can fire higher or lower than the prim this script is in.
vel = vel * SPEED; // multiply all 3 coordinates by the constant SPEED to set a bullet speed.
llTriggerSound(shoot, 1.0);
llRezObject("bullet", pos, vel, rot, 1); // sends a 1 to the bullet, to the on_rez(integer start_param)
}
}
}

View File

@@ -1,152 +0,0 @@
// :CATEGORY:Helicopter
// :NAME:Helicopter scripts
// :AUTHOR:Anonymous
// :CREATED:2013-09-06
// :EDITED:2013-09-18 15:38:54
// :ID:377
// :NUM:521
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// controller
// :CODE:
////////////////////////////////////////////////////////////////
integer HUD = 87654567; // the secret channel the HUD is own
float ROTATION_RATE = 1.0; // Rate of turning
float FWD_THRUST = 25; // Forward thrust motor force
float BACK_THRUST = 25; // Backup thrust
float VERTICAL_THRUST = 15;
vector linear_motor = <0,0,0>; // Keep a running linear motor value for better response
default {
// this runs first after a reset
state_entry() {
llListen(HUD,"","",""); // listen for HUD commands
llListen(0,"",llGetOwner(),""); // listen for owner on channel 0
llSitTarget(<0.1, 0.0, 1.95>, ZERO_ROTATION);
llSetVehicleType(VEHICLE_TYPE_AIRPLANE);
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5);
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 100);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 100);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.2);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 10);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.2);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.1);
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <5,5,5>);
llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10,10,10>);
llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, 0.0);
llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.0);
llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 1.0);
llSetVehicleFloatParam(VEHICLE_BUOYANCY, 1.0);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.2);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 3.0);
llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 1.0);
llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 0.75);
llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.05);
llSetCameraEyeOffset(<-7.0, 0.0, 3.0>);
llSetSitText("RAH-66");
llSetCameraAtOffset(<0.5, 0, 0>);
}
changed(integer change) {
if (change & CHANGED_LINK) {
key agent = llAvatarOnSitTarget();
if (agent) {
if (agent != llGetOwner()) {
// only the owner can use this vehicle
llSay(0, "You aren't the owner of this Comanche.");
llUnSit(agent);
llPushObject(agent, <0,0,10>, ZERO_VECTOR, FALSE);
} else {
// driver is entering the vehicle
llOwnerSay("type 'start' to begin fying");
// llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
}
} else {
// driver is getting up
llSetStatus(STATUS_PHYSICS, FALSE);
llReleaseControls();
}
}
}
listen(integer channel, string name, key id, string message)
{
if(llToLower(message) == "start") {
// owner or HUD spoke 'STart' or START or start
llMessageLinked(LINK_SET,0,"start",""); // send to any other scripts
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
} else if (llToLower(message) == "stop") {
llMessageLinked(LINK_SET,0,"stop",""); // send 'stop' to any other scripts
llSetStatus(STATUS_PHYSICS, FALSE);
llReleaseControls();
}
}
run_time_permissions(integer perm) {
if (perm & PERMISSION_TAKE_CONTROLS) {
llSetStatus(STATUS_PHYSICS, TRUE);
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE);
}
}
link_message(integer sender_number, integer number, string message, key id)
{
// incoming link messages appar here, so you can control this script from other scripts.
}
control(key id, integer level, integer edge) {
if(level & (CONTROL_LEFT | CONTROL_ROT_LEFT)) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <-ROTATION_RATE,0,0>);
} else if (edge & (CONTROL_LEFT | CONTROL_ROT_LEFT)) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0,0,0>);
}
if(level & (CONTROL_RIGHT | CONTROL_ROT_RIGHT)) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <ROTATION_RATE,0,0>);
} else if (edge & (CONTROL_RIGHT | CONTROL_ROT_RIGHT)) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0,0,0>);
}
if(level & CONTROL_FWD) {
linear_motor.x = FWD_THRUST;
} else if (edge & CONTROL_FWD) {
linear_motor.x = 0;
}
if(level & CONTROL_BACK) {
linear_motor.x = -BACK_THRUST;
} else if (edge & CONTROL_BACK) {
linear_motor.x = 0;
}
if(level & CONTROL_UP) {
linear_motor.z = VERTICAL_THRUST;
} else if (edge & CONTROL_UP) {
linear_motor.z = 0;
}
if(level & CONTROL_DOWN) {
linear_motor.z = -VERTICAL_THRUST;
} else if (edge & CONTROL_DOWN) {
linear_motor.z = 0;
}
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, linear_motor);
}
}

View File

@@ -1,59 +0,0 @@
// :CATEGORY:Helicopter
// :NAME:Helicopter scripts
// :AUTHOR:Anonymous
// :CREATED:2013-09-06
// :EDITED:2013-09-18 15:38:54
// :ID:377
// :NUM:522
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// link message for seat
// :CODE:
integer sit;
key pilot;
integer listenState( integer listener){ return 1;}
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
// DETECT AV SITTING/UNSITTING AND GIVE PERMISSIONS
link_message(integer sender_number, integer number, string message, key id)
{
if (message == "pilot" & id == NULL_KEY) // no id, means they unsat
{
llSetStatus(STATUS_PHYSICS, FALSE);
llStopAnimation("recline sit");
llMessageLinked(LINK_SET, 0, "unseated", "");
llStopSound();
llReleaseControls();
sit = FALSE;
listenState(FALSE);
}
else if (message == "pilot" & id != NULL_KEY) // id, means they sat
{
// Avatar gets on vehicle
pilot = id ;
sit = TRUE;
llRequestPermissions(pilot, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
listenState(TRUE);
llWhisper(0,"Comanche Pilot, "+llKey2Name(pilot)+", with your HUD attached, Select Start Engine to begin Flight, type help for additional assistance.");
llMessageLinked(LINK_SET, 0, "seated", "");
}
// more ifs and code can go here to detect other link message
}
}

View File

@@ -1,59 +0,0 @@
// :CATEGORY:Helicopter
// :NAME:Helicopter scripts
// :AUTHOR:Anonymous
// :CREATED:2013-09-06
// :EDITED:2013-09-18 15:38:54
// :ID:377
// :NUM:523
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// seat prim
// :CODE:
integer sit;
key pilot;
integer listenState( integer listener){ return 1;}
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
// DETECT AV SITTING/UNSITTING AND GIVE PERMISSIONS
link_message(integer sender_number, integer number, string message, key id)
{
if (message == "pilot" & id == NULL_KEY) // no id, means they unsat
{
llSetStatus(STATUS_PHYSICS, FALSE);
llStopAnimation("recline sit");
llMessageLinked(LINK_SET, 0, "unseated", "");
llStopSound();
llReleaseControls();
sit = FALSE;
listenState(FALSE);
}
else if (message == "pilot" & id != NULL_KEY) // id, means they sat
{
// Avatar gets on vehicle
pilot = id ;
sit = TRUE;
llRequestPermissions(pilot, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
listenState(TRUE);
llWhisper(0,"Comanche Pilot, "+llKey2Name(pilot)+", with your HUD attached, Select Start Engine to begin Flight, type help for additional assistance.");
llMessageLinked(LINK_SET, 0, "seated", "");
}
// more ifs and code can go here to detect other link message
}
}