Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Having problem with motorcycle script.

Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-26-2006 14:14
All of a sudden for some unknown reason, my motorcycle I made just.. BROKE.


Now when I get on my bike I get this error.

"Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set"

And of course it's not triggering the Motorcycle animation or responding in anyway like it did before.

I tried removing the script from the motorcycle (as well as all of the other ones) and I just put main motorcycle script back in.. AND GOT THE SAME ERROR!!

I tried the same script in a different motorcycle design I made and it worked fine.

WTF is going on here? It's really ticking me off!

Here is a copy of the script. Can you please tell me just what is going on before I smash my keyboard against my monitor in frustration here? I do not want to have to recreate this motorcycle again.

CODE


default
{
state_entry ()
{
llPassCollisions(TRUE);
llPassTouches(TRUE);
llSetSitText("Ride");
llSitTarget(<0.6,0,0.25>, ZERO_ROTATION);
llSetCameraEyeOffset(<-7.0, 0.0, 1.0>);
llSetCameraAtOffset(<3.0, 0.0, 2.0>);
llSetVehicleType(VEHICLE_TYPE_CAR);
llSetVehicleFlags(VEHICLE_FLAG_CAMERA_DECOUPLED
| VEHICLE_FLAG_LIMIT_MOTOR_UP
| VEHICLE_FLAG_MOUSELOOK_BANK
);

//Controls how easy it glides along the ground.
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 0, 1000> );
//Controls how easy the vehicle rotates.
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 0> );

//Determines how long it takes for the motor to push the vehicle to full speed. Its minimum value is approximately 0.06 seconds.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 2.5 );
//Controls the deceleration to zero velocity from the time you let go of the pedal.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 1.0 );

llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.0 );

//Controls the max turning rate.
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <4*PI, 2*PI, 0> );
//Controls the time it takes for the turning rate to accelerate to max velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.0 );
//Controls the time it takes for the turning rate to decelerate to zero velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.0 );

//Controls how strong the force for the bike to remain vertical
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );
//Controls the time it takes for the bike to lean.
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.5 );

llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 0.0 );
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
//Security Program Begin
if (agent != llGetOwner())
{
llSay(0, "You are not the owner of this vehicle. Please step away.");
llUnSit(agent);
llPushObject(agent,<0,0,10>, ZERO_VECTOR, FALSE);
}
else
//Securty Program End
{
llSetStatus(STATUS_PHYSICS, TRUE);
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
llOwnerSay("'W' Accelerates, 'S' Decelerates/Reverse. Use Mouselook to Steer.");
}
}
else
{
llSetStatus(STATUS_PHYSICS, FALSE);
llReleaseControls();
llStopAnimation("motorcycle_sit");
}
}
}

run_time_permissions(integer perm)
{
if (perm)
{
llStartAnimation("motorcycle_sit");
llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}
}
control(key id, integer level, integer edge)
{
if(level & CONTROL_FWD)
{
//This sets the max velocity the vehicle will achive by meters/second
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<50,0,0>);
}
if(level & CONTROL_BACK)
{
//This sets the max velocity the vehicle will achive by meters/second
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<-50,0,0>);
}
}
}



Note: I just gave a copy of the bike in question just now and the bike worked fine for them. But when I try and get on it, I get the error. WTF!? O.o
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-26-2006 14:50
From: Kwipper Manimal
All of a sudden for some unknown reason, my motorcycle I made just.. BROKE.
I think it started out broke, because you're not verifying that you have each specific permission before using it. Here's some things I see right off the bat:

CODE
// On standing up...
//... Permissions may already be revoked on standing ...
else
{
integer p = llGetPermissions();
llSetStatus(STATUS_PHYSICS, FALSE);
if(p & PERMISSION_TAKE_CONTROLS)
llReleaseControls();
if(p & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation("motorcycle_sit");
}

//... may be called multiple times ...
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("motorcycle_sit");
}
if(perm & PERMISSION_TAKE_CONTROLS)
llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}
Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-26-2006 14:54
From: Argent Stonecutter
I think it started out broke, because you're not verifying that you have each specific permission before using it. Here's some things I see right off the bat:

