I will preface this by saying, "I'm not a scripter." Having said that like many folks here I've learned enough scripting by reading scripts to have become dangerous, but I've run into a snag.
Currently I'm working on a large house with many doors/windows. The script I'm using is a simple door script that allows great flexibility. I will post it below. My question is this, "Can this script trigger another script? I.E. if I trigger the even to open one door can it trigger the adjacent door so both open at the same time?
*********************************************
SCRIPT BELOW
*********************************************
// Swinging door LSL script
float delay = 3.0; // time to wait before automatically closing door
float direction = -1.0; // set to 1.0 or -1.0 to control direction the door swings
float volume = 0.5; // 0.0 is off, 1.0 is loudest
key open_sound = "door open";
key close_sound = "door close";
default
{
state_entry()
{
state open;
}
}
state closed
{
state_entry()
{
llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
llSetRot(llEuler2Rot(<direction * PI_BY_TWO,0,0>) * llGetRot()); // edit to change the axis of rotation x,y,z
}
touch_start(integer total_number)
{
state open;
}
collision_start(integer total_number)
{
state open;
}
timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
}
}
state open
{
state_entry()
{
llTriggerSound(open_sound, volume); // Trigger the sound of the door opening
llSetRot(llEuler2Rot(<-direction * PI_BY_TWO,0,0>) * llGetRot()); // edit to change the axis of rotation x,y,z
llSetTimerEvent(delay); // Set the timer to automatically close it
}
on_rez(integer start_param)
{
state closed;
}
touch_start(integer total_number)
{
state closed;
}
collision_start(integer total_number)
{
// Do nothing, the door is already open
}
timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
state closed;
}
}
****************************************
Script Above
****************************************
Slave (not the Gorean type) script
- Michael Timeless
- Posts: 113
- Joined: Thu Sep 24, 2015 5:13 am
- Location: Crestwood, Illinois
- Has thanked: 393 times
- Been thanked: 153 times
- Contact:
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Re: Slave (not the Gorean type) script
You don't say whether having another door close is desirable or not, nor whether this building is a single linkset. If it is desirable and a linkset then you could use llMessageLinked and have the script respond to the link_message event. Alternatively if not a linkset you could chat on a negative channel and use llListen and the listen event.
- These users thanked the author Graham Mills for the post (total 2):
- Keith Selmes • Michael Timeless
- Keith Selmes
- Posts: 175
- Joined: Fri Jan 04, 2013 1:13 pm
- Location: Devon, UK
- Has thanked: 174 times
- Been thanked: 153 times
- Contact:
Re: Slave (not the Gorean type) script
I would say the same as Graham.
If the doors are linked, when one door is opened or closed, it can send a link message for the other door to do the same.
Otherwise you can use a chat channel, but I think having them linked is simpler and safer.
If the doors are linked, when one door is opened or closed, it can send a link message for the other door to do the same.
Otherwise you can use a chat channel, but I think having them linked is simpler and safer.
- These users thanked the author Keith Selmes for the post:
- Michael Timeless
- Michael Timeless
- Posts: 113
- Joined: Thu Sep 24, 2015 5:13 am
- Location: Crestwood, Illinois
- Has thanked: 393 times
- Been thanked: 153 times
- Contact:
Re: Slave (not the Gorean type) script
Gentlemen
Thank you both. The building itself is constructed of ten linksets with approximately 1600 prims. The doors (each about 14 prims) are also separate link sets in groups. The doors I'm most interested in making this work on come in two flavors. The first is the adjacent double doors on all levels. The second is a group of swinging doors that trigger a group of sliding doors so event1 triggers event2 in the later case.
https://gyazo.com/25c1d63297612bb11343360c229e13a6
In the above example tapping the door on the left should trigger the door on the right opening. Once they open after 5 seconds they would then close again. I will test using them linked as you suggested, not sure it will work for the one that swings and then slides.
Mike
Thank you both. The building itself is constructed of ten linksets with approximately 1600 prims. The doors (each about 14 prims) are also separate link sets in groups. The doors I'm most interested in making this work on come in two flavors. The first is the adjacent double doors on all levels. The second is a group of swinging doors that trigger a group of sliding doors so event1 triggers event2 in the later case.
https://gyazo.com/25c1d63297612bb11343360c229e13a6
In the above example tapping the door on the left should trigger the door on the right opening. Once they open after 5 seconds they would then close again. I will test using them linked as you suggested, not sure it will work for the one that swings and then slides.
Mike
- Handy Low
- Posts: 231
- Joined: Fri Nov 08, 2013 3:38 pm
- Location: Yorkshire, England
- Has thanked: 207 times
- Been thanked: 140 times
- Contact:
Re: Slave (not the Gorean type) script
If you don't want to link them, and you don't want to use listeners, I'd consider using the osMessageObject() function. You need to know the UUID of the other object, but if you do it works very well.
- These users thanked the author Handy Low for the post (total 2):
- Michael Timeless • Keith Selmes
Handy Low
- Michael Timeless
- Posts: 113
- Joined: Thu Sep 24, 2015 5:13 am
- Location: Crestwood, Illinois
- Has thanked: 393 times
- Been thanked: 153 times
- Contact: