Kipz Arado Posted August 8, 2011 Share Posted August 8, 2011 As i've been posting in my previous threads about helping my friend with the scripting on his house for his newly purchased land, I have been working on my on going attempt to learn LSL by building him a controller to control the window tinting and locking of doors via buttons. Thank you to several contributors I have successfully set up the Texture to respond to llDetectedTouch, and I have my windows fully tintable and working. I also have my doors locking and unlocking.. THE ONLY problem I have left is my door functions perfectly normal when it is not linked to my home controller. When I make an attempt to link my Hinge and the door itself, to my controller prim, the hinge on the side of the door with rotate with the Z-axis in the middle of the prim.Not only is this NOT the way a normal door rotates, the fact that the hinge is also the only thing that rotates. Could anyone please help me modify my script below to fix this?if (llGetLinkName(llDetectedLinkNumber(0)) == "DOOR") { integer i; for (i=2;i<=llGetNumberOfPrims();++i) { if (llGetLinkName(i) == "DOOR") {--- This following code above, I've located from Rolig's Mulit-prim linked sliding door, and I've tried several times to impliment the theory into my door, unfortunately I can't get it to work correctly. The door works if it's not linked to my controller,but then it wont receive the linked message to lock and unlock o.O integer lock = 1;// ********** SETTINGS HERE ************float TIMER = 30.0; // automatically close the door after this many seconds, // set to 0 to disable automatic closinginteger DIRECTION = 1; // direction door opens in. Either 1 (outwards) or -1 (inwards);float VOLUME = 0.8; // sound volume, 1.0 loudest, 0.0 to disable sound// ********** END OF SETTINGS **********key SOUND_OPEN = "cb340647-9680-dd5e-49c0-86edfa01b3ac";key SOUND_CLOSE = "e7ff1054-003d-d134-66be-207573f2b535";vector gPos; // door position (objects move a tiny amount // away from their position each time they are rotated, // thus we need to workaround this by resetting // the position after rotating) door(integer open) { if (open) { llTriggerSound(SOUND_OPEN, VOLUME); llSetLocalRot(llEuler2Rot(<0, 0, -DIRECTION * PI_BY_TWO>) * llGetLocalRot()); } else { // close llSetLocalRot(llEuler2Rot(<0, 0, DIRECTION * PI_BY_TWO>) * llGetLocalRot()); llTriggerSound(SOUND_CLOSE, VOLUME); }} default { // first time startup state_entry() { gPos = llGetPos(); // remember where we're supposed to be door(TRUE); state closed; }} state closed { // door is closed on_rez(integer start_param) { gPos = llGetPos(); } state_entry() { door(FALSE); } link_message(integer sender_num, integer num, string str, key id) { if(llToLower(str) == "lock") { lock = 1; } if(llToLower(str) == "unlock") { lock = 0; } } touch_start(integer total_number) { if( lock == 1) { llSay(0,"This door is currently locked."); } else if (lock == 0) { state open; } } moving_end() { // done moving me around, store new position gPos = llGetPos(); }}state open { // door is open on_rez(integer start_param) { gPos = llGetPos(); state closed; } state_entry() { llSetTimerEvent(TIMER); llSetPos(gPos); // rotation drift workaround door(TRUE); }link_message(integer sender_num, integer num, string str, key id) { if(llToLower(str) == "lock") { lock = 1; } if(llToLower(str) == "unlock") { lock = 0; } } touch_start(integer num) { state closed; } timer() { // auto-close state closed; } moving_start() { // close when being moved state closed; } state_exit() { llSetTimerEvent(0); }} Link to comment Share on other sites More sharing options...
Freecilla Kuhn Posted August 8, 2011 Share Posted August 8, 2011 Unlink the and delete the door, (only the door prim) make the hinge the door by making it a square and cut it so the middle is on one side, if it rotates the wrong way cut the door so it is opening the right way, re-texture hinge with a door texture. Link to comment Share on other sites More sharing options...
Void Singer Posted August 8, 2011 Share Posted August 8, 2011 take a peek over here... cuts given. 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