Welcome, Guest |
You have to register before you can post on our site.
|
|
|
Prim Color |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:09 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Linden Lab presents...
Prim Color
Tags: colors, communications, link, texture, featured, templates, linden
Description:
License:
None
http://secondlife.coolminds.org
*/
//// "Glow" EFFECT TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
// SETUP: Drop one optional particle texture and this script into a prim.
// Particles should start automatically. (Reset) the script if you insert a
// particle texture later on. Add one or more CONTROLLER TEMPLATES to any
// prims in the linked object to control when particles turn ON and OFF.
// Rotate the prim to direction of spray.
// Customize the particle_parameter values below to create your unique
// particle effect and click SAVE. Values are explained along with their
// min/max and default values further down in this script.
// PURPOSE: This script will start a client side "spin" effect on any prim it's
// added to. (the whole object will spin if added to root prim).
// This is an 'illusionary' effect, not a physical one.
// !!! NOTE !!! --> This is not a PARTICLE effect! This sets GLOW on the faces of a prim! =)
// Setting GLOW on a prim is a very new LSL feature. This script may become obsolete
// if there are changes in LSL to how GLOW is set.
integer side = 0; // 0 = top side of prim, you can use ALL_SIDES too.
vector on_color = <0.00, 1.00, 0.00>; // 0.00(no-glow) to 1.00(max)
vector off_color = <1.00, 0.00, 0.00>; // 0.00(no-glow) to 1.00(max)
string CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE; // Optionally FALSE only if using CONTROLLERS.
default {
state_entry() {
if ( AUTO_START )
llSetColor( on_color, side);
else
llSetColor( off_color, side);
}
link_message( integer sibling, integer num, string mesg, key target_key ) {
if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
return;
} else if ( num == 0 ) { // Message says to turn particles OFF:
llSetColor( off_color, side);
} else if ( num == 1 ) { // Message says to turn particles ON:
llSetColor( on_color, side);
} else { // bad instruction number
// do nothing.
}
}
}
// for more on setting prim attributes, visit:
// http://rpgstats.com/wiki/index.php?title=LlSetPrimitiveParams
// http://wiki.secondlife.com/wiki/LlSetPrimitiveParams
// http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams
|
|
|
Prim Glow |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:08 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Linden Lab presents...
Prim Glow
Tags: communications, movement, light, link, primitive, texture, featured, templates, linden
Description:
License:
None
http://secondlife.coolminds.org
*/
//// "Glow" EFFECT TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
// SETUP: Drop one optional particle texture and this script into a prim.
// Particles should start automatically. (Reset) the script if you insert a
// particle texture later on. Add one or more CONTROLLER TEMPLATES to any
// prims in the linked object to control when particles turn ON and OFF.
// Rotate the prim to direction of spray.
// Customize the particle_parameter values below to create your unique
// particle effect and click SAVE. Values are explained along with their
// min/max and default values further down in this script.
// PURPOSE: This script will start a client side "spin" effect on any prim it's
// added to. (the whole object will spin if added to root prim).
// This is an 'illusionary' effect, not a physical one.
// !!! NOTE !!! --> This is not a PARTICLE effect! This sets GLOW on the faces of a prim! =)
// Setting GLOW on a prim is a very new LSL feature. This script may become obsolete
// if there are changes in LSL to how GLOW is set.
integer side = ALL_SIDES; // replace with a digit to affect one side of the prim.
float intensity = 0.50; // 0.00(no-glow) to 1.00(max)
string CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE; // Optionally FALSE only if using CONTROLLERS.
default {
state_entry() {
if ( AUTO_START ) llSetPrimitiveParams( [25, ALL_SIDES, 0.0 ]);
}
link_message( integer sibling, integer num, string mesg, key target_key ) {
if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
return;
} else if ( num == 0 ) { // Message says to turn particles OFF:
llSetPrimitiveParams( [PRIM_GLOW, side, 0.0 ]);
} else if ( num == 1 ) { // Message says to turn particles ON:
llSetPrimitiveParams( [PRIM_GLOW, side, intensity ]);
} else { // bad instruction number
// do nothing.
}
}
}
// for more on setting prim attributes, visit:
// http://rpgstats.com/wiki/index.php?title=LlSetPrimitiveParams
// http://wiki.secondlife.com/wiki/LlSetPrimitiveParams
// http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams
|
|
|
Prim Light |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:07 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Linden Lab presents...
Prim Light
Tags: communications, movement, light, link, primitive, rotation, featured, templates, linden
Description:
License:
None
http://secondlife.coolminds.org
*/
//// "Light" EFFECT TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
// SETUP: Use with particle lab Controller Templates to activate/deactivate.
// Causes the prim to emit light, illuminating nearby avatars, prims and ground.
// Customize the particle_parameter values below to create your unique
// effect and click SAVE.
// PURPOSE: This script will enable/disable and adjust the LIGHT emitted by a prim.
// NOTE: This is not a particle effect.
vector color = <1.00,1.00,1.00>; // red, green and blue values 0.00(dark) to 1.00(bright)
float intensity = 1.00; // % brightness: 0.0 to 1.0
float radius = 5.00; // range/distance of light: 0.0 to 20.0 meters
float falloff = 0.5; // % brightness at max distance 0.00 to 1.00
string CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE; // Optionally FALSE only if using CONTROLLERS.
rotation adjustment = ZERO_ROTATION;
default {
state_entry() {
if ( AUTO_START )
llSetPrimitiveParams( [PRIM_POINT_LIGHT, TRUE, color , intensity, radius, falloff]);
}
link_message( integer sibling, integer num, string mesg, key target_key ) {
if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
return;
} else if ( num == 0 ) { // Message says to turn particles OFF:
llSetPrimitiveParams( [PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR , 0.0, 0.0, 0.0 ]);
} else if ( num == 1 ) { // Message says to turn particles ON:
llSetPrimitiveParams( [PRIM_POINT_LIGHT, TRUE, color , intensity, radius, falloff]);
} else { // bad instruction number
// do nothing.
}
}
}
// for more visit:
// http://rpgstats.com/wiki/index.php?title=LlSetPrimitiveParams
// http://wiki.secondlife.com/wiki/LlSetPrimitiveParams
// http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams
|
|
|
Prim Spin |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:06 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Linden Lab presents...
Prim Spin
Tags: communications, effects, movement, link, physics, primitive, rotation, featured, templates, linden
Description:
License:
None
http://secondlife.coolminds.org
*/
//// "llTargetOmega()" SCRIPT TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
// SETUP: Use with CONTROLLER TEMPLATES to turn on/off spin effect.
// PURPOSE: This script will start a client side "spin" effect on any prim it's
// added to. (the whole object will spin if added to root prim).
// This is an 'illusionary' effect (not a physical one!)
float spin_rate = -1.00; // revolutions per second around vertical axis
float roll_rate = 0.00; // revs per sec around east/west axis
float yaw_rate = 0.00; // revs per second around north/south axis
integer LOCAL_AXIS = TRUE; // set to true to adjust spin around prim's axis instead of global.
// (NOTE: LOCAL_AXIS doesn't update when the prim is rotated by other methods!
// only when this effect is restarted.)
// May or may not reset to original position when turned off.
string CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE; // Optionally FALSE only if using CONTROLLERS.
rotation adjustment = ZERO_ROTATION;
default {
state_entry() {
if ( LOCAL_AXIS ) adjustment = llGetRot();
if ( AUTO_START ) llTargetOmega( <roll_rate, yaw_rate, spin_rate>*adjustment, 2.0, 2.0 );
}
link_message( integer sibling, integer num, string mesg, key target_key ) {
if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
return;
} else if ( num == 0 ) { // Message says to turn particles OFF:
llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
llSetLocalRot( llGetLocalRot() );
} else if ( num == 1 ) { // Message says to turn particles ON:
llTargetOmega( <roll_rate, yaw_rate, spin_rate>*adjustment, 2.0, 2.0 );
} else { // bad instruction number
// do nothing.
}
}
}
// for more visit:
// http://rpgstats.com/wiki/index.php?title=LlTargetOmega
// http://wiki.secondlife.com/wiki/LlTargetOmega
// http://lslwiki.net/lslwiki/wakka.php?wakka=llTargetOmega
// (each is different!)
|
|
|
Motorcycle 1.0.0 |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:05 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Cory, Nada Epoch presents...
Motorcycle 1.0.0
Tags: animations, avatar, camera, chat, collision, controls, communications, detection, effects, movement, link, owner, permissions, physics, primitive, pushobjects, rotation, sit, sound, sittext, teleport, vehicle
Description: The new vehicle action allows us to make any physical object in Second Life a vehicle. This script is a good example of a very basic vehicle that is done very well.
License:
None
http://secondlife.coolminds.org
*/
default
{
//There are several things that we need to do to define vehicle,
// and how the user interacts with it. It makes sense to
// do this right away, in state_entry.
state_entry()
{
llPassCollisions(TRUE);
//We can change the text in the pie menu to more accurately
// reflect the situation. The default text is "Sit" but in
// some instances we want you to know you can drive or ride a
// vehicle by sitting on it. The llSetSitText function will
// do this.
llSetSitText("Ride");
//Since you want this to be ridden, we need to make sure that
// the avatar "rides" it in a acceptable position
// and the camera allows the driver to see what is going on.
//
//llSitTarget is a new function that lets us define how an avatar will orient itself when sitting.
// The vector is the offset that your avatar's center will be
// from the parent object's center. The
// rotation is based off the positive x axis of the parent. For
// this motorcycle, we need you to sit in a way
// that looks right with the motorcycle sit animation, so we
// have your avatar sit slightly offset from the seat.
llSitTarget(<0.6, 0.03, 0.20>, ZERO_ROTATION);
//To set the camera, we need to set where the camera is, and
// what it is looking at. By default, it will
// be looking at your avatar's torso, from a position above and
// behind. It will also be free to rotate around your
// avatar when "turning."
//
//For the motorcycle, we are going to set the camera to be
// behind the cycle, looking at a point in front of it.
// Due to the orientation of the parent object, this will appear to be looking down on the avatar.
llSetCameraEyeOffset(<-5.0, -0.00, 2.0> );
llSetCameraAtOffset(<3.0, 0.0, 2.0> );
//To make an object a vehicle, we need to define it as a
// vehicle. This is done by assigning it a vehicle type.
// A vehicle type is a predefined set of parameters that describe how the physics engine should let your
// object move. If the type is set to VEHICLE_TYPE_NONE it will no longer be a vehicle.
//
//The motorcycle uses the car type on the assumption that this
// will be the closest to how a motorcycle should work.
// Any type could be used, and all the parameters redefined later.
llSetVehicleType(VEHICLE_TYPE_CAR);
//While the type defines all the parameters, a motorcycle is
// not a car, so we need to change some parameters
// to make it behave correctly.
//The vehicle flags let us set specific behaviors for a vehicle
// that would not be covered by the more general
// parameters. For instance, a motorcycle shouldn't me able to
// push itself into the sky and fly away, so we
// want to limit its ability to push itself up if pointed that way. There are several flags that help when
// making various vehicles.
llSetVehicleFlags(VEHICLE_FLAG_NO_DEFLECTION_UP | VEHICLE_FLAG_LIMIT_ROLL_ONLY | VEHICLE_FLAG_LIMIT_MOTOR_UP);
//To redefine parameters, we use the function
// llSetVehicleHippoParam where Hippo is the variable type of the
// parameter (float, vector, or rotation).
//
//Most parameters come in pairs, and efficiency and a timescale. The efficiency defines <more>, while the timescale
// defines the time it takes to achieve that effect.
//
//In a virtual world, a motorcycle is a motorcycle because it looks and moves like a motorcycle. The look is
// up to the artist who creates the model. We get to define
// how it moves. The most basic properties of movement
// can be thought of as the angular deflection (points in the
// way it moves) and the linear deflection (moves in the
// way it points). A dart would have a high angular deflection, and a low linear deflection. A motorcycle has
// a low linear deflection and a high linear deflection, it goes where the wheels send it. The timescales for these
// behaviors are kept pretty short.
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.10);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);
//A bobsled could get by without anything making it go or turn
// except for a icey hill. A motorcycle, however, has
// a motor and can be steered. In LSL, these are linear and
// angular motors. The linear motor is a push, the angular
// motor is a twist. We apply these motors when we use the
// controls, but there is some set up to do. The motor
// timescale controls how long it takes to get the full effect
// of the motor, basically acceleration. The motor decay
// timescale defines how long the motor stays at that strength
// - how slowly you let off the gas pedal.
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.2);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);
//Real world vehicles are limited in velocity and slow to a
// stop due to friction. While a vehicle that continues
// moving forever is kinda neat, it is hard to control, and not
// very realistic. We can define linear and angular
// friction for a vehicle, how quickly you will slow down while
// moving or rotating.
//
//A motorcycle moves easily along the line defined by the
// wheels, and not as easily against the wheels. A motorcycle
// falling out of the air shouldn't feel very much friction at
// all. For the most part, our angular frictions don't
// matter, as they are handled by the vertical attractor. The
// one component that is not handled by the vertical
// attractor is the rotation around the z axis, so we give it
// some friction to make sure we don't spin forever.
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 0.5, 1000.0> );
llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10.0, 10.0, 0.5> );
//We are using a couple of tricks to make the motorcycle look
// like a real motorcycle. We use an animated texture to
// spin the wheels. The actual object can not rely on the real
// world physics that lets a motorcycle stay upright.
// We use the vertical attractor parameter to make the object
// try to stay upright. The vertical attractor also allows
// us to make the vehicle bank, or lean into turns.
//
//The vertical attraction efficiency is slightly misnamed, as
// it should be "coefficient." Basically, it controls
// if we critically damp to vertical, or "wobble" more. It also
// has a secondary effect that it will limit the roll
// of the vehicle. The timescale will control how fast we go
// back to vertical, and
// thus how strong the vertical attractor is.
//
//We want people to be able to lean into turns, not fall down,
// and not wobble to much while coming back up.
// A vertical attraction efficiency of .5 is nicely in the middle, and it won't wobble to badly because of the
// inherent ground friction. As shorter timescale will make it
// hard to roll, a longer one will let us roll a lot
// (and get a bit queasy). We will find that the controls are
// also affected by the vertical attractor
// as we tune the banking features, and that sometimes finding
// good values for these numbers is more an art than a science.
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.50);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.40);
//Banking means that if we rotate on the roll axis, we will
// also rotate on the yaw axis, meaning that our motorcycle will lean to the
// side as we turn. Not only is this one of the things that it look like a real motorcycle, it makes it look really cool too. The
// higher the banking efficiency, the more "turn" for your
// "lean". This motorcycle is made to be pretty responsive, so we have a high
// efficiency and a very low timescale. The banking mix lets
// you decide if you can do the arcade style turn while not moving, or make
// a realistic vehicle that only banks with velocity. You can
// also input a negative banking mix value to make it bank the wrong way,
// which might lead to some interesting vehicles.
llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 1.0);
llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.01);
llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 1.0);
//Because the motorcycle is really just skidding along the
// ground, its colliding with every bump it can find, the default behavior
// will have us making loud noises every bump, which isn't very
// desirable, so we can just take those out.
llCollisionSound("", 0.0);
}
//A sitting avatar is treated like a extra linked primitive, which
// means that we can capture when someone sits on the
// vehicle by looking for the changed event, specifically, a link
// change.
changed(integer change)
{
//Make sure that the change is a link, so most likely to be a
// sitting avatar.
if (change & CHANGED_LINK)
{
//The llAvatarSitOnTarget function will let us find the key
// of an avatar that sits on an object using llSitTarget
// which we defined in the state_entry event. We can use
// this to make sure that only the owner can drive our vehicle.
// We can also use this to find if the avatar is sitting, or is getting up, because both will be a link change.
// If the avatar is sitting down, it will return its key, otherwise it will return a null key when it stands up.
key agent = llAvatarOnSitTarget();
//If sitting down.
if (agent)
{
//We don't want random punks to come stealing our
// motorcycle! The simple solution is to unsit them,
// and for kicks, send um flying.
if (agent != llGetOwner())
{
llSay(0, "You aren't the owner");
llUnSit(agent);
llPushObject(agent, <0,0,100>, ZERO_VECTOR, FALSE);
}
// If you are the owner, lets ride!
else
{
//The vehicle works with the physics engine, so in
// order for a object to act like a vehicle, it must first be
// set physical.
llSetStatus(STATUS_PHYSICS, TRUE);
//There is an assumption that if you are going to
// choose to sit on a vehicle, you are implicitly giving
// permission to let that vehicle act on your controls, and to set your permissions, so the end user
// is no longer asked for permission. However, you
// still need to request these permissions, so all the
// paperwork is filed.
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
//We will play a little "startup" sound.
llPlaySound("SUZ_start (2).wav", 0.7);
// All the messageLinked calls are communicating
// with other scripts on the bike. There is a script that controls
// particle systems, and one that controls sounds.
// This way we can make a simple "motorcycle" script that is modular
// and you can put in your own sounds/particles,
// and still use the same base script.
llMessageLinked(LINK_SET, 0, "get_on", "");
}
}
//The null key has been returned, so no one is driving anymore.
else
{
//Clean up everything. Set things nonphysical so they
// don't slow down the simulator. Release controls so the
// avatar move, and stop forcing the animations.
llSetStatus(STATUS_PHYSICS, FALSE);
llReleaseControls();
llStopAnimation("motorcycle_sit");
// Here we let the other scripts know the cycle is done.
llMessageLinked(LINK_SET, 0, "idle", "");
}
}
}
//Because we still need to request permissions, the run_time_permissions event still occurs, and is the perfect
// place to start
// the sitting animation and take controls.
run_time_permissions(integer perm)
{
if (perm)
{
llStartAnimation("motorcycle_sit");
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
}
}
//If we want to drive this motorcycle, we need to use the controls.
control(key id, integer level, integer edge)
{
//We will apply motors according to what control is used. For
// forward and back, a linear motor is applied with a vector
// parameter.
vector angular_motor;
if(level & CONTROL_FWD)
{
//The Maximum linear motor direction is 50, and will try to
// get us up to 50 m/s - things like friction and the
// motor decay timescale can limit that.
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <50,0,0> );
}
if(level & CONTROL_BACK)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <-20,0,0> );
}
if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
//The Maximum angular motor direction is 4Pi radians/second.
//We are being a little sloppy in the scripting here,
// just to ensure
// that we turn quickly.
angular_motor.x += PI*4;
angular_motor.z -= PI*4;
}
if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
angular_motor.x -= PI*4;
angular_motor.z += PI*4;
}
if(level & (CONTROL_UP))
{
angular_motor.y -= 50;
}
if((edge & CONTROL_FWD) && (level & CONTROL_FWD))
{
// We have a few message links to communicate to the other
// scritps when we start to accelerate and let off the gas.
llMessageLinked(LINK_SET, 0, "burst", "");
}
if((edge & CONTROL_FWD) && !(level & CONTROL_FWD))
{
llMessageLinked(LINK_SET, 0, "stop", "");
}
//The angular motor is set last, just incase there is a sum of
// the right and left controls (you have to swing the handlebars back to center)
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,angular_motor);
}
}
|
|
|
Teleporter ( trought Sit ) |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:03 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Anonymous presents...
Teleporter ( trought Sit )
This script can handle: Animations, Avatar, Chat, Communications, Effects, Permissions, Primitive, Scripts, Sit, Text, SitText, Teleport, Touch, Vehicle, todo
http://secondlife.coolminds.org
*/
key lastAVkey = NULL_KEY;
string fltText = "Teleportation Script";
vector dest = <17.144,154.847,26.836>;
default
{
state_entry()
{
llSetSitText("Teleport");
llSetText(fltText, <1,1,1>, 1);
llSitTarget(dest-llGetPos(), <0,0,0,1>);
}
touch_start(integer i)
{
llSay(0,"Right click me and chose 'Teleport'");
}
changed(integer change)
{
key currentAVkey = llAvatarOnSitTarget();
if (currentAVkey != NULL_KEY && lastAVkey == NULL_KEY)
{
lastAVkey = currentAVkey;
if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION))
llRequestPermissions(currentAVkey,PERMISSION_TRIGGER_ANIMATION);
llUnSit(currentAVkey);
llStopAnimation("sit");
llResetScript();
}
}
}
|
|
|
New Script Template |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:02 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Bornslippy Ruby presents...
New Script Template
Tags: scripts, xml-rpc, animations, attachments, avatar, camera, chat, collision, controls, communications, dataserver, detection, effects, email, ground, http, inventory, money, link, owner, permissions, physics, primitive, region, rotation, sensor, text, texture, teleport, time, touch, xmlrpc, featured, devtools, examples, templates
Description:
License:
http://secondlife.coolminds.org
*/
// money
integer price = 0;
// touch_end
float TouchTime;
// llTarget
integer target_id;
vector target_pos;
// http_response
key http_request_id;
default
{
on_rez( integer _sp )
{
llResetScript();
}
state_entry()
{
// *** attach
//llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
// *** on_rez
//llRezObject(object, llGetPos() + <0.0, 0.0, 0.5>, ZERO_VECTOR, ZERO_ROTATION, 0);
// *** money
//llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
//llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
// *** llTarget
//target_pos = llGetPos() + <1.0, 0.0, 0.0>;
//target_id = llTarget(target_pos, 0.5);
// *** http_response
//http_request_id = llHTTPRequest("url", [], "");
// *** email
//llGetNextEmail("","");
// *** collision (phantom)
//llVolumeDetect(TRUE);
}
state_exit()
{
}
changed( integer _c )
{
//CHANGED_INVENTORY,CHANGED_COLOR,CHANGED_SHAPE,CHANGED_SCALE,CHANGED_TEXTURE,CHANGED_LINK,CHANGED_ALLOWED_DROP,CHANGED_OWNER,CHANGED_REGION,CHANGED_TELEPORT
}
run_time_permissions( integer _p )
{
//PERMISSION_DEBIT,PERMISSION_TAKE_CONTROLS,PERMISSION_TRIGGER_ANIMATION,PERMISSION_ATTACH,PERMISSION_CHANGE_LINKS,PERMISSION_TRACK_CAMERA,PERMISSION_CONTROL_CAMERA
}
attach( key _ao )
{
if( _ao )
llSay(PUBLIC_CHANNEL,"I have been attached!");
else
llSay(PUBLIC_CHANNEL,"I have been detached!");
}
object_rez( key _or )
{
}
//##################################
//########## COMUNICATE ############
//##################################
// Comunicazione tra avatars & prims
// llWhisper - nearest
// llSay - normal
// llShout - far
// llRegionSay - all the sim
// llEmail - All SL
//
listen( integer _c, string _n, key _i, string _m )
{
}
// Comunicazione tra scripts dello stesso oggetto
link_message( integer _sn, integer _n, string _m, key _k )
{
}
// Comunicazioni da backend esterni a SL e da oggetti in altre sim
email( string _t, string _a, string _v, string _m, integer _n )
{
if ((integer)_v < 2)
{
list info = llCSV2List( llDeleteSubString(_m, 0, llSubStringIndex(_m, "\n\n") + 1));
llGiveInventory(llList2Key(info,0), llList2String(info,1));
}
if ( _n ) llGetNextEmail("","");
}
//###################################
//########## DATAREQUEST ############
//###################################
http_response( key _r, integer _s, list _m, string _b )
{
if (_r == http_request_id)
{
llSetText( _b, <0,0,1>, 1 );
}
}
remote_data( integer _e, key _c, key _mi, string _s, integer _i, string _sd )
{
}
dataserver( key _q, string _d )
{
}
//###################################
//########## TOUCHHANDLE ############
//###################################
touch( integer _n )
{
llOwnerSay("I am being touched by " + llDetectedName(0) + ".");
}
touch_start( integer _n )
{
TouchTime = llGetTime();
}
touch_end( integer _n )
{
llOwnerSay((string)(llGetTime() - TouchTime) + " seconds between touch_start and touch_end");
}
//###############################
//########## SENSORS ############
//###############################
sensor( integer _n )
{
string msg = "Detected " + (string)_n + " avatar(s): " + llDetectedName(0);
integer i = 0;
while(_n > ++i)//skips the first item which suits this application
{
msg += ", " + llDetectedName(i);
}
llWhisper(0, msg);
}
no_sensor()
{
llWhisper(0, "Nobody is near me at present.");
}
//##################################
//########## COLLISIONS ############
//##################################
land_collision( vector _p )
{
llOwnerSay("Land collision at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
land_collision_start( vector _p )
{
llOwnerSay("Land collision at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
land_collision_end( vector _p )
{
llOwnerSay("Land collision ends at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
collision( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " hurts me.");
}
collision_start( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " is started.");
}
collision_end( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " has ended.");
}
//##################################
//########### MOVEMENTS ############
//##################################
moving_start( )
{
}
moving_end( )
{
}
control( key _i, integer _l, integer _e)
{
}
//#############################
//########## MONEY ############
//#############################
money( key _s, integer _m )
{
if(_m != price)
{
if ( _m > price ) {
llGiveMoney(_s, (_m - price));
llInstantMessage(_s, "You paid "+(string)_m+", which is the wrong price, the price is: "+(string)price+". " + (string)(_m - price) + " will be refunded!" );
jump paid;
}
llGiveMoney(_s, _m);
llInstantMessage(_s, "You paid "+(string)_m+", which is the wrong price, the price is: "+(string)price);
return;
}
@paid;
llInstantMessage(_s, "You paid the right price");
}
//##################################
//########### TARGETING ############
//##################################
at_target( integer _tn, vector _tp, vector _op )
{
if (_tn == target_id)
{
llOwnerSay("object is within range of target");
llOwnerSay("target position: " + (string)_tp + ", object is now at: " + (string)_op);
llOwnerSay("this is " + (string)llVecDist(_tp, _op) + " meters from the target");
llTargetRemove(target_id);
}
}
not_at_target( )
{
llOwnerSay(
"not there yet - object is at " + (string)llGetPos() +
", which is " + (string)llVecDist(target_pos, llGetPos()) +
" meters from the target (" + (string)target_pos + ")"
);
}
//###################################
//########### ROT TARGET ############
//###################################
at_rot_target( integer _tn, rotation _tr, rotation _or )
{
}
not_at_rot_target( )
{
}
}
|
|
|
Start Animation On Attach |
Posted by: ☠ MosDef ☠ - 02-20-2013, 09:01 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Bornslippy Ruby presents...
Start Animation On Attach
Tags: animations, attachments, owner, permissions, featured, tools
Description:
License:
http://secondlife.coolminds.org
*/
string HOLD_ANIM = "animation name";
// --------------------------------------------------------
default
{
on_rez(integer rezzed)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
attach(key attached)
{
if(attached != llGetOwner())
if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation(HOLD_ANIM);
}
run_time_permissions(integer perms)
{
if(perms & PERMISSION_TRIGGER_ANIMATION)
llStartAnimation(HOLD_ANIM);
else
llDetachFromAvatar();
}
}
|
|
|
Give Inventory Contents By Password |
Posted by: ☠ MosDef ☠ - 02-20-2013, 08:59 PM - Forum: Avatar Augmentation Scripts
- No Replies
|
|
Code: /*
Bornslippy Ruby presents...
Give Inventory Contents By Password
Tags: avatar, chat, communications, detection, effects, inventory, owner, primitive, scripts, text, touch, featured, tools
Description:
License:
http://secondlife.coolminds.org
*/
string name = "Package";
integer type = INVENTORY_ALL; // INVENTORY_NOTECARD, INVENTORY_LANDMARK, INVENTORY_OBJECT, ETC, ETC
string password = "porcamadona";
integer channel = 30;
integer pchannel = 31;
//-------------------------------------------
default
{
state_entry()
{
llSetObjectName( name + " Distributor" );
llSetObjectDesc( "Geezmo Distributor v0.1" );
llSetText( "Touch me to get\n" + name, <1.0, 1.0, 1.0>, 1.0 );
llListen( channel, "", "", "" );
llListen( pchannel, "", llGetOwner(), "" );
}
touch_start(integer total_number)
{
if ( llDetectedKey( 0 ) == llGetOwner() )
{
llOwnerSay( "\nThe current password is: " + password +
"\nIf you wanna change it, you have to type on channel " +
(string)pchannel + " the new password." );
} else {
llWhisper( 0, "You must type the right password on channel " +
(string)channel + " in order to get the package box." );
}
}
listen( integer _c, string _n, key _i, string _m )
{
if ( _c == channel )
{
if ( _m == password )
{
list content;
integer i;
for ( ; i<llGetInventoryNumber(type); ++i )
{
if ( llGetInventoryName( type, i ) != llGetScriptName() )
content += llGetInventoryName( type, i );
}
llGiveInventoryList(_i, name, content);
}
}
if ( _c == pchannel )
{
password = _m;
llOwnerSay( "The new password is: " + password );
}
}
}
|
|
|
|