Sunbleached Posted July 14, 2019 Share Posted July 14, 2019 (edited) Hello! Found this script on the forum. (Unfortunately I do not remember the author, I'm sorry, but thank you very much! I hope I didn’t spoil it.) And I am trying to simplify its configuration so that all changes are made at the beginning of the script. Did i do it right? What can be changed? How else can I simplify the configuration? Thank you! string door_sound = "736a1c0a-4749-e7e9-6d28-a95d7fc10068";//sound uuid integer intSwing = 90;//opening angle float HINGE_X = -0.5;//hinge position by x axis float HINGE_Y = 0.1;//hinge position by y axis float HINGE_Z = 0.0;//hinge position by z axis //choose opening axis: float AXIS_X = 0.0; float AXIS_Y = 0.0; float AXIS_Z = intSwing; rotation rotSwing; vector vOffset; default { state_entry() { rotSwing = llEuler2Rot( < (float) AXIS_X, (float) AXIS_Y, (float) AXIS_Z > * DEG_TO_RAD); vector size = llGetScale(); vOffset = < size.x * HINGE_X, size.y * HINGE_Y, HINGE_Z > ; } touch_start(integer total_number) { llPlaySound(door_sound, 1.0); list l = llGetPrimitiveParams([PRIM_POS_LOCAL, PRIM_ROT_LOCAL]); vector v = llList2Vector(l, 0); rotation r = llList2Rot(l, 1); llSetPrimitiveParams([PRIM_POS_LOCAL, v + (vOffset - vOffset * rotSwing) * r, PRIM_ROT_LOCAL, rotSwing * r]); rotSwing.s *= -1; } } Edited July 14, 2019 by Sunbleached 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 14, 2019 Share Posted July 14, 2019 That's someone's modification of the basic hinge script that Void Singer wrote and posted in the Scripting Library, here in the forums, several years ago. It's possibly the most commonly used basic door script in SL. The best way to tell whether your own changes are "right" is to see if they do what you expected them to. If so, you got it right. There is no better test and no better judge. Personally, I would just continue to use Void's original script and modify it on the fly as necessary, rather than trying to write a more complicated version that will look more like a Swiss Army knife, but that's my own personal choice. We all learn by playing and testing ideas like this. Have fun with it. 😎 1 Link to comment Share on other sites More sharing options...
Sunbleached Posted July 14, 2019 Author Share Posted July 14, 2019 (edited) 30 minutes ago, Rolig Loon said: That's someone's modification of the basic hinge script that Void Singer wrote and posted in the Scripting Library, here in the forums, several years ago. It's possibly the most commonly used basic door script in SL. The best way to tell whether your own changes are "right" is to see if they do what you expected them to. If so, you got it right. There is no better test and no better judge. Personally, I would just continue to use Void's original script and modify it on the fly as necessary, rather than trying to write a more complicated version that will look more like a Swiss Army knife, but that's my own personal choice. We all learn by playing and testing ideas like this. Have fun with it. 😎 Thanks for your reply! There is a moment that is not very clear to me. Could you help, please? When I remove the line integer intSwing = 90;//opening angle and change the other line to float AXIS_Z = 90; the script still continues to work. So it looks like float HINGE_X = -0.5; float HINGE_Y = 0.1; float HINGE_Z = 0.0; float AXIS_X = 0.0; float AXIS_Y = 0.0; float AXIS_Z = 90; Can I leave it like this? Edited July 14, 2019 by Sunbleached Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 14, 2019 Share Posted July 14, 2019 42 minutes ago, Sunbleached said: Can I leave it like this? It obviously works. Think through the logic. As I said earlier, 1 hour ago, Rolig Loon said: The best way to tell whether your own changes are "right" is to see if they do what you expected them to. If so, you got it right. There is no better test and no better judge. Figure things out for yourself and trust your own judgment. And keep testing. 1 1 Link to comment Share on other sites More sharing options...
FernandaCassia Posted July 15, 2019 Share Posted July 15, 2019 I know it's not the purpose of the topic, but this script is wonderful, I just happened to come here when I was going to open a topic about door script, and it worked perfectly for me. 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 16, 2019 Share Posted July 16, 2019 In that case, I suggest looking at Void Singer's original script at 1 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