Jump to content

Menu to execute one of two scripts


Nosferatous
 Share

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

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

Recommended Posts

Hi,

 

I am admitedly a scripting idiot, menaing no knowledge at all. I have built a canopy that has four curtains enclosing the inside. I have master and slave scripts that allow me to change th textures of the curtains and works nicely. I also have a script that darws the front curtain to one side, allowing access to the inside of the canopy. This also works nicely

The problem I have is, the master and slave scripts make the whole linkset (object) clickable, including the fornt curtain with the script that opens it. When i click on the front curtain, as if to open it, the textures change as well, producing an undesired effect.

 

Does anyone have any solutions or suggestions?

 

Thanks

Link to comment
Share on other sites

You might consider getting rid of master/slaves scripts altogether. There no need in them. Leave the curtain opening script in the front curtain and make just one script that changes textures in all other required prims using llSetLinkPrimitiveParamsFast(). This script then could be put in any prim other than front curtain.




 


Link to comment
Share on other sites

Sort of like this......  As Ela says, combine all of your scripts into one.  Put the Open/Close code in its state default and the color change stuff in a second state (state textures).  Then do all of the texture change with llSetLinkTexture.  This is not a complete script, but a schematic partial example, since we aren't here to write scripts for you.  If you are learning to script, though, you can use this to build on.

integer gON;integer gCount;float gTime;default{    touch_start(integer num}    {        gTime = llGetTime();    }    touch_end (integer num)    {        if ((llGetTime() - gTime)  > 2.0)  // Click and hold mouse button for 2 seconds to change to texture mode        {            gCount = 0;            state textures;        }        else    //Toggle the curtain open / closed        {            if (gON)            {                //Close the curtain            }            else            {                //Open the curtain            }             gON = !gON;        }    }}state textures{    touch_start (integer num)    {        gTime = llGetTime();    }    touch_end (integer num)    {        integer All_textures = llGetInventoryNumber(INVENTORY_TEXTURE);        if ((llGetTime() - gTime)  > 2.0)   // Click and hold mouse button for 2 seconds to change to open/close mode        {            state default;        }        else    // Change to a new texture on all prims with each click held for < 2 seconds        {            llSetLinkTexture(LINK_SET,llGetInventoryName(INVENTORY_TEXTURE,(++gCount)%All_textures),ALL_SIDES);        }    }}

 Just remember to put all of your textures into the object's inventory.

Link to comment
Share on other sites

I don't like llSetLinkTexture() because of the built-in delay. I guess it's ok in this case when changes are user-caused, but when things start auto-scrolling fast it is amazing how this just 0.2sec delay deteriorates visual performance. Sometimes seems like it is not 0.2 sec as specified but at least twice as long :)

Link to comment
Share on other sites

Oh, I agree. Thanks for the observation, Ela.  In anything with more than two or three choices, especially in a commercial product, I would use llSetLinkPrimitiveParamsFast to set the texture, precisely for that reason.  In this case, I figured it might add more confusion than necessary to a schematic script.  Using SLPPF forces you to deal with size, rotation, etc.  

Link to comment
Share on other sites

  • 2 weeks later...

This is really great. I went away for a few days and came back to all this help. Thank you. I was able to find another texture change script that worked a bit better and now the product is flawless.

 

I will however, hold onto this for future builds. Great stuff!!!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3884 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...