CODE
// On standing up...
//... Permissions may already be revoked on standing ...
else
{
integer p = llGetPermissions();
llSetStatus(STATUS_PHYSICS, FALSE);
if(p & PERMISSION_TAKE_CONTROLS)
llReleaseControls();
if(p & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation("motorcycle_sit");
}

//... may be called multiple times ...
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("motorcycle_sit");
}
if(perm & PERMISSION_TAKE_CONTROLS)
llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}


Okay... now where do I put that in the code?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
04-26-2006 15:38
LL in 1.9 made it so the run_time_permissions event would be fired when permissions were released in specific situation. You should always verify you have the right permissions.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-26-2006 15:42
Well, the first fragment is a replacement for the "else" clause of "if(agent)" in the "changed" event. The second is a replacement for your "run_time_permissions" event.

I've started calling llResetScript() when I drop animations, because there's some really funky problems with the way they dump permissions in recent updates... and that's the only way to make sure they're really gone.
Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-26-2006 16:17
From: Argent Stonecutter
Well, the first fragment is a replacement for the "else" clause of "if(agent)" in the "changed" event. The second is a replacement for your "run_time_permissions" event.

I've started calling llResetScript() when I drop animations, because there's some really funky problems with the way they dump permissions in recent updates... and that's the only way to make sure they're really gone.



*looks utterly clueless*......right. *sigh* Can you just input this code into the script and repost the entire script here? I have absolutly no idea where it goes.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-26-2006 17:07
CODE


default
{
state_entry ()
{
llPassCollisions(TRUE);
llPassTouches(TRUE);
llSetSitText("Ride");
llSitTarget(<0.6,0,0.25>, ZERO_ROTATION);
llSetCameraEyeOffset(<-7.0, 0.0, 1.0>);
llSetCameraAtOffset(<3.0, 0.0, 2.0>);
llSetVehicleType(VEHICLE_TYPE_CAR);
llSetVehicleFlags(VEHICLE_FLAG_CAMERA_DECOUPLED
| VEHICLE_FLAG_LIMIT_MOTOR_UP
| VEHICLE_FLAG_MOUSELOOK_BANK
);

//Controls how easy it glides along the ground.
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 0, 1000> );
//Controls how easy the vehicle rotates.
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 0> );

//Determines how long it takes for the motor to push the vehicle to full speed. Its minimum value is approximately 0.06 seconds.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 2.5 );
//Controls the deceleration to zero velocity from the time you let go of the pedal.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 1.0 );

llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.0 );

//Controls the max turning rate.
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <4*PI, 2*PI, 0> );
//Controls the time it takes for the turning rate to accelerate to max velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.0 );
//Controls the time it takes for the turning rate to decelerate to zero velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.0 );

//Controls how strong the force for the bike to remain vertical
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5 );
//Controls the time it takes for the bike to lean.
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.5 );

llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 0.0 );
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
//Security Program Begin
if (agent != llGetOwner())
{
llSay(0, "You are not the owner of this vehicle. Please step away.");
llUnSit(agent);
llPushObject(agent,<0,0,10>, ZERO_VECTOR, FALSE);
}
else
//Securty Program End
{
llSetStatus(STATUS_PHYSICS, TRUE);
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
llOwnerSay("'W' Accelerates, 'S' Decelerates/Reverse. Use Mouselook to Steer.");
}
}
//... Permissions may already be revoked on standing ...
else
{
integer p = llGetPermissions();
llSetStatus(STATUS_PHYSICS, FALSE);
if(p & PERMISSION_TAKE_CONTROLS)
llReleaseControls();
if(p & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation("motorcycle_sit");
}

}
}

//... may be called multiple times ...
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("motorcycle_sit");
}
if(perm & PERMISSION_TAKE_CONTROLS)
llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}

control(key id, integer level, integer edge)
{
if(level & CONTROL_FWD)
{
//This sets the max velocity the vehicle will achive by meters/second
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<50,0,0>);
}
if(level & CONTROL_BACK)
{
//This sets the max velocity the vehicle will achive by meters/second
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<-50,0,0>);
}
}
}
Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-26-2006 19:08
Hey it worked. Thanks. =)
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-27-2006 07:26
No problem. I've been doing an awful lot of this fixing scripts in objects I bought that were similarly broken but getting away with it before the last updates.