Change font size
It is currently Thu May 23, 2013 11:25 pm

Forum rules


Image



Post a new topicPost a reply Page 1 of 1   [ 9 posts ]
Author Message
 Post subject: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 6:36 pm 
Furious Typer
User avatar

Joined: Fri Jul 16, 2010 2:53 pm
Posts: 230
I found this script and use it on some sliding doors for my home. Instead of the doors sliding out of the building because of an angle, they fold. It's great for shower doors also. I use it also for curtains, blankets. It's very useful.

But ...

Nebadon's script for sliding doors is just fantastic. It even open the doors when you walk into them plus you can set the time for them to stay open. You don't have to touch the doors.

Is there any way to add these features to this script? I tried mixing some of Nebadon's script to this one but nothing works. I tried adding a script for a collision mat. That did not work either. I'm really, really not good with scripting ... lol

This is the script I'm talking about;

***************************************************************************

//When touched the prim is retracted towards one end and when touched again stretched back out.
//
//Prim moves/changes size along the local coordinate specified in the offset vector below.
//
//To change the overall size, edit the prim when stretched out and reset the script when done.
//
//The script works both in unlinked and linked prims.
//
// Copyright (C) 2008 Zilla Larsson
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3, as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>


vector offset = <1.0,0.0,0.0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?
//The one with the higher (local) coordinate?
float min = 0.25; //The minimum size of the prim relative to its maximum size
integer ns = 4; //Number of distinct steps for move/size change


default {
state_entry() {
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}

touch_start(integer detected) {
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
}

***************************************************************************

. . : crosses fingers someone can help with this : . .

Selea


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 6:44 pm 
OSG Elite

Joined: Wed Aug 05, 2009 1:59 am
Posts: 417
Selea, I have no solution for your script now, but a quick tip: use the forums BB-code!

A script is easier to read if it looks like this:

Code:
// FLOATING TEXT

default
{
    state_entry()
    {
        llSetText("Touch to receive\na Landmark", <1.0,1.0,1.0>, 1.0);
    }
}


Just copy your script from in-world (Select all, Copy), then when posting here, hit the [Code] button you see in your 'post a reply' window in the forum window, and past your script in the [ code] script here [ /code] thing.

Hope this helps a bit:)
Odd


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 7:35 pm 
Furious Typer
User avatar

Joined: Fri Jul 16, 2010 2:53 pm
Posts: 230
Hi Odd ... wow great idea ... thank you :)

I saved your suggestion for next time.

Selea


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 7:39 pm 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
Hi Selea,
I would have a go at adding the functions you want from Nebs script, could you pleas post the other script in question so I can see the functions you need from it.
Cam


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 8:54 pm 
Furious Typer
User avatar

Joined: Fri Jul 16, 2010 2:53 pm
Posts: 230
Hi Cam :)

Here is Nebadon's script;

Code:
// change the 4 lines underhere to change which way or how far door opens


float NorthSouth = -2.5; // set how far to move nort or south


float EastWest = 0.0; // set how far to mave east or west


float UpDown = 0.0; // Set how far door moves up or down


float Timer = 10.0; // Set time how long door stay´s open and then closes again


// change four lines underhere to change sound or volume

// change the open sound string to set another opening sound
string OpenSound = "cb340647-9680-dd5e-49c0-86edfa01b3ac";

float OpenVol = 1.0; // change to set opening volume

//change the close sound string to change sound or volume
string CloseSound = "e7ff1054-003d-d134-66be-207573f2b535";

float CloseVol = 1.0; // change to set close volume



vector Pos;
vector Offset;
integer Open;
integer x;

default
{
state_entry()
{
Offset = <EastWest, NorthSouth, UpDown>;
}

touch_start(integer num)
{
for(x = 0; x < num; x++)
{
Open = !Open;
if(Open)
{
Pos = llGetLocalPos();
if(OpenSound != "") llTriggerSound(OpenSound, OpenVol);
llSetPos(Pos - Offset);
llSetTimerEvent(Timer);
}else{
if(CloseSound != "") llTriggerSound(CloseSound, CloseVol);
llSetPos(Pos);
llSetTimerEvent(0);
}
}
}

collision_start(integer num)
{
for(x = 0; x < num; x++)
{
Open = !Open;
if(Open)
{
Pos = llGetLocalPos();
if(OpenSound != "") llTriggerSound(OpenSound, OpenVol);
llSetPos(Pos - Offset);
llSetTimerEvent(Timer);
}else{
if(CloseSound != "") llTriggerSound(CloseSound, CloseVol);
llSetPos(Pos);
llSetTimerEvent(0);
}
}
}

on_rez(integer param)
{
llResetScript();
}

moving_end()
{
if(Open)
{
Open = 0;
llSetTimerEvent(0.0);
}
}

timer()
{
if(CloseSound != "") llTriggerSound(CloseSound, CloseVol);
llSetPos(Pos);
llSetTimerEvent(0);
Open = 0;
}
}


