Rolig Loon 26,971 Posted March 20, 2020 Author Share Posted March 20, 2020 It ought to work. iTouched will flip back and forth between TRUE and FALSE with each touch, turning the period of llSetTimerEvent from TIMER * 1 (= TIMER ) to TIMER * 0 (= 0.0). Regardless of what it does to the timer, each time you click it will execute OpenShut(),which has its own sense switch (gON) to either open or close the door. Link to post Share on other sites
AHouseHunter 0 Posted February 4 Share Posted February 4 I cant seem to figure out how to get the door to close back... with each touch it keeps sliding in the initial direction Link to post Share on other sites
Rolig Loon 26,971 Posted February 4 Author Share Posted February 4 12 minutes ago, AHouseHunter said: I cant seem to figure out how to get the door to close back... with each touch it keeps sliding in the initial direction I can only guess that you have made a copying error or have been experimenting with a change that has bypassed or sabotaged the reversing toggle switch gOn = (-1 )* gOn; It's hard to tell which from a distance. Link to post Share on other sites
AHouseHunter 0 Posted February 4 Share Posted February 4 Copied and pasted exactly what is there I added a distance of 1 but other than that what is it I should be doing differently Link to post Share on other sites
Rolig Loon 26,971 Posted February 4 Author Share Posted February 4 22 minutes ago, AHouseHunter said: what is it I should be doing differently Beats me. Just to be sure that the forum software hadn't somehow messed up the posted script, I copied it out myself just now and put it into a simple two-prim mockup. All I did, like you, was to provide a value for gDistance. It works like a dream. My script is in the untinted root prim in front of me. The green sliding door is named DOOR. Link to post Share on other sites
Kesslan Saramago 5 Posted February 15 Share Posted February 15 (edited) Hi there! So, I'm not great with scripting and I had a question I didn't catch an answer to and couldn't seem to find. I'm trying to script a door that has two halves and have each half slide in a different direction. From what limited understanding I have, I can't figure out how to do that, and I can't seem to find any example of a script someone's made that would do it either. They all seem to only work with just 1 door at a time rather than two split halves. I know it's possible though, as i have a few doors that work this way, but unfortunately the scripts in all of them are No-Mod so I can't see how they did it. EDIT: In the ones I have the doors are named something like DoorL DoorR, so I know it's calling the door description the same way the OP's script does. It's just that I can't tell how to call up two doors at a time, instead of just the one. Edit 2: So I found this script the OP posted, but I"m not sure how to change it to sliding from swing.: Honestly comparing the two scripts I'm finding myself badly confused as to how you even tell the door to move side to side vs swing. I haven't really done much in the way of touching computer code in about 20 years or so, so while I understand a tiny bit here and there, I'm going a touch cross eyed trying to figure this one out. More to the point, I don't understand how IntSwing would be replaced with something telling it to move sideways instead of rotate. Mostly because I don't understand how the OP's script in this thread is telling the door to move sideways instead. Is that the Quote float gDistance; line? Like instead of intSwing = 90 you'd change it to Float gDistance = 1.0 ? Edited February 15 by Kesslan Saramago Link to post Share on other sites
Rolig Loon 26,971 Posted February 15 Author Share Posted February 15 As I said in earlier posts in this thread. if you have many doors in a building, all you have to do is be sure that they all have different names. You could have several instance of the script that controls them, or you could combine multiple instances into a single script that listens for many doors and controls them separately. A double door might be a common example of that sort of combined script. Touching either one of the two halves of the double door would activate both of them. Link to post Share on other sites
Kesslan Saramago 5 Posted February 16 Share Posted February 16 23 hours ago, Rolig Loon said: As I said in earlier posts in this thread. if you have many doors in a building, all you have to do is be sure that they all have different names. You could have several instance of the script that controls them, or you could combine multiple instances into a single script that listens for many doors and controls them separately. A double door might be a common example of that sort of combined script. Touching either one of the two halves of the double door would activate both of them. Hmm, ok. I'm not sure how to do that but I'll take a stab at it! Link to post Share on other sites
Rolig Loon 26,971 Posted February 16 Author Share Posted February 16 (edited) 50 minutes ago, Kesslan Saramago said: I'm not sure how to do that but I'll take a stab at it! OK... There are many ways to do it. Here's one: //Linkable Multiprim Sliding DOUBLE Door -- Rolig Loon -- February 2021 // All prims in the door must be contain the substring "DOOR", and none can be the root prim of the linkset // Links in the left hand door must be named "DOORL"; those in the right hand door must be named "DOORR" integer gON = 1; // Change to -1 to reverse the direction of opening float gDistance = 1.3; // Adjust to set the distance the door should move long its local Y axis list lRight; list lLeft; default { state_entry() { integer i; while ( i < llGetNumberOfPrims() ) // Let's find all the door links and separate them, left and right { ++i; string Name = llGetLinkName(i); if (~llSubStringIndex(Name,"DOOR") ) { if (llGetSubString(Name,-1,-1) == "R") { lRight += [i]; } else if (llGetSubString(Name, -1,-1) == "L") { lLeft += [i]; } } } } touch_start(integer total_number) { list AllLeft; list AllRight; integer j = llDetectedLinkNumber(0); if ( ~llListFindList(lRight,[j]) || ~llListFindList(lLeft,[j]) ) // Touched a door link { integer i; for (i=2;i<=llGetNumberOfPrims();++i) { if (~llListFindList(lRight,[i])) //Accumulate all the Right door link movements { list temp = llGetLinkPrimitiveParams(i,[PRIM_POSITION,PRIM_ROT_LOCAL]); rotation local_rot = (rotation)llList2String(temp,1); vector local_pos = ((vector)llList2String(temp,0)- llGetPos())/llGetRot(); AllRight += [34,i,PRIM_POSITION,local_pos + (<0.0,-1 * gDistance *gON,0.0>*local_rot),PRIM_ROTATION,local_rot/llGetRot()]; } else if (~llListFindList(lLeft,[i])) //Accumulate all the Left door link movements { list temp = llGetLinkPrimitiveParams(i,[PRIM_POSITION,PRIM_ROT_LOCAL]); rotation local_rot = (rotation)llList2String(temp,1); vector local_pos = ((vector)llList2String(temp,0)- llGetPos())/llGetRot(); AllLeft += [34,i,PRIM_POSITION,local_pos + (<0.0,gDistance *gON,0.0>*local_rot),PRIM_ROTATION,local_rot/llGetRot()]; } } llSetLinkPrimitiveParamsFast(LINK_SET,AllRight+AllLeft); // Move all door links gON = (-1)*gON; } } } Edited February 16 by Rolig Loon 2 Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now