LegitBonzai Posted February 10, 2023 Share Posted February 10, 2023 I have been looking for smooth sliding doors for a while now.. and im getting a headache Can please help me out? I did found this: https://wiki.secondlife.com/wiki/Smooth_Sliding_Door and that works perfect for my project. but i found there is no sound in it. Link to comment Share on other sites More sharing options...
SeanMcDonald Posted February 11, 2023 Share Posted February 11, 2023 4 hours ago, LegitBonzai said: I did found this: https://wiki.secondlife.com/wiki/Smooth_Sliding_Door and that works perfect for my project. but i found there is no sound in it. I'm not an expert scripter, but it seems that the script on this page just needs to call llPlaySound() just before the door starts to move. I'd probably drop the sound file in the door's inventory and call it by name in the script (rather than using a key for it). 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted February 11, 2023 Share Posted February 11, 2023 (edited) 3 hours ago, SeanMcDonald said: I'm not an expert scripter, but it seems that the script on this page just needs to call llPlaySound() just before the door starts to move. I'd probably drop the sound file in the door's inventory and call it by name in the script (rather than using a key for it). Even better, the script has pretty obvious sections for when the door opens and closes, you could add a different sound for each. MoveDoor() { if(!bOpen) { /* some code*/ llPlaySound("Door opening sound",1.0); }else { /* some code*/ llPlaySound("Door closing sound",1.0); } /* more code*/ } Quote // ******************************************************************** // // Basic Physical Sliding Door Script // by SimonT Quinnell (11/07/2009) edited by Flax Quirina // for auto-close (17/06/2011). // // NOTE: If you are going to reposition the door, do it while the door is closed. // Otherwise it will try and use the old close position as a reference point. // // Licensed under the "OpenCollar License" // Ie. Licensed under the GPLv2, with the additional requirement that these scripts remain "full perms" in Second Life. // // Edit: Simplified the script to be just a basic move script .. removed the sound triggers (5/1/2010) // // ******************************************************************** // ******************************************************************** // CONSTANTS // ******************************************************************** string SOUND_OPEN = "Door open sound"; string SOUND_CLOSE = "Door close sound"; // Movement Constants vector OFFSET = <-2.0, 0.0, 0.0>; // Directional offset for moving the door in x,y,z coordinates float OPENTIME = 3.5; // Time taken to open door float CLOSETIME = 3.5; // Time taken to close door float AUTO_CLOSE_TIME = 5; // Time to auto-close the door // ******************************************************************** // Variables // ******************************************************************** vector vPosition; rotation rRot; float omega=0.0; vector vTargetPos; integer bOpen = FALSE; integer bMoving = FALSE; integer destTarget; // ******************************************************************** // Functions // ******************************************************************** MoveDoor() { if(!bOpen) { llPlaySound(SOUND_OPEN,1.0); // Initial conditions bOpen = TRUE; rRot = llGetRot(); vPosition = llGetPos(); // Target Position omega=OPENTIME/llVecDist(<0,0,0>,OFFSET); vTargetPos = vPosition+OFFSET*rRot; // Set the timer to cleanup position //llSetTimerEvent(OPENTIME); }else { llPlaySound(SOUND_CLOSE,1.0); bOpen = FALSE; // Target Position omega=CLOSETIME/llVecDist(<0,0,0>,OFFSET); vTargetPos = vPosition; // Set the timer to cleanup position //llSetTimerEvent(CLOSETIME); } // Set Door Physical and move it bMoving = TRUE; llSetStatus(STATUS_PHANTOM, TRUE); llSetStatus(STATUS_PHYSICS, TRUE); destTarget = llTarget(vTargetPos, llVecDist(<0,0,0>,OFFSET)); llMoveToTarget(vTargetPos,omega); } default { state_entry() { // Initial conditions rRot = llGetRot(); vPosition = llGetPos(); } at_target(integer tnum, vector targetpos, vector ourpos) { if(llVecDist(targetpos, ourpos) < 0.1) { // Clean up Position bMoving = FALSE; llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_PHANTOM, FALSE); llSetPrimitiveParams([ PRIM_POSITION, vTargetPos, PRIM_ROTATION, rRot ]); llTargetRemove(destTarget); if(bOpen) { llSetTimerEvent(AUTO_CLOSE_TIME); } } } touch_start(integer num_detected) { MoveDoor(); } timer() { llSetTimerEvent(0.0); MoveDoor(); } } or so. Edited February 11, 2023 by Quistess Alpha 1 Link to comment Share on other sites More sharing options...
Love Zhaoying Posted February 11, 2023 Share Posted February 11, 2023 For Disney fans, the perfect sliding door sound would be this! 1 Link to comment Share on other sites More sharing options...
LegitBonzai Posted February 11, 2023 Author Share Posted February 11, 2023 6 hours ago, Love Zhaoying said: For Disney fans, the perfect sliding door sound would be this! thats funny. But its ment for a space ship. I got it working yall. So thank you 1 Link to comment Share on other sites More sharing options...
animats Posted February 11, 2023 Share Posted February 11, 2023 There are many, many door scripts. You can buy good doors from Kool Door, NTBI, etc. If you need door sounds, here's the BBC's free sound effects library, with 508 different door sounds. Pick something that matches the type of door being used. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now