Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Slow down a sliding door

Bravo Rasmuson
Registered User
Join date: 4 May 2007
Posts: 3
08-17-2007 03:39
I use this relatively easy sliding door script, but i feel the door opens to fast. Now i'm new to scripting and the script i use comes from this forum somewhere, but i have no idea how to fix this. Can anyone help me?

this is the script i use:

CODE

// Sliding door LSL script #4
// Handles the touch event.
// Handles the collision event.
// Handles closing the door automatically via a timer event.
// Triggers sounds when the door opens or closes.

// Parameters you might want to change

float delay = 0.0; // time to wait before automatically closing door
vector delta = <-1.2, 0.0, 0.0>; // amount to move door when we open it
float volume = 0.5; // 0.0 is off, 1.0 is loudest

// Variables you will most likely leave the same

vector closed_position; // original position of the door when closed

key open_sound = "Door open";
key close_sound = "Door close";

// Processing for the script when it first starts up

default {
// What we do when we first enter this state

state_entry() {
closed_position = llGetPos(); // Save position when door is closed
state closed; // Move to the closed state
}
}

// Processing for the script when it is in the closed state

state closed {
// What we do when we first enter this state

state_entry() {
llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
llSetPos(closed_position); // Move door to closed position
}

// What we do when the door is clicked (”touched”) with the mouse

touch_start(integer total_number) {
state open; // Move to the open state
}

// What to do when something hits the door

collision_start(integer total_number)
{
state open; // Move to the open state
}

// What to do when the timer goes off

timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
}
}

// Processing for the script when it is in the open state

state open {
// What we do when we first enter this state

state_entry() {
llTriggerSound(open_sound, volume);// Trigger the sound of the door opening
llSetPos(closed_position + delta); // Move door to open position
llSetTimerEvent(delay); // Set the timer to automatically close it
}

// What we do when the door is clicked (”touched”) with the mouse

touch_start(integer total_number) {
state closed; // Move to the closed state
}

// What to do when something hits the door

collision_start(integer total_number)
{
// Do nothing, the door is already open
}

// What to do when the timer goes off

timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
state closed; // Move to the closed state
}
}


Thx
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
08-17-2007 12:35
As soon as you step the movement it to slow it it will become non-smooth and also much less performant. If you find a way to keep it smooth and slow it down then you'll be doing better than I have managed so far.

Regs,
/esc
_____________________
http://slurl.com/secondlife/Together