Jump to content
Sign in to follow this  
DJxPurity

Transparency Script (Not SetAlpha)

Recommended Posts

I am looking for a simple code that changes a prim between 0% transparency and 99% transparency using a chat command like /5 0 for not transparent and /5 99 for 99% transparency. I have searched high and low on the lsl library and it keeps bringing me to complicated scripts that I don't need or SetAlpha scripts. I don't want to have to change the transparency in the texture menu, it needs to be script based for my idea to work. 

The thing is, I'm not looking for SetAlpha codes, because I don't want my prim to go 100% transparent because it'll ruin the concept of my idea. And that's literally all I want the script to do is change between those two transparency percentages on chat command. 

Can someone help me out on this? Thanks. 

Share this post


Link to post
Share on other sites


DJxPurity wrote:

I am looking for a simple code that changes a prim between 0% transparency and 99% transparency using a chat command like /5 0 for not transparent and /5 99 for 99% transparency. I have searched high and low on the lsl library and it keeps bringing me to complicated scripts that I don't need or SetAlpha scripts. I don't want to have to change the transparency in the texture menu, it needs to be script based for my idea to work. 

The thing is, I'm not looking for SetAlpha codes, because I don't want my prim to go 100% transparent because it'll ruin the concept of my idea. And that's literally all I want the script to do is change between those two transparency percentages on chat command. 

Can someone help me out on this? Thanks. 

I think what you are looking for is a SetAlpha script.   The setting is a float number in the range 0.0 to 1.0.   Which is like setting the transparency from 100% transparent to 0% transparent.  

Hint: set alpha to 0.5 is 50% transparent.

Addditional hints: 

alpha set to 1.0    is   0    percent transparent

alpha set to 0.01  is  99   percent transparent

edited to give additional hints

(1 - alpha setting) * 100 = percentage transparent

Share this post


Link to post
Share on other sites

SetAlpha is the transparncy. needs to be tighter on the listen, but did it fast

default{	state_entry()	{		llListen(5,"", "", "");	}	listen(integer channel, string name, key id, string message)	{		if(channel==5 && message == "on")//     /5 on		{			llSetAlpha(1.0, ALL_SIDES);		}		else if(channel==5 && message== "off")		{			llSetAlpha(0.1, ALL_SIDES);		}	}}

 

Share this post


Link to post
Share on other sites

Are you wanting to be able to say the transparency % in chat and then have the object change to that percentage of transparency? Or do you specifically want only two states of transparency? 

Share this post


Link to post
Share on other sites

Being able to say any transparency would be okay. I wouldn't mind that. Just as long as I can bring it from 0 up to 99

Share this post


Link to post
Share on other sites

I appreciate the help on the SetAlpha, unfortunately, it doesn't quite bring me up to 99%, which is necessary for my project. I will remember those values for the future. 


steph Arnott wrote:

SetAlpha is the transparncy. needs to be tighter on the listen, but did it fast
default{	state_entry()	{		llListen(5,"", "", "");	}	listen(integer channel, string name, key id, string message)	{		if(channel==5 && message == "on")//     /5 on		{			llSetAlpha(1.0, ALL_SIDES);		}		else if(channel==5 && message== "off")		{			llSetAlpha(0.1, ALL_SIDES);		}	}}

 

 

Share this post


Link to post
Share on other sites

reduce the floats  to siut 0.1 is 90% tranparent. Doubt you even notice 99% any way. Any how thats the correct script. Upto you.

ADDED, change it to 0.05 see how that looks.

Share this post


Link to post
Share on other sites

You're awesome, thanks! Works just fine. 


steph Arnott wrote:

reduce the floats  to siut 0.1 is 90% tranparent. Doubt you even notice 99% any way. Any how thats the correct script. Upto you.

ADDED, change it to 0.05 see how that looks.

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×