https://wiki.secondlife.com/w/api.php?action=feedcontributions&user=Bellimora+Resident&feedformat=atomSecond Life Wiki - User contributions [en]2024-03-28T22:58:49ZUser contributionsMediaWiki 1.36.1https://wiki.secondlife.com/w/index.php?title=LlPushObject/Havok4Implementation&diff=1196512LlPushObject/Havok4Implementation2015-05-15T02:23:03Z<p>Bellimora Resident: swapped inactive <cpp> tag with <source> tags</p>
<hr />
<div><source lang="cpp">// This is not quite pseudo code for how the llPushObject() effect is computed.<br />
// Really it is simplified C++ code that doesn't quite reflect our true API<br />
// (for instance, the LLObject class doesn't actually exist), but it is a<br />
// fairly accurate outline of what is going on. This code probably doesn't<br />
// compile. Fix any syntax errors you find -- it's a wiki! -- Andrew<br />
//<br />
void llPushObject( <br />
const LLObject& pusher, <br />
const LLObject& pushee, <br />
const LLVector3& linear_impulse, <br />
const LLVector3& angular_impulse, <br />
bool use_pushee_local_frame )<br />
{<br />
LLPhysicsBody& pushee_body = pushee.getPhysicsBody(); <br />
if (!pushee_body || pushee_body.isKeyframed() )<br />
{<br />
// some objects don't have collidable bodies (trees, grass)<br />
// and keyframed (non-dynamic) objects can't move<br />
return;<br />
}<br />
<br />
if ( pushee.isAvatar()<br />
&& pushee.isGod()<br />
&& pusher.getOwnerID() != pushee.getID() )<br />
{<br />
// avatars in admin mode cannot be pushed <br />
// unless they are the pusher's owner<br />
return;<br />
}<br />
<br />
// How much effect an llPushObject() call has depends on whether<br />
// the pusher had enough "script energy" to execute. If the pusher<br />
// only has half of the required energy then it will push, but the<br />
// effect of the push is reduced to half of what it would be, and the<br />
// pusher is left with zero energy at the end.<br />
//<br />
// The "script energy" system was implemented waaaaay back in the beginning<br />
// and was done for a few reasons: (1) as a pre-emptive goo and grief<br />
// throttle for problems that we expected to encounter (certain operations<br />
// cost energy, and hence an one object's effectiveness is throttled by its<br />
// energy budget) and (2) to provide a sort of balance/tradeoff when<br />
// designing in-world objects that had some sort of gaming application (big<br />
// guns should have more potency than small guns, hence the larger the<br />
// object the more energy).<br />
//<br />
// In any case, the energy bugdet is recovered at some fixed rate over time<br />
// but the holding tank of each object depends on its mass, up to some<br />
// maximum.<br />
//<br />
// Way back in in 2003 or so we added a distance^3 term to the cost of<br />
// llPushObject() designed prevent huge impulses from pushing people<br />
// around. Unfortunately the original implementation was severely flawed<br />
// in a particular way -- the term was additive instead multiplicative.<br />
// The cube power gets big fast, but not all that big or fast. If the<br />
// original push magnitude dwarfed the cubed term then you still ended up<br />
// with a giant effect. In other words: <br />
//<br />
// 10^26 * (energy_recovered_during_last_frame) = Very_Big_Number<br />
//<br />
F32 distance = (pushee.getPosition() - pusher.getPosition()).length();<br />
F32 distance_term = distance * distance * distance * SCRIPT_ENERGY_PER_METER_AWAY;<br />
<br />
// How to fix this? We can't change the energy consumption since<br />
// lots of Residents have tuned their pushers just right. But we<br />
// don't want arbitrarily high impulses over arbitrarily large <br />
// distances. So here's what we'll do:<br />
//<br />
// (1) clamp obnoxiously large impulses (after the energy consumption)<br />
// (2) actually attenuate the impulse by distances that are beyond<br />
// some threshold<br />
<br />
F32 pusher_mass = pusher.getMass();<br />
<br />
// (2) we compute the distance attenuation factor early since it applies to<br />
// both the linear and angular cases. This attenuates pushes that are<br />
// beyond (max_distance + 1) <br />
F32 PUSH_ATTENUATION_DISTANCE = 17.f;<br />
F32 PUSH_ATTENUATION_SCALE = 5.f;<br />
F32 distance_attenuation = 1.f;<br />
if (distance > PUSH_ATTENUATION_DISTANCE)<br />
{<br />
// +1 below to avoid the asymptotic part of 1/x<br />
F32 normalized_units = 1.f + (distance - PUSH_ATTENUATION_DISTANCE) / PUSH_ATTENUATION_SCALE;<br />
distance_attenuation = 1.f / normalized_units;<br />
}<br />
<br />
// linear<br />
LLVector3 applied_linear_impulse = linear_impulse;<br />
{<br />
// consume energy according to the intended impulses<br />
F32 impulse_length = linear_impulse.length();<br />
<br />
// NOTE: the pusher_mass factor in the desired_energy calculation <br />
// is just wrong, it should be the pushee_mass, but now that it<br />
// has been wrong for years we can't fix it!<br />
F32 desired_energy = impulse_length * SCRIPT_ENERGY_PER_MOMENTUM * pusher_mass;<br />
if (desired_energy > 0.f)<br />
{<br />
desired_energy += distance_term;<br />
}<br />
<br />
// LLObject::consumeEnergy() returns 1 if there is enough energy,<br />
// else returns the fraction of energy available.<br />
F32 scaling_factor = pusher.consumeEnergy(desired_energy);<br />
<br />
// (1) clamp obnoxiously large impulses<br />
// the max push possible is what it would take to levitate the<br />
// smallest object that has the max script energy<br />
F32 max_push_impulse_length = MAX_ENERGY_MASS * fabsf(GRAVITY) * PHYSICS_TIMESTEP;<br />
if (impulse_length > max_push_impulse_length)<br />
{<br />
// reduce the scaling factor by the ratio<br />
scaling_factor *= max_push_impulse_length / impulse_length;<br />
}<br />
<br />
// (2) attenuate pushes that are from very far away<br />
scaling_factor *= distance_attenuation;<br />
<br />
applied_linear_impulse *= scaling_factor;<br />
}<br />
<br />
// angular<br />
LLVector3 applied_angular_impulse = angular_impulse;<br />
{<br />
// NOTE: same comments here as to the incorrectness of the mass units<br />
// with an extra problem: the angular energy consumption should be<br />
// proportional to the actual change of angular momentum (i.e. should<br />
// involve the inertia tensor) so the linear mass factor here is not<br />
// only from the wrong object but is also the wrong property. Oh well.<br />
F32 desired_energy = angular_impulse.length() * SCRIPT_ENERGY_PER_MOMENTUM * pusher_mass;<br />
if (desired_energy > 0.f)<br />
{<br />
desired_energy += distance_term;<br />
}<br />
<br />
// consume energy<br />
F32 scaling_factor = distance_attenuation * pusher.consumeEnergy(desired_energy);<br />
<br />
// (1) clamp obnoxiously large impulses<br />
F32 impulse_length = angular_impulse.length();<br />
if (impulse_length > max_push_impulse_length)<br />
{<br />
scaling_factor *= max_push_impulse_length / impulse_length;<br />
}<br />
<br />
// (2) attenuate pushes that are from very far away<br />
scaling_factor *= distance_attenuation;<br />
<br />
applied_angular_impulse *= scaling_factor;<br />
}<br />
<br />
if ( use_pushee_local_frame )<br />
{<br />
// rotate the directions of the impulses into the pushee's local frame<br />
LLQuaternion rotation = pushee.getRotation();<br />
applied_linear_impulse *= rotation;<br />
applied_angular_impulse *= rotation;<br />
}<br />
<br />
if (pushee.isAvatar())<br />
{<br />
// NOTE: we ignore the angular part since the avatar cannot yet be spun<br />
// from external or attachment forces<br />
if (pusher.isAttachment()<br />
&& pusher.getAvatarID() == pushee.getID())<br />
{<br />
// this is an attachment pushing its avatar, so the push must go<br />
// through the avatar controller which will guard against too fast<br />
// velocities and do the right thing for the current movement mode<br />
pushee.getAvatarController().accumulateAttachmentImpulse(applied_linear_impulse);<br />
}<br />
else<br />
{<br />
// this is an attachment pushing another avatar, so the push must<br />
// go through the avatar controller which will gaurd against too<br />
// fast velocities and do the right thing for current movement mode<br />
pushee.getAvatarController().applyExternalImpulse(applied_linear_impulse);<br />
}<br />
}<br />
else<br />
{<br />
pushee_body.applyImpulse(applied_linear_impulse);<br />
pushee_body.applyAngularImpulse(applied_angular_impulse);<br />
}<br />
}</source></div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=LlTeleportAgent&diff=1195551LlTeleportAgent2015-02-13T20:47:28Z<p>Bellimora Resident: Added a caveat mentioning special behavior if this function is called as part of an experience.</p>
<hr />
<div>{{LSL_Function<br />
|inject-2={{LSL Function/avatar|avatar|region=*}}{{LSL Function/inventory|landmark|type=landmark|uuid=false|empty=(for teleporting within the same region)}}{{Issues/BUG-4062}}<br />
|inject-3={{LSL_Function/permission|PERMISSION_TELEPORT|grant={{LSLP|avatar}}}}<br />
|func=llTeleportAgent<br />
|sort=TeleportAgent<br />
|p1_type=key|p1_name=avatar|p1_desc=&#32;(the avatar to teleport, must be the [[llGetOwner|owner]])|p1_hover=&#32;(the avatar to teleport, must be the owner)<br />
|p2_type=string|p2_name=landmark|p2_desc<br />
|p3_type=vector|p3_name=position|p3_desc=The position within the local region to teleport the avatar to if no landmark was provided.<br />
|p4_type=vector|p4_name=look_at|p4_desc=The position within the target region that the avatar should be turned to face upon arrival.<br />
|func_desc=Requests a teleport of {{LSLP|avatar}} to a {{LSLP|landmark}} stored in the object's inventory. If no landmark is provided (an empty string), the avatar is teleported to the location {{LSLP|position}} in the current region. In either case, the avatar is turned to face the position given by {{LSLP|look_at}} in local coordinates.<br />
|func_footnote<br />
|caveats=<br />
* '''This function can only teleport the owner of the object.''' If it is part of an experience<br />
* Teleports are throttled<br />
* This function cannot be used in a script in an object attached using [[llAttachToAvatarTemp]].<br />
* Sitting avatars cannot be teleported using this function. You must [[llUnSit]] them first.<br />
* This function does not override a parcel's teleport settings, i.e. if the parcel has a landing zone enabled the agent will be teleported there.<br />
* If the script is part of an experience that the avatar has granted permission, then this function may teleport them without being the owner and it will override parcel teleport routing.<br />
|examples=<br />
'''Without a landmark in the object's inventory'''<br />
<source lang="lsl2">key teleportee;<br />
<br />
default<br />
{<br />
state_entry()<br />
{<br />
llSay(0, "Touch to teleport");<br />
}<br />
<br />
touch_start(integer total_num)<br />
{<br />
teleportee = llDetectedKey(0);<br />
llRequestPermissions(teleportee, PERMISSION_TELEPORT);<br />
}<br />
<br />
run_time_permissions(integer perm)<br />
{<br />
if(PERMISSION_TELEPORT & perm)<br />
{<br />
llTeleportAgent(teleportee, "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);<br />
}<br />
}<br />
}<br />
</source><br />
'''With a landmark in the objects inventory'''<br />
<source lang="lsl2"><br />
key teleportee;<br />
<br />
default<br />
{<br />
state_entry()<br />
{<br />
llSay(0, "Touch to teleport");<br />
}<br />
<br />
touch_start(integer total_num)<br />
{<br />
teleportee = llDetectedKey(0);<br />
llRequestPermissions(teleportee, PERMISSION_TELEPORT);<br />
}<br />
<br />
run_time_permissions(integer perm)<br />
{<br />
if(PERMISSION_TELEPORT & perm)<br />
{<br />
llTeleportAgent(teleportee, "Experience Tools 1", <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>);<br />
}<br />
}<br />
}<br />
</source><br />
|also_functions=<br />
{{LSL DefineRow||[[llTeleportAgentGlobalCoords]]|Teleports an agent to a global position.}}<br />
|notes=<br />
|cat1=Teleport<br />
|cat2<br />
|cat3<br />
|history = Date of Release [[ Release_Notes/Second_Life_Server/12#12.07.24.262437 | 24/07/2012 ]]<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=VEHICLE_TYPE_BALLOON&diff=1194679VEHICLE TYPE BALLOON2015-01-23T23:26:34Z<p>Bellimora Resident: Swapped the <lsl> tags for <source> tags so the code example displays properly</p>
<hr />
<div>{{LSL Constant<br />
|name={{PAGENAMEE}}<br />
|type=integer<br />
|value=5<br />
|desc=Hover, and friction, but no deflection.<br />
<br />
===Effects===<br />
Setting the vehicle type to balloon enables the vehicle system and additionally has the same effect of executing the following:<br />
<source lang="lsl2"><br />
// uniform linear friction<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, 5 );<br />
// uniform angular friction<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 10 );<br />
// linear motor<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );<br />
// agular motor<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 6 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 10 );<br />
// hover<br />
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 5 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.8 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 );<br />
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );<br />
// no linear deflection<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 5 );<br />
// no angular deflection<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 5 );<br />
// no vertical attractor<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1 );<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1000 );<br />
// no banking<br />
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 0 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.7 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 5 );<br />
// default rotation of local frame<br />
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );<br />
// remove all flags<br />
llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP<br />
| VEHICLE_FLAG_HOVER_WATER_ONLY<br />
| VEHICLE_FLAG_LIMIT_ROLL_ONLY<br />
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY<br />
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT<br />
| VEHICLE_FLAG_HOVER_UP_ONLY<br />
| VEHICLE_FLAG_LIMIT_MOTOR_UP );<br />
</source><br />
|examples<br />
|constants={{!}} {{LSL Constants/Vehicle Types}}<br />
|functions={{LSL DefineRow||[[llSetVehicleType]]}}<br />
|events<br />
|articles<br />
|cat1=Vehicle/Types<br />
|cat2<br />
|cat3<br />
|cat4<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=VEHICLE_TYPE_AIRPLANE&diff=1194642VEHICLE TYPE AIRPLANE2015-01-23T22:39:28Z<p>Bellimora Resident: Swapped the <lsl> tags to <source> tags so the example code displays properly.</p>
<hr />
<div>{{LSL Constant<br />
|name={{PAGENAMEE}}<br />
|type=integer<br />
|value=4<br />
|examples<br />
|desc=Uses linear deflection for lift, no hover, and banking to turn.<br />
<br />
===Effects===<br />
Setting the vehicle type to airplane enables the vehicle system and additionally has the same effect of executing the following:<br />
<source lang="lsl2"><br />
// very little friction along forward-back axis<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <200, 10, 5> );<br />
// uniform angular friction<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 20 );<br />
// linear motor<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 2 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );<br />
// agular motor<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 4 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 8 );<br />
// no hover<br />
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000 );<br />
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );<br />
// linear deflection<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.5 );<br />
// angular deflection<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 1.0 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 2.0 );<br />
// vertical attractor<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.9 );<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 2 );<br />
// banking<br />
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.7 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 2 );<br />
// default rotation of local frame<br />
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );<br />
// remove these flags<br />
llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP<br />
| VEHICLE_FLAG_HOVER_WATER_ONLY<br />
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY<br />
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT<br />
| VEHICLE_FLAG_HOVER_UP_ONLY<br />
| VEHICLE_FLAG_LIMIT_MOTOR_UP );<br />
// set these flags<br />
llSetVehicleFlags( VEHICLE_FLAG_LIMIT_ROLL_ONLY );<br />
</source><br />
|constants={{!}} {{LSL Constants/Vehicle Types}}<br />
|functions={{LSL DefineRow||[[llSetVehicleType]]}}<br />
|events<br />
|articles<br />
|cat1=Vehicle/Types<br />
|cat2<br />
|cat3<br />
|cat4<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=VEHICLE_TYPE_BOAT&diff=1194635VEHICLE TYPE BOAT2015-01-23T22:24:55Z<p>Bellimora Resident: Changed <lsl> tags to <source> tags so the example code displays properly</p>
<hr />
<div>{{LSL Constant<br />
|name={{PAGENAMEE}}<br />
|type=integer<br />
|value=3<br />
|examples<br />
|desc=Hovers over water with lots of friction and some anglar deflection.<br />
<br />
===Effects===<br />
Setting the vehicle type to boat enables the vehicle system and additionally has the same effect of executing the following:<br />
<source lang="lsl2"><br />
// least for forward-back, most friction for up-down<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <10, 3, 2> );<br />
// uniform angular friction (setting it as a scalar rather than a vector)<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, 10 );<br />
// linear motor wins after about five seconds, decays after about a minute<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 5 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );<br />
// agular motor wins after four seconds, decays in same amount of time<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 4 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 4 );<br />
// hover<br />
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 2.0 );<br />
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 );<br />
// halfway linear deflection with timescale of 3 seconds<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 3 );<br />
// angular deflection<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 5 );<br />
// somewhat bounscy vertical attractor<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 5 );<br />
// weak negative damped banking<br />
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, -0.3 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 0.8 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 1 );<br />
// default rotation of local frame<br />
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );<br />
// remove these flags<br />
llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_TERRAIN_ONLY<br />
| VEHICLE_FLAG_LIMIT_ROLL_ONLY<br />
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);<br />
// set these flags<br />
llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP<br />
| VEHICLE_FLAG_HOVER_WATER_ONLY<br />
| VEHICLE_FLAG_HOVER_UP_ONLY<br />
| VEHICLE_FLAG_LIMIT_MOTOR_UP );<br />
</source><br />
|constants={{!}} {{LSL Constants/Vehicle Types}}<br />
|functions={{LSL DefineRow||[[llSetVehicleType]]}}<br />
|events<br />
|articles<br />
|cat1=Vehicle/Types<br />
|cat2<br />
|cat3<br />
|cat4<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=VEHICLE_TYPE_SLED&diff=1194634VEHICLE TYPE SLED2015-01-23T22:21:59Z<p>Bellimora Resident: Changed <lsl> tags to <source> tags so the code shows properly.</p>
<hr />
<div>{{LSL Constant<br />
|name={{PAGENAMEE}}<br />
|type=integer<br />
|value=1<br />
|examples<br />
|desc=Simple vehicle that bumps along the ground, and likes to move along it’s local x-axis.<br />
<br />
===Effects===<br />
Setting the vehicle type to sled enables the vehicle system and additionally has the same effect of executing the following:<br />
<source lang="lsl2">// most friction for left-right, least for up-down<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <30.0, 1.0, 1000.0> );<br />
// no angular friction<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000.0, 1000.0, 1000.0> );<br />
// no linear motor<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0.0, 0.0, 0.0> );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 1000.0 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 120.0 );<br />
// no agular motor<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0.0, 0.0, 0.0> );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1000.0 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 120.0 );<br />
// no hover (but with timescale of 10 sec if enabled)<br />
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0.0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 10.0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10.0 );<br />
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0.0 );<br />
// maximum linear deflection with timescale of 1 second<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 1.0 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1.0 );<br />
// no angular deflection<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.0 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10.0 );<br />
// no vertical attractor (doesn’t mind flipping over)<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1.0 );<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1000.0 );<br />
// no banking<br />
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 0.0 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1.0 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 10.0 );<br />
// default rotation of local frame<br />
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0.0, 0.0, 0.0, 1.0> );<br />
// remove these flags<br />
llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_WATER_ONLY<br />
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY<br />
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT<br />
| VEHICLE_FLAG_HOVER_UP_ONLY );<br />
// until banking is enabled, if ever)<br />
llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP<br />
| VEHICLE_FLAG_LIMIT_ROLL_ONLY<br />
| VEHICLE_FLAG_LIMIT_MOTOR_UP );</source><br />
|constants={{!}} {{LSL Constants/Vehicle Types}}<br />
|functions={{LSL DefineRow||[[llSetVehicleType]]}}<br />
|events<br />
|articles<br />
|cat1=Vehicle/Types<br />
|cat2<br />
|cat3<br />
|cat4<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=VEHICLE_TYPE_CAR&diff=1194633VEHICLE TYPE CAR2015-01-23T22:20:53Z<p>Bellimora Resident: changed <lsl> tags to <source> tags</p>
<hr />
<div>{{LSL Constant<br />
|name={{PAGENAMEE}}<br />
|type=integer<br />
|value=2<br />
|examples<br />
|desc=Another vehicle that bounces along the ground but needs the motors to be driven from external controls or<br />
[[timer]] events.<br />
<br />
===Effects===<br />
Setting the vehicle type to car enables the vehicle system and additionally has the same effect of executing the following:<br />
<source lang="lsl2"><br />
// most friction for left-right, least for up-down<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <100, 2, 1000> );<br />
// no angular friction<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 1000> );<br />
// linear motor wins after about a second, decays after about a minute<br />
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 1 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 60 );<br />
// agular motor wins after a second, decays in less time than that<br />
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.8 );<br />
// no hover<br />
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 );<br />
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000 );<br />
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );<br />
// maximum linear deflection with timescale of 2 seconds<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 1 );<br />
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 2 );<br />
// no angular deflection<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0 );<br />
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 10 );<br />
// critically damped vertical attractor<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1 );<br />
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 10 );<br />
// weak negative critically damped banking<br />
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, -0.2 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1 );<br />
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 1 );<br />
// default rotation of local frame<br />
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0, 0, 0, 1> );<br />
// remove these flags<br />
llRemoveVehicleFlags( VEHICLE_FLAG_HOVER_WATER_ONLY<br />
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY<br />
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT);<br />
// set these flags<br />
llSetVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP<br />
| VEHICLE_FLAG_LIMIT_ROLL_ONLY<br />
| VEHICLE_FLAG_HOVER_UP_ONLY<br />
| VEHICLE_FLAG_LIMIT_MOTOR_UP );<br />
</source><br />
|constants={{!}} {{LSL Constants/Vehicle Types}}<br />
|functions={{LSL DefineRow||[[llSetVehicleType]]}}<br />
|events<br />
|articles<br />
|cat1=Vehicle/Types<br />
|cat2<br />
|cat3<br />
|cat4<br />
}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=LlKeysKeyValue&diff=1192711LlKeysKeyValue2014-08-13T23:01:00Z<p>Bellimora Resident: Example code would not compile due to a number of issues. I've attempted to address those issues</p>
<hr />
<div>[[Category:Experience Tools]]<br />
{{LSL_Function<br />
|inject-2={{LSL Function/KeyValue|dl_name=keys<br />
|dl_desc=A list of keys ([[String|strings]]) used in the key-value store<br />
|dl_hover=A list of keys (strings) used in the key-value store}}<br />
|func=llKeysKeyValue<br />
|func_desc=Start an asynchronous transaction to request a number of keys.<br />
|func_footnote=<br />
This function will attempt to retrieve the number of keys requested but may return less if there are not enough to fulfill the full amount requested or if the list is too large. The order keys are returned is not guaranteed but is stable between subsequent calls as long as no keys are added or removed.<br/><br />
The error [[XP_ERROR_KEY_NOT_FOUND]] is returned if there index given is greater than or equal to the number of keys.<br />
|return_type=key|return_subtype=handle<br />
|return_text=that can be used to identify the corresponding [[dataserver]] event to determine if this command succeeded or failed.<br />
|p1_type=integer|p1_name=first|p1_desc=Zero-based index of the first key to retrieve<br />
|p2_type=integer|p2_name=count|p2_desc=Number of keys to retriever<br />
|also_functions=<br />
*[[llGetExperienceErrorMessage]]<br />
*[[llCreateKeyValue]]<br />
*[[llReadKeyValue]]<br />
*[[llUpdateKeyValue]]<br />
*[[llDeleteKeyValue]]<br />
*[[llDataSizeKeyValue]]<br />
*[[llKeyCountKeyValue]]<br />
*[[llKeysKeyValue]]<br />
|examples=<lsl>key trans;<br />
default<br />
{<br />
state_entry()<br />
{<br />
// retrieve the first 10 keys<br />
trans = llKeysKeyValue(0, 10);<br />
}<br />
dataserver(key t, string value)<br />
{<br />
if (t == trans)<br />
{<br />
// our llKeyKeyKeyValue transaction is done<br />
list result = llCSV2List(value);<br />
if (llList2Integer(result, 0) == 1)<br />
{<br />
llSay(0, "Keys retrieved: "+(string)llGetSubString(value, 2, -1));<br />
}<br />
else if (llList2Integer(result, 1) == XP_ERROR_KEY_NOT_FOUND)<br />
{<br />
// no more keys<br />
llSay(0, "No more keys" );<br />
}<br />
else<br />
{<br />
// keys request failed<br />
llSay(0, "Key-value failed to request keys: " + llGetExperienceErrorMessage(llList2Integer(result, 1)) );<br />
}<br />
} <br />
}<br />
}</lsl>}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=Category:Experience_Tools&diff=1192710Category:Experience Tools2014-08-13T17:50:43Z<p>Bellimora Resident: /* Experience Persistent Storage */ - listed first variable as a key type for the persistent storage functions, it actually takes a string</p>
<hr />
<div>{{LSL Header|ml=*}}<br />
{{RightToc}}Experience Tools provide a way to request persistent permissions across multiple logins and with multiple objects and scripts. In order to use these functions, you must have an ''experience key''. For further information, see [http://community.secondlife.com/t5/English-Knowledge-Base/Experiences-in-Second-Life/ta-p/2744686 Experiences in Second Life] in the Second Life Knowledge Base.<br />
<br />
The Experience Tools API fall into three categories:<br />
<br />
== Experience Information ==<br />
{|<br />
{{LSL DefineRow|integer|[[llAgentInExperience]](key agent)}}<br />
{{LSL DefineRow|list|[[llGetExperienceDetails]](key experience_id)}}<br />
|}<br />
<br />
== Experience Permissions ==<br />
{|<br />
{{LSL DefineRow|event|[[experience_permissions]](key agent)}}<br />
{{LSL DefineRow|event|[[experience_permissions_denied]](key agent, integer reason)}}<br />
{{LSL DefineRow|void|[[llRequestExperiencePermissions]](key agent, string name)}}<br />
|}<br />
<br />
== Experience Persistent Storage==<br />
These are all asynchronous functions, they all return a {{LSLGC|Key/handle|handle}} that corresponds to a [[dataserver]] event.<br />
{|<br />
{{LSL DefineRow|key|[[llReadKeyValue]](string k)}}<br />
{{LSL DefineRow|key|[[llCreateKeyValue]](string k, string v)}}<br />
{{LSL DefineRow|key|[[llUpdateKeyValue]](string k, string v)}}<br />
{{LSL DefineRow|key|[[llDeleteKeyValue]](string k)}}<br />
|}<br />
<br />
===Debugging===<br />
{|<br />
{{LSL DefineRow|key|[[llDataSizeKeyValue]]()|Gets the number of bytes used by the experience along with the experience's byte quote}}<br />
{{LSL DefineRow|key|[[llKeysKeyValue]](integer start, integer count)|Gets the names of the keys}}<br />
{{LSL DefineRow|key|[[llKeyCountKeyValue]]()|Gets the number of keys}}<br />
{{LSL DefineRow|string|[[llGetExperienceErrorMessage]](integer value)|Converts an integer error code to a wordy string representation}}<br />
|}<br />
{{LSL Constants/Experience Tools Errors}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=Category:Experience_Tools&diff=1192666Category:Experience Tools2014-08-12T09:44:26Z<p>Bellimora Resident: /* Experience Permissions */</p>
<hr />
<div>{{LSL Header|ml=*}}<br />
{{RightToc}}Experience Tools provide a way to request persistent permissions across multiple logins and with multiple objects and scripts. In order to use these functions, you must have an ''experience key''. For further information, see [http://community.secondlife.com/t5/English-Knowledge-Base/Experiences-in-Second-Life/ta-p/2744686 Experiences in Second Life] in the Second Life Knowledge Base.<br />
<br />
The Experience Tools API fall into three categories:<br />
<br />
== Experience Information ==<br />
{|<br />
{{LSL DefineRow|integer|[[llAgentInExperience]](key agent)}}<br />
{{LSL DefineRow|list|[[llGetExperienceDetails]](key experience_id)}}<br />
|}<br />
<br />
== Experience Permissions ==<br />
{|<br />
{{LSL DefineRow|event|[[experience_permissions]](key agent)}}<br />
{{LSL DefineRow|event|[[experience_permissions_denied]](key agent, integer reason)}}<br />
{{LSL DefineRow|void|[[llRequestExperiencePermissions]](key agent, string name)}}<br />
|}<br />
<br />
== Experience Persistent Storage==<br />
These are all asynchronous functions, they all return a {{LSLGC|Key/handle|handle}} that corresponds to a [[dataserver]] event.<br />
{|<br />
{{LSL DefineRow|key|[[llReadKeyValue]](key k)}}<br />
{{LSL DefineRow|key|[[llCreateKeyValue]](key k, string v)}}<br />
{{LSL DefineRow|key|[[llUpdateKeyValue]](key k, string v)}}<br />
{{LSL DefineRow|key|[[llDeleteKeyValue]](key k)}}<br />
|}<br />
<br />
===Debugging===<br />
{|<br />
{{LSL DefineRow|key|[[llDataSizeKeyValue]]()|Gets the number of bytes used by the experience along with the experience's byte quote}}<br />
{{LSL DefineRow|key|[[llKeysKeyValue]](integer start, integer count)|Gets the names of the keys}}<br />
{{LSL DefineRow|key|[[llKeyCountKeyValue]]()|Gets the number of keys}}<br />
{{LSL DefineRow|string|[[llGetExperienceErrorMessage]](integer value)|Converts an integer error code to a wordy string representation}}<br />
|}<br />
{{LSL Constants/Experience Tools Errors}}</div>Bellimora Residenthttps://wiki.secondlife.com/w/index.php?title=Category:Experience_Tools&diff=1192665Category:Experience Tools2014-08-12T09:44:04Z<p>Bellimora Resident: /* Experience Information */</p>
<hr />
<div>{{LSL Header|ml=*}}<br />
{{RightToc}}Experience Tools provide a way to request persistent permissions across multiple logins and with multiple objects and scripts. In order to use these functions, you must have an ''experience key''. For further information, see [http://community.secondlife.com/t5/English-Knowledge-Base/Experiences-in-Second-Life/ta-p/2744686 Experiences in Second Life] in the Second Life Knowledge Base.<br />
<br />
The Experience Tools API fall into three categories:<br />
<br />
== Experience Information ==<br />
{|<br />
{{LSL DefineRow|integer|[[llAgentInExperience]](key agent)}}<br />
{{LSL DefineRow|list|[[llGetExperienceDetails]](key experience_id)}}<br />
|}<br />
<br />
== Experience Permissions ==<br />
{|<br />
{{LSL DefineRow|event|[[experience_permissions]](key agent)}}<br />
{{LSL DefineRow|event|[[experience_permissions_denied]](key agent, integer reason)}}<br />
{{LSL DefineRow|void|[[llRequestExperiencePermissions]](key agent)}}<br />
|}<br />
<br />
== Experience Persistent Storage==<br />
These are all asynchronous functions, they all return a {{LSLGC|Key/handle|handle}} that corresponds to a [[dataserver]] event.<br />
{|<br />
{{LSL DefineRow|key|[[llReadKeyValue]](key k)}}<br />
{{LSL DefineRow|key|[[llCreateKeyValue]](key k, string v)}}<br />
{{LSL DefineRow|key|[[llUpdateKeyValue]](key k, string v)}}<br />
{{LSL DefineRow|key|[[llDeleteKeyValue]](key k)}}<br />
|}<br />
<br />
===Debugging===<br />
{|<br />
{{LSL DefineRow|key|[[llDataSizeKeyValue]]()|Gets the number of bytes used by the experience along with the experience's byte quote}}<br />
{{LSL DefineRow|key|[[llKeysKeyValue]](integer start, integer count)|Gets the names of the keys}}<br />
{{LSL DefineRow|key|[[llKeyCountKeyValue]]()|Gets the number of keys}}<br />
{{LSL DefineRow|string|[[llGetExperienceErrorMessage]](integer value)|Converts an integer error code to a wordy string representation}}<br />
|}<br />
{{LSL Constants/Experience Tools Errors}}</div>Bellimora Resident