Jump to content

Aperture (door)


Kuda Oh
 Share

You are about to reply to a thread that has been inactive for 4157 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am not a scripter, I just tinker with them ie: mess with the settings to see what happens. Is there a way to modify a script so it will act like an aperture? Or how would you modify an existing script to do so?

  • Like 1
Link to comment
Share on other sites

The easiest way to do it would be to use a cylindrical prim and just change the hole size from 0 to 95 when you want to open it as an aperature.  If you do it with a script, all you'll need to do is use llSetPrimitiveParams on PRIM_TYPE_CYLINDER.  Take a look at http://wiki.secondlife.com/wiki/LlSetLinkPrimitiveParams to see how the parameters are defined.

  • Like 1
Link to comment
Share on other sites

Thanks for both replies, the iris script was basically what I was looking for :smileyhappy: I read about prim params so I would know what to change PRIM_TYPE_(prim shape here) to as I wanted to do a square and a sphere. As for the numbers in the script after PRIM_TYPE_ , all greek to me :P  

When I do a Box the box ends up opening into a triangle shape. Havent tried a sphere yet so I am assuming I have to change the numbers. Which will take me awhile to figure out what each number affects.

Thanks again for the replies and help :)

Link to comment
Share on other sites

Were you talking about contacting me? My profile had been set so "show in search" was unchecked. In the 1.2x Viewer, that shielded you from web searches, but allows the in-world search to find you. In 2.x, it is brain dead in that regard and can't tell the difference between "show me in-world" and "Show me to every person on the planet that has a web browser...".

*sigh*

Still here, and quite active and yes, I posted that Iris Door script. For quite a while I had a skybox on my land that was built like a space ship, and it used those iris doors.

What did you want to know?

  • Like 1
Link to comment
Share on other sites

Oh hello :) Actually I went by what it said in the script, it showed you as Cera with one e so thats why I didn't find you in search. I have been playing with your script trying to figure out how to make it be  a square or hollow half sphere. But alas I am clueless as to what all the numbers are for. Looking at wiki I see that each PRIM_TYPE_ has less or more numbers following.  I guess it would be more complicated to make it do in steps ie: 0%, 25%, 75% etc open.

I am not a scripter and just an amateur with tinkering with scripts, usually out of curiousity.  As for now I have removed some of the numbers  ie: only 6 sets for a box? And changing a couple to see what it will do. Any help would be appreciated. :)

Link to comment
Share on other sites

It gets a little complicated because different prim shapes have a different number of things that can be specified. For example, a box prim has values for top size and top shear, but a sphere has a value for dimple instead of those two values.

Details are at this link:

http://wiki.secondlife.com/wiki/LlSetPrimitiveParams

Tested versions are in the next post.

Link to comment
Share on other sites

Here's a version that works in a box prim:

 

// Iris Open Script by Ceera Murakami - 5-12-2011// Touch-sensitive iris opening door, for a box prim// Toggles open and closed state for a hollow in a box prim, to use it like an iris door// Put this script into a box prim, flattened on the Z axis and rotated 90 degrees on X axis. // ----- Global Variables ------------------integer g_OpenNow;                 // True (1) if iris is 'open' nowdefault{    on_rez(integer param)    {        llResetScript();    }        state_entry()    {        if (g_OpenNow == TRUE) // Prim is in open state, so calculate new 'closed' size        {            state WaitToClose;        }        else // Prim is in a closed (or undefined state), so calculate new 'open' size        {            g_OpenNow = FALSE;            state WaitToOpen;        }    }}      state WaitToClose // Iris is Open, and waiting to close{    touch_start(integer total_number)    {        // Sets Hollow to 0.001 to be 'closed', but not lose texture choice for inside of hollow.        // For default squarish hole, uncomment the next line, and comment out the other one.        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.001, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        // For a round hole, uncomment the next line, and comment out the other one.        // llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE, <0.0, 1.0, 0.0>, 0.001, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        g_OpenNow = FALSE;        state WaitToOpen;    }}state WaitToOpen // Iris is closed, and waiting to open{    touch_start(integer total_number)    {        // Sets Hollow to 0.90 to be closed, but not lose texture choice for inside of hollow. (Max value is 0.95, less makes the open door smaller in proportion)        // For default squarish hole, uncomment the next line, and comment out the other one.        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.90, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        // For a round hole, uncomment the next line, and comment out the other one.        // llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE, <0.0, 1.0, 0.0>, 0.90, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        g_OpenNow = TRUE;        state WaitToClose;    }}

And here's a variant for a cylinder prim:

 