and here is the script I use for open / close sliding folding doors

Code:
//When touched the prim is retracted towards one end and when touched again stretched back out.
//
//Prim moves/changes size along the local coordinate specified in the offset vector below.
//
//To change the overall size, edit the prim when stretched out and reset the script when done.
//
//The script works both in unlinked and linked prims.
//
// Copyright (C) 2008 Zilla Larsson
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3, as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>


vector offset = <1.0,0.0,0.0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?
//The one with the higher (local) coordinate?
float min = 0.25; //The minimum size of the prim relative to its maximum size
integer ns = 4; //Number of distinct steps for move/size change


default {
state_entry() {
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}

touch_start(integer detected) {
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
}


Odd ... are'nt ya proud of me uh?? ... lol

Cam ...Thank you for trying :)

Selea


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Fri Mar 16, 2012 11:49 pm 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
Selea,
Ok this was fun, I have modified the script as you requested, the door will open if you walk into it, or touch it, and it will close automatically after the time set by adjusting
Code:
float Timer = 10.0;
to whatever value in seconds. it no longer closes by touch, once it has been touched or collided to open, the door is put into "opened" mode and these two actions are disabled until the door has closed itself, this is to prevent double opening of the door. I have tested it as much as I could by myself, but it has no failsafe for the situation where 2 or more avs touch or collide at the same time (I am hoping this will be unlikely)
Hope this suits your needs
Regards
Cam.

Code:
//When touched (or collided by avatar) the prim is retracted towards one end and timer controlled automatically stretched back out.
//
//Prim moves/changes size along the local coordinate specified in the offset vector below.
//
//To change the overall size, edit the prim when stretched out and reset the script when done.
//
//The script works both in unlinked and linked prims.
//
// Copyright (C) 2008 Zilla Larsson
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3, as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
// Modified by Cam Chevalier 2012 to include collision activation and timer auto close
// touch will not close the doors, only timer will close.


vector offset = <1.0,0.0,0.0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?
//The one with the higher (local) coordinate?
float min = 0.25; //The minimum size of the prim relative to its maximum size
integer ns = 4; //Number of distinct steps for move/size change
integer x;
float Timer = 3.0; // Set time how long door stay´s open and then closes again
integer opened = 0;

default
{
    state_entry()
    {
        offset *= ((1.0 - min) / ns) * (offset * llGetScale());
        hi_end_fixed -= 0.5;
    }
    touch_start(integer detected)
    {
        integer i;
        if(opened == 0)
        {
            do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
            PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
            while ((++i) < ns);
            offset = - offset;
            llSetTimerEvent(Timer);
            opened = 1;
        }
         
    }
    collision_start(integer num)
    {
        if(opened == 0)
        {
            integer i;
            do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
            PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
            while ((++i) < ns);
            offset = - offset;
            llSetTimerEvent(Timer);
            opened = 1;
        }
    }
    on_rez(integer param)
    {
        llResetScript();
    }
    timer()
    {
        llSetTimerEvent(0);
        integer i;
        do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
        PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
        while ((++i) < ns);
        offset = - offset;
        opened = 0;
    }
}


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Sat Mar 17, 2012 2:10 am 
Furious Typer
User avatar

Joined: Fri Jul 16, 2010 2:53 pm
Posts: 230
Cam!! ... wooo hoooo ... lol

Thank you so much. This is just awesome. When I tried mixing both scripts, it never looked anything like what you did. I've been trying for ages. Admitting defeat has it's fun side ... lol

Again Cam ... thank youuuuuuuuu.

Selea :)


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Sat Mar 17, 2012 3:23 am 
Furious Typer
User avatar

Joined: Mon Jul 12, 2010 4:43 am
Posts: 128
Nice job Cam! :)


Top
 Profile  
 
 Post subject: Re: Open / Close sliding folding doors
PostPosted: Sat Mar 17, 2012 3:56 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 360
Location: Australia
You are totally welcome Selea, happy to help where I can,
and thank you Kahn :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 9 posts ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net