- Forums
- :
- Creation Forum
- :
- LSL Scripting
- :
- Re: Menu to execute one of two scripts
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-07-2012 05:46 PM
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
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Nosferatous - view message
02-07-2012 05:58 PM
A simple function = llSetScriptState()
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to shymus Roffo - view message
02-07-2012 06:15 PM
Thanks for the quick reply! Unfortunately, as someone who does not know scripting, I wouldn't even know where to begin with this. Could you elaborate at all? The scripts I have were prefabbed and i just dropped them in the prims as instructed.
Thanks
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Nosferatous - view message
02-08-2012 03:03 AM
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.
Re: Menu to execute one of two scripts
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Ela Talaj - view message
02-08-2012 06:36 AM - last edited on 02-08-2012 06:40 AM
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.
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Rolig Loon - view message
02-08-2012 01:46 PM
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 ![]()
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Ela Talaj - view message
02-08-2012 02:00 PM
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.
Re: Menu to execute one of two scripts
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Rolig Loon - view message
02-18-2012 07:05 AM
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!!!