// Iris Open Script by Ceera Murakami - 5-12-2011// Touch-sensitive iris opening door, for a cylinder prim// Toggles open and closed state for a hollow in a cylinder prim, to use it like an iris door// Put this script into a cylinder prim, flattened on the Z axis and rotated 90 degrees on X axis. // A squarish hole opens like a diamond shape, unless you keep the X and Y values equal and rotate the prim 45 degrees on the Z axis.// ----- Global Variables ------------------integer g_OpenNow;                 // True (1) if iris is 'open' nowdefault{    on_rez(integer param)    {        llResetScript();    }        state_entry()    {        if (g_OpenNow == TRUE) // Prim is in open state, so calculate new 'closed' size        {            state WaitToClose;        }        else // Prim is in a closed (or undefined state), so calculate new 'open' size        {            g_OpenNow = FALSE;            state WaitToOpen;        }    }}      state WaitToClose // Iris is Open, and waiting to close{    touch_start(integer total_number)    {        // Sets Hollow to 0.001 to be 'closed', but not lose texture choice for inside of hollow.        // For default rounded hole, uncomment the next line, and comment out the other one.        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.001, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        // For a squarish hole, uncomment the next line, and comment out the other one.        // llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_SQUARE, <0.0, 1.0, 0.0>, 0.001, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        g_OpenNow = FALSE;        state WaitToOpen;    }}state WaitToOpen // Iris is closed, and waiting to open{    touch_start(integer total_number)    {        // Sets Hollow to 0.90 to be closed, but not lose texture choice for inside of hollow. (Max value is 0.95, less makes the open door smaller in proportion)        // For default rounded hole, uncomment the next line, and comment out the other one.        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.90, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        // For a squarish hole, uncomment the next line, and comment out the other one.        // llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_SQUARE, <0.0, 1.0, 0.0>, 0.90, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);        g_OpenNow = TRUE;        state WaitToClose;    }}

 Note that with both of these, you're adjusting the "hollow" value for the prim's shape.

Now a Tube works more like a Torus, adjusting hole size. (The major difference between tube and cylinder for this purpose is how the flat faces get textured.) The tube and torus have a parameter for hole shape as well, but I didn't test those variations. Just change "PRIM_HOLE_DEFAULT" to either "PRIM_HOLE_CIRCLE" or "PRIM_HOLE_SQUARE", as I did in the scripts above.

 

// Iris Open Script by Ceera Murakami - 5-12-2011// Touch-sensitive iris opening door// Toggles open and closed state for a hole in a tube as an iris door// Put this script into a flattened tube. // ----- Global Variables ------------------integer g_OpenNow;                 // True (1) if iris is 'open' nowdefault{    on_rez(integer param)    {        llResetScript();    }        state_entry()    {        if (g_OpenNow == TRUE) // Prim is in open state, so calculate new 'closed' size        {            state WaitToClose;        }        else // Prim is in a closed (or undefined state), so calculate new 'open' size        {            g_OpenNow = FALSE;            state WaitToOpen;        }    }}      state WaitToClose // Iris is Open, and waiting to close{    touch_start(integer total_number)    {         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TUBE, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.5, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);        g_OpenNow = FALSE;        state WaitToOpen;    }}state WaitToOpen // Iris is closed, and waiting to open{    touch_start(integer total_number)    {         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TUBE, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.05, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);        g_OpenNow = TRUE;        state WaitToClose;    }}

 And here's the original version, using a Torus prim:

 

// Iris Open Script by Ceera Murakami - 7/21/2006 (Reviewed 5-12-2011)// Touch-sensitive iris opening door// Toggles open and closed state for a hole in a torus as an iris door// Put this script into a flattened torus. // ----- Global Variables ------------------integer g_OpenNow;                 // True (1) if iris is 'open' nowdefault{    on_rez(integer param)    {        llResetScript();    }        state_entry()    {        if (g_OpenNow == TRUE) // Prim is in open state, so calculate new 'closed' size        {            state WaitToClose;        }        else // Prim is in a closed (or undefined state), so calculate new 'open' size        {            g_OpenNow = FALSE;            state WaitToOpen;        }    }}      state WaitToClose // Iris is Open, and waiting to close{    touch_start(integer total_number)    {         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TORUS, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.5, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);        g_OpenNow = FALSE;        state WaitToOpen;    }}state WaitToOpen // Iris is closed, and waiting to open{    touch_start(integer total_number)    {         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TORUS, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.05, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);        g_OpenNow = TRUE;        state WaitToClose;    }}

 

 

  • Like 1
Link to comment
Share on other sites

Thanks for your response and help, it is a bit confusing and overwhelming when one doesn't have an idea of what to add/remove/change. I like tinkering with scripts but there are times when I get stumped because I don't have the knowledge of a scripter :)   I tend to have friends ask me for help or to make stuff for them but sometimes can't find a script to do exactly what I want and not more. I only know of one seller who has door script that does do aperture but it also does other styles and uses notecard.  More than I want. Thus I figured give it try to find or edit a script to do just what I want.

I can now see where I was messing up when it came to the numbers ie: <0.0, 0.0, 0.0>, 0.90 etc . 

I will have to study up some more and do some more prim manipulating to increase my knowledge. Thanks again for the responses and help, it is very much appreciated!

Question though, would it be ok to let others have copies of the script you wrote? Free as in open source not for sale itself credits to remain intact if modified by anyone else?

Link to comment
Share on other sites

Yes, anyone may use those Iris opening scripts, freely. I don't mind if they are used as part of a larger thing built for sale, like a house or a skybox, as long as the scripts remain full-perms, with my notes in them. Just don't sell the scripts by themselves as if it was your product, or the scripts just dropped into a single prim or small group of prims and sold just as a scripted door.

I made up a set of examples of these scripts, with the scripts installed in the appropriate types of prims. If you or anyone else wants a copy of those samples, just drop me an IM in-world, or send me a notecard, and I'll send you a set.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4157 days.

Please take a moment to consider if this thread is worth bumping.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...