|
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
|
09-22-2007 21:20
I have made an item with several texture change scripts in it, so people can change textures and choose the combination they want. The texture change is menu-controlled for every linkset and has a menu button called Default, which is different for every linkset. Each pair of controller and listeners is on their own channel. It works great. But the only thing is: when I place the product in my store, then people can click it and change textures at will. And they should, because they want to know what they buy. But I'd like to see that after they change textures, there is a timer or something that puts every texture back to the default texture for each linkset. How can I do that? Each linkset has about the same controller script (the item has 4 controllers with listeners, each on seperate channels): list TextureNames = ["White", "Lightblue", "Lightyellow", "Creme", "Pink", "Green", "Darkgreen", "Darkpurple", "Darkyellow", "Redbrown", "Darkbrown", "Default"];
list TextureKeys = ["dadb72bd-2521-743c-7dc5-228b850f72c9", "24653f89-8c60-003f-33f1-7f303cc89a2c", "b158e620-72ab-6334-23a2-5c8b42f98fdc", "21a0c4ff-4039-a677-1558-2f3af8996c86", "19751cb6-a1f2-0bf8-6bda-1e736b500e55", "373be0f9-bdce-9414-6650-e4bcc32c8fca", "0ef0cb94-df64-2929-16f7-a7d5c9650eb9", "fe363967-afb6-695b-c531-e82ae8d66834", "d8613400-032e-7fc3-44c5-ac1e9ff5892a", "89d5649d-2f9a-cf25-e7b3-9dd2200c4264", "461a59bf-00ec-8ed9-2310-cc23e4609d22", "461a59bf-00ec-8ed9-2310-cc23e4609d22"];
integer menu_handler; // Open Dialog Menu Channel Varible integer menu_channel; // Dialog Menu's Channel Number
string ON; // Objects Name (Global) key Dkey; // Persons Key That Touched It (Global) default { touch_start(integer t) // Touch Event { Dkey = llDetectedKey(0); // Persons Key That Touched It ON = llGetObjectName(); // Get Object Name For Business Branding Of Dialog Menu menu_channel = (integer)(llFrand(99999.0) * -1); // Choose A Random Channel menu_handler = llListen(menu_channel,"",Dkey,""); // Open Listen For Dialog Menu llDialog(Dkey,ON + "\nTexture Selection Options:", TextureNames, menu_channel); // Pop Dialog Menu llSetTimerEvent(15.0); // Set Timer To Close Listen If No Input Is Recieved } timer() // No Input Was Recieved. Stop Timer & Close Listen For Efficiency { llSetTimerEvent(0.0); // Turn Off Timer llListenRemove(menu_handler); // Remove Listen } listen(integer chan, string name, key id,string msg) // Listen Event { if (chan == menu_channel) {// If The Channel We Opened Is The Same As The One The Message Is Recieved On, Change Texture
// Matches Choice To Texture Key Then Send It To The Link Prims To Change Thier Texture llMessageLinked(LINK_SET, -4401, "", llList2Key(TextureKeys, llListFindList(TextureNames, (list)msg))); // Re-Opens The Dialog For A Second Pick & Sets Timer Again llDialog(Dkey,ON + "Texture Selection Options:", TextureNames, menu_channel); llSetTimerEvent(15.0); } } } Hope someone can help me.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-23-2007 06:33
For starters, the complexity of having separate scripts in each to-be-textured prim is made obsolete by llSetLinkTexture(); that will reduce script count and simplify everything--no more link messages needed, just some bookkeeping of which linked prims belong to which set (handily aided by llGetLinkName, perhaps).
For the automatic reset to default, the tricky bit is that this should work in the store, but not after the object is purchased. I'd be inclined to use a separate script that deletes itself from a purchased copy of the object (triggered by CHANGED_OWNER in an object where llGetCreator != llGetOwner), but otherwise just calls llResetOtherScript() on an infrequent timer. To be nice and avoid resetting to default while a potential buyer is browsing, the main script could llMessageLinked(), upon which the reset script would set its timer back to the full delay interval.
|
|
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
|
09-23-2007 07:31
Thanks Qie for your reply. I understand what you say about the listeners in the linked prims, I'll see into that if it's possible.
As for deleting the default-option on buy: I was simply thinking to set the item for sale with content and put the regular version of the product (without default reset) in the content. So what I actually only need is a reset-to-default option in the script for the displayed item in my store.
|
|
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
|
09-23-2007 20:38
Hmmm, it's not very nice, but I found a temporary workaround. I try to explain. The item I make is a bed (see picture). Every knob on the bed post (4 knobs total) has a texture change script and listeners for specific parts of the bed, for instance sheets, blanket etcetera. Because there are also other linksets with scripts in the bed (animations, retractable blanket) I feel most comfortable with using controller scripts and listeners in each prim. That is also why I put the texture change in the knobs, because people must easily be able to click on the largest part of the bed for the animation menu, if you know what I mean...  I want to place the bed in my store so people can use and see the texture change. What I would like, is that the controller scripts automatically change back to the default texture when people don't click it for 30 seconds. But I really don't know how to do that in the scripts themselves. That's why I want to make an extra prim, only in my store (the marble panel on the picture for now), that people can click after they have tried the texture change. Because textures have to be reset on all four knobs, I have put four controller scripts on different channels in the extra prim. When people click the prim they see the blue menu screen. They are asked to click the Default button four times, which is a very bad solution of course. But right now I see no other way, this is the best that I as an amateur scripter can come up with. So I hope someone will help me to make the back-to-default option more logical, more automatic. Maybe as part of each seperate controller script, because that is something that I can understand. I can't do it myself, and I have tried real hard. Anybody please?
|