FallenAngel Savira Posted February 24, 2013 Share Posted February 24, 2013 I have 2 sculpted items that I have linked together and have put a texture, a transparent texture and the script in each and they both swap fine individually between the texture and the transparent. But what I want them to do is on touch one is invisible and one is showing texture and then touch again and they swap over so the invisible one shows and the other turns invisible. If that makes any sense to anyone Link to comment Share on other sites More sharing options...
Dora Gustafson Posted February 24, 2013 Share Posted February 24, 2013 It is too difficult to use two texturesUse just one, the visible and then use llSetLinkAlpha() integer root = 1;default{ touch_end( integer n) { llSetLinkAlpha( 1+!root, 1.0, ALL_SIDES); llSetLinkAlpha( 1+ root, 0.0, ALL_SIDES); root = !root; }} That's all :smileysurprised::smileyvery-happy: Note: This script will be in the root prim only, the child prim should be without a script Link to comment Share on other sites More sharing options...
FallenAngel Savira Posted February 24, 2013 Author Share Posted February 24, 2013 I wanted to link the 2 items to some other stuff but with just these 2 textures swopping Link to comment Share on other sites More sharing options...
Qie Niangao Posted February 24, 2013 Share Posted February 24, 2013 Should the swapping happen when any part of the object is touched, or only when one of the swappable prims is touched? (or when only the visible one of the swappable prims is touched?) This affects not only the script, but how many scripts you actually need. If any part can be touched, it's okay for the mouse cursor to change to show touchability anywhere over the object, so there can be just one script in the root prim. If not, then only the touchable child prim(s) should be in a script state that handles touch-related events (and in that case, the root prim really better not be one of the swappable prims). Also, can the swappable prims have unique names or descriptions, so the script can find them no matter how the object gets linked? And Dora is almost surely correct that you want to toggle alpha, not textures. There's a very subtle difference affecting right-click behavior, but it's very unlikely to be relevant here. Link to comment Share on other sites More sharing options...
FallenAngel Savira Posted February 24, 2013 Author Share Posted February 24, 2013 I am making a childrens bed, i want the top blanket to seem to move on touch, i have a sculpt for the blanket as if the bed is neatly made and another sculpt where the blanket is screwed up and falling off the bed. I want to be able to touch the blanket and toggle between the 2 sculpts with the other one going out of sight. I have tried a sculpt changer script but it doesnt remember the positions or texture repeats. So i am trying it now with a texture changer so one goes to alpha and the other stays in sight. i only want it on touch with the blanket, the blankets will be linked to the beds but the mattress's on the beds have MLP menu's in. Hope this makes sense and Thank you very much both of you for trying to help Link to comment Share on other sites More sharing options...
Dora Gustafson Posted February 24, 2013 Share Posted February 24, 2013 That is not very hard to doHere is a slightly different version of the script where you can set the link number values as you please integer alpha = 1;integer prim1_LinkNumber = 1; // exampleinteger prim2_LinkNumber = 2; // exampledefault{ touch_end( integer n) { llSetLinkAlpha( prim1_LinkNumber, (float)alpha, ALL_SIDES); llSetLinkAlpha( prim2_LinkNumber, (float)(!alpha), ALL_SIDES); alpha = !alpha; }} What Qie said about clicking is very wise and you should pay attention The alpha toggling is independent of the texture on the prims, so you should just apply one fixed texture to each prim :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
FallenAngel Savira Posted February 24, 2013 Author Share Posted February 24, 2013 Ty, I am really bad at scripting so even the very simple things get me completely lost. I will go try it out now. Link to comment Share on other sites More sharing options...
FallenAngel Savira Posted February 24, 2013 Author Share Posted February 24, 2013 Ok, that works fine with the blankets linked together but as soon as I link them to the bed it all goes wrong, I have tried using the bed base as the root prim and the 1 of the blankets as the root prim, neither work right Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 24, 2013 Share Posted February 24, 2013 Root = link #1 Child 1 = link #2 Child 2 = link #3 Script in Root Link to comment Share on other sites More sharing options...
Dora Gustafson Posted February 24, 2013 Share Posted February 24, 2013 You have to figure out what link number each of your blankets are when it is all linked together and use those numbers in the script You can find the numbers by a helping script from an example here in the wiki When you have the numbers you can delete this script Feed the numbers to the script you had previously Keep the script in the root prim, that is simplest if it doesn't conflict with other scripts :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Qie Niangao Posted February 24, 2013 Share Posted February 24, 2013 i only want it on touch with the blanket, the blankets will be linked to the beds but the mattress's on the beds have MLP menu's in. I'd suppose that the mattress, where the MLP scripts are, is the root prim so that touching anywhere on the bed brings up the MLP menu. But we really don't want to wake up MLP when we're just toggling the blanket visibility, so we can't handle those touch events in the root prim (unless we change the MLP scripts to ignore touches from certain child prims). Here's one approach. Put this script in each of the blanket prims, and be sure the "neat" blanket has the word "made" somewhere in its name, then reset scripts. integer TOGGLE_BLANKET_MSG = -257634599; // could be anythingstring SUBNAME_FOR_MADE_BED_BLANKET = "made";default{ state_entry() { if (~ llSubStringIndex(llToLower(llGetObjectName()), SUBNAME_FOR_MADE_BED_BLANKET)) state visible; else state invisible; }}state visible{ state_entry() { llSetLinkAlpha(LINK_THIS, 1.0, ALL_SIDES); } touch_end(integer total_number) // NOT touch_start (a very old bug) { llMessageLinked(LINK_ALL_OTHERS, TOGGLE_BLANKET_MSG, "", NULL_KEY); state invisible; }}state invisible{ state_entry() { llSetLinkAlpha(LINK_THIS, 0.0, ALL_SIDES); } link_message(integer sender_num, integer num, string str, key id) { if (TOGGLE_BLANKET_MSG == num) state visible; }} Note that I've barely tested this, so scrutiny is warranted. Also, if anything else besides touch (such as MLP) should make or unmake the bed, this should be done differently. Link to comment Share on other sites More sharing options...
FallenAngel Savira Posted February 24, 2013 Author Share Posted February 24, 2013 got it right finally, thank you everyone :matte-motes-big-grin: 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