llSetLinkAlpha interferring with Alpha textures?
|
Sutra Scribe
Registered User
Join date: 10 Nov 2008
Posts: 8
|
09-05-2009 23:22
Hi guys, I am using this script I will post below in a lamp I made. The lamp is made up of all solid prims but 3 textures on the lamp are alpha, tga files. These alpha textures on my lamps prims seem to be reacting to the script and the opacity I have set on them is changing everytime I click the lamp. My goal is for only the beam of light (alpha texture) coming from the lamp to show and hide when the lamp is clicked. Everything else, whether solid or alpha texture, needs to not respond to the script. The beam does disappear but not totally, and the script is making some of the other alpha textures disappear and/or change opacity value. What am I doing wrong? Oh and by the way I have the beam of light on the lamp set to 33% transparency in the edit menu  Any help is greatly appreciated ive been playing around with this for 2 days now and can not figure it out. default { on_rez(integer total) { llResetScript(); } touch_start(integer total_number) { //llOwnerSay("."  ; llSetLinkAlpha(2 , 0.0, ALL_SIDES); state otherway; } } state otherway { touch_start(integer total_number) { //llOwnerSay(".."  ; llSetLinkAlpha(LINK_SET , 1.0, 2); state default; } }
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-05-2009 23:54
From: Sutra Scribe default { on_rez(integer total) { llResetScript(); } touch_start(integer total_number) { //llOwnerSay("."  ; llSetLinkAlpha(2 , 0.0, ALL_SIDES); state otherway; } } state otherway { touch_start(integer total_number) { //llOwnerSay(".."  ; llSetLinkAlpha(LINK_SET , 1.0, 2); ///in this line you're changing the whole link set on face 2, could be your problem state default; } } here it is in one state using a switch. and in the edit window you're giving the beam 33% alpha, in the script it's backwards, so you'll do 67% (0.67), you made need to check for syntax errors, i just edited it in the forum posting window integer OnOff = 1;
default { on_rez(integer total) { llResetScript(); }
touch_start(integer total_number) { if(OnOff){llSetLinkAlpha(2 , 0.0, ALL_SIDES);} else{llSetLinkAlpha(2,0.67,ALL_SIDES);} OnOff= !OnOff; } }
|
Sutra Scribe
Registered User
Join date: 10 Nov 2008
Posts: 8
|
09-06-2009 01:59
Thanks so much for your kindness to help me. I inserted that and it is working very well.
Edit to add, when I click the lamp to "hide" the beam, I thought it was hidden but when I look closely i can see its still there, almost invisible, but not quite, I changed some of the numbers in the script but none seem to do the trick in getting it totally invisible. Any pointers?
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-06-2009 06:14
From: Sutra Scribe Thanks so much for your kindness to help me. I inserted that and it is working very well.
Edit to add, when I click the lamp to "hide" the beam, I thought it was hidden but when I look closely i can see its still there, almost invisible, but not quite, I changed some of the numbers in the script but none seem to do the trick in getting it totally invisible. Any pointers? i'm really not sure, Alpha 0.0 should hide it completely
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-06-2009 06:54
From: Sutra Scribe Thanks so much for your kindness to help me. I inserted that and it is working very well.
Edit to add, when I click the lamp to "hide" the beam, I thought it was hidden but when I look closely i can see its still there, almost invisible, but not quite, I changed some of the numbers in the script but none seem to do the trick in getting it totally invisible. Any pointers? That's an alpha sorting issue. You are looking at it against a background that has an alpha channel in it. An example of the problem is shoes that use an invisiprim to hide parts of your foot so they do not stick out of the shoe. If you walk on a floor made of something like marble with an alpha channel, you can see the invisiprim. Unfortunately there is nothing you can do to fix that problem besides use the lamp in a location with no alpha channels in the background, or just ignore it.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-06-2009 08:28
or you could change the size of it too, you'll probably need to remove the spaces in the vectors for this to compile integer beam = 2;//set to the prim number for the beam integer OnOff = 1; vector scale = < 0.25,0.25,0.25 >;//change to the scale of the beam prim in its normal form
default { on_rez(integer total) { llResetScript(); }
touch_start(integer total_number) { if(OnOff) { llSetLinkPrimitiveParams(beam,[PRIM_SIZE,scale]); llSetLinkAlpha(beam , 0.67, ALL_SIDES); } else { llSetLinkPrimitiveParams(beam,[PRIM_SIZE,< 0.01,0.01,0.01 >]); llSetLinkAlpha(beam,0.0,ALL_SIDES); } OnOff= !OnOff; } }
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-06-2009 08:50
The only case I know of where a beam with 0.0 alpha would be visible is if it's set to glow. Turn the glow off when the alpha is 0.0 and the ghost will go away.
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-06-2009 09:04
From: Argent Stonecutter The only case I know of where a beam with 0.0 alpha would be visible is if it's set to glow. Turn the glow off when the alpha is 0.0 and the ghost will go away. aah, didn't even think about glow. i was thinking, i don't think i've seen alpha sorting issues for completely transparent textures
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-06-2009 09:06
From: Jesse Barnett That's an alpha sorting issue. You are looking at it against a background that has an alpha channel in it. An example of the problem is shoes that use an invisiprim to hide parts of your foot so they do not stick out of the shoe. If you walk on a floor made of something like marble with an alpha channel, you can see the invisiprim.
Unfortunately there is nothing you can do to fix that problem besides use the lamp in a location with no alpha channels in the background, or just ignore it. Now I thought alpha sorting was one thing and invisiprims something else. Aren't alpha sorting errors what you get when several alpha textures overlap and result in parts of some of them showing up in the wrong order? And don't invisiprims work because they only make textures with alpha in them invisible, which is why they hide the skin of your feet, but not the boot itself? And isn't that why you see the floor through the carpet around your boots?
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-06-2009 09:37
From: EF Klaar Now I thought alpha sorting was one thing and invisiprims something else. They are. Invisiprims aren't alpha-sorted. That's why they work, they're more or less treated as opaque by the sorting algorithm and transparent by the display algorithm.
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-06-2009 11:26
From: Argent Stonecutter They are. Invisiprims aren't alpha-sorted. That's why they work, they're more or less treated as opaque by the sorting algorithm and transparent by the display algorithm. But they are not always treated as transparent by the display algorithm. If you stand on a surface with no alpha channel with a pair of shoes with an invisprim, the invisiprim is not visible. If you stand on a marble floor with an alpha channel in it, you can see the shoes and the invisiprim.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-06-2009 11:41
I guess I'm still confused. Surely what you see is a hole in the alpha texture created by the invisiprim, and not the invisiprim itself?
PS Or are there two different types of invisiprim texture which do two different things? I seem to remeber that the first invisiprim script i saw used two different textures.
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
09-06-2009 11:55
From: Jesse Barnett But they are not always treated as transparent by the display algorithm. If you stand on a surface with no alpha channel with a pair of shoes with an invisprim, the invisiprim is not visible. If you stand on a marble floor with an alpha channel in it, you can see the shoes and the invisiprim. That's because the sorting algorithm is going "that part of the alpha texture is behind an object, don't render it", while the display algorithm is going "ok, what do I need to render here" and not finding the invisiprim (it's ignored) or the alpha texture (the sorting algorithm has already thrown it out) and showing what's behind both.
|
Sutra Scribe
Registered User
Join date: 10 Nov 2008
Posts: 8
|
09-06-2009 14:35
From: Argent Stonecutter The only case I know of where a beam with 0.0 alpha would be visible is if it's set to glow. Turn the glow off when the alpha is 0.0 and the ghost will go away. That was the issue, thanks! Looks better with glow, I may have to try the tidbit Ruthven Willenov posted. If I want to add so only the owner can control the beam, how do I do that? Im a noob at this and have just been looking at various scripts trying to piece them together to compile my own. I have this other script which is supposedly something that can set it to public or private: key owner; integer h_listen; string ani; default { on_rez(integer params){llResetScript();} state_entry() { llOwnerSay("say /1hide to hide me or /1show to show me"  ; llOwnerSay("To make the pose balls public hide/show say /1public"  ; llOwnerSay("To make the pose balls private hide/show say /1private"  ; owner = llGetOwner(); ani = llGetInventoryName(INVENTORY_ANIMATION,0); h_listen = llListen(1,"",owner,""  ; } listen(integer channel,string name, key id, string msg) { if(channel==1 && llToLower(msg)=="hide"  { llSetAlpha(0,ALL_SIDES); llSetText("",<1,1,1>,0); } if(channel==1 && llToLower(msg)=="show"  { llSetAlpha(1,ALL_SIDES); llSetText(ani,<1,1,1>,1); } if(channel==1 && llToLower(msg)=="public"  { llListenRemove(h_listen); h_listen = llListen(1,"",NULL_KEY,""  ; } if(channel==1 && llToLower(msg)=="private"  { llListenRemove(h_listen); h_listen = llListen(1,"",owner,""  ; } } } So ive been looking at that trying to see what I could pull from it to add to my light beam script to make it owner-only (And possibly allow the owner to allow public access via a chat command as the lamp is no mod), but I can not quite comprehend what exactly to pick out of there and where to put it. I tried a few combos but get a syntax error. I think this script may be something where the owner can say "public" or "private" in chat and the script changes it to that, I think that because of the "llListen" command below the "  msg)=="private/public".. In other words, typing in public chat the words "private" or "public" would tell the object to be owner only or public access, am I totally off here?
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-06-2009 15:56
From: Sutra Scribe Looks better with glow llSetLinkPrimitiveParams (beam, [PRIM_GLOW, ALL_SIDES, glow_value]). Turn glow off with a glow value of 0.0, or on with any value up to 1.0, depending on how intense a glow you need. From: someone I think this script may be something where the owner can say "public" or "private" in chat and the script changes it to that, I think that because of the "llListen" command below the "  msg)=="private/public".. In other words, typing in public chat the words "private" or "public" would tell the object to be owner only or public access, am I totally off here? Yes. Calling llListen with "owner" (the key obtained by the call to llGetOwner) as the third parameter will specify a listener that only listens to the owner. Call it with NULL_KEY and it will listen to everybody. The if (message == "blah blah"  tests take place inside the "listen" event, which is triggered when the listener picks up chat on channel 1. Incidentally, the test for channel 1, if (channel == 1), is superfluous is this case, as only one listener is used, and it has been set to listen on channel 1 - the first parameter of the call to llListen. PS There are other aspects of the example script that should be improved, and I'm sure other posters in this forum will pounce on them, but try to get the basics working first and then tidy it up. Though having said that, it's always easier to work on a script that starts off tidy and then stays that way.
|