Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how long does llSetAlpha take to execute?

Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
05-11-2009 14:40
I'm trying to fade something in and out between alpha values of float max = 0.85 and float min = 0.0 using
CODE
touch_start(integer total_number)
{
toggle =!toggle;
if(toggle){
counter = 0.0;
while(counter<max){
llSetAlpha(llGetAlpha(0)+increment,ALL_SIDES);
counter+=increment;
}
llSetAlpha(max, ALL_SIDES); //just to be on the safe side
}
else {
counter = max;
while(counter>min){
llSetAlpha(llGetAlpha(0)-increment,ALL_SIDES);
counter-=increment;
}
llSetAlpha(min, ALL_SIDES);//just to be on the safe side
}
}


How, other than trial and error, should I calculate increment so as to get from max to min in x seconds?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-11-2009 15:02
llSetAlpha gets sent as prim state updates to the client, so how long it takes to take effect depends on the network latency, jitter, and bandwidth, and the bandwidth settings you're using.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-11-2009 18:18
llSetAlpha also causes the script to sleep 0.1 seconds.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
05-11-2009 20:07
Thanks, both.. I wasn't at all certain about whether it slept the script or not; it seems the sort of thing that should, but there's nothing in the tool-tip about it and the SL wiki specifically says it doesn't, so I wasn't sure.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-11-2009 20:27
From: Strife Onizuka
llSetAlpha also causes the script to sleep 0.1 seconds.

/me adds SVC-4244 before noticing that the wiki says there's no delay. I'm guessing this wiki is incorrect because llSetAlpha does a (full?) object update.

https://jira.secondlife.com/browse/SVC-4244
From: someone
New llFunction to fade to/from transparent, please

It would be nice to have a new function that would cause a prim face to change to some desired % transparent over time. This would be a much nicer effect than the instant changes we get now and would be a easier than working around the forced .1 delay scripts have now.
Maybe something like llFade (integer face, integer desiredPercentTransparent, float seconds)

If it made it easier to implement, I think maxing the time to something under 10 seconds would be ok. Certainly under 1 minute.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
DrDoug Pennell
e-mail is for old people
Join date: 13 Mar 2007
Posts: 112
05-13-2009 21:33
From: Sindy Tsure
/me adds SVC-4244 before noticing that the wiki says there's no delay. I'm guessing this wiki is incorrect because llSetAlpha does a (full?) object update.

https://jira.secondlife.com/browse/SVC-4244


This is probably obvious, but in the mean time you can always script around the abruptness.

while(alpha_num<=1)
{
llSetAlpha(alpha_num, ALL_SIDES);
alpha_num=alpha_num-.01;
}


Doug
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 03:48
From: DrDoug Pennell
This is probably obvious, but in the mean time you can always script around the abruptness.

while(alpha_num<=1)
{
llSetAlpha(alpha_num, ALL_SIDES);
alpha_num=alpha_num-.01;
}
Might take a while to finish there.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-14-2009 04:08
If there is supposed to be a delay on llSetAlpha, it's missing. Either runtime will run through 100 alpha levels in about half a second.

From: Sindy
I'm guessing this wiki is incorrect because llSetAlpha does a (full?) object update.

An update for sure, but a partial one.
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
05-14-2009 08:34
/me also thinks llSetAlpha does a full object update - I thought partials were just for position/rotation changes.. Easy enough to test except that I'm not in-world.

Even if it is only a partial update, doing it in a loop seems pretty expensive.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-14-2009 09:31
From: DrDoug Pennell

alpha_num = 1.0
while(alpha_num)
{
llSetAlpha(alpha_num, ALL_SIDES);
alpha_num=alpha_num - .01;
}

fixed (inifinite loop = bad) (100 shades of alpha? holy shitake mushrooms batman)

I know it USED to be a full update, because it's one of the old suggested tricks for forcing other partial updates to register (like setRot under a certain limit)

ETA:
GDMFSABS forum parsing algorithm, I hate Hate HATE you
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
05-14-2009 10:06
From: Void Singer
ETA:
GDMFSABS forum parsing algorithm, I hate Hate HATE you

You forgot the LL on the end: GDMFSABSLL
_____________________
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
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 10:12
From: Void Singer
fixed (inifinite loop = bad)
Maybe.

You shouldn't compare a floating point number for exact equality, because all floating point calculations are approximate. It is possible that the value of alpha will never equal zero. Always compare floating point numbers with <, <=, >, >=.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-14-2009 11:00
From: Argent Stonecutter
Maybe.

You shouldn't compare a floating point number for exact equality, because all floating point calculations are approximate. It is possible that the value of alpha will never equal zero. Always compare floating point numbers with <, <=, >, >=.

good point... although I do think hundredths properly map. but some values won't so yeah.

actually the best case would be to start at 100 and count down, and use counter/100 to get the right value (and you can still cap at 0=false) although the extra overhead may not be worth it...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 12:36
From: Void Singer
good point... although I do think hundredths properly map.
100 is not a power of two.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-14-2009 13:58
It is a partial update, that came from taking a few seconds to check.

A tight loop is silly for a much simpler reason, you aren't going to get that many evenly spaced steps in that time. In the half second it takes to loop through 100 alpha levels, you're being split up into roughly 23 time slices with all the other sim activity happening in between. Scripts aren't going to provide the resolution to do a lot better. It's a waste of effort. llSetTextureAnim with a stepped gradient might be able to deliver.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-14-2009 14:46
From: Viktoria Dovgal
It is a partial update, that came from taking a few seconds to check.

A tight loop is silly for a much simpler reason, you aren't going to get that many evenly spaced steps in that time. In the half second it takes to loop through 100 alpha levels, you're being split up into roughly 23 time slices with all the other sim activity happening in between. Scripts aren't going to provide the resolution to do a lot better. It's a waste of effort. llSetTextureAnim with a stepped gradient might be able to deliver.

could timer loop it, but 100 is probably overkill.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-14-2009 18:20
Wow.. I didn't believe it until I saw it myself - it IS just a partial update. Nothing but blue with Show Updates on.

It would be nice to have a list of what changes cause full updates and which cause partials..
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 18:24
From: Sindy Tsure
Wow.. I didn't believe it until I saw it myself - it IS just a partial update. Nothing but blue with Show Updates on.

It would be nice to have a list of what changes cause full updates and which cause partials..
It probably changes from one server version to the next.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-14-2009 18:52
From: Argent Stonecutter
It probably changes from one server version to the next.

/me bets it doesn't change very often at all.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 18:59
From: Sindy Tsure
/me bets it doesn't change very often at all.
If LL was doing it right, full updates would happen based on how long it had been since that specific prim had sent a full update, and not on what specific calls had been made.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-14-2009 19:22
From: Argent Stonecutter
If LL was doing it right...

You keep saying that..
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-14-2009 19:30
From: Sindy Tsure
You keep saying that..
It's not inconceivable.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
05-14-2009 19:35
Lol
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-15-2009 09:01
I do not think that word means what you think it means...

actually it should be easy enough to test.. find something that does a full update, and spam it... if it sticks with a full update, there ya go.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
DrDoug Pennell
e-mail is for old people
Join date: 13 Mar 2007
Posts: 112
05-22-2009 10:55
From: Void Singer
fixed (inifinite loop = bad) (100 shades of alpha? holy shitake mushrooms batman)


Oops - just caught back up with this. Shoulda been while alpha_num =>0.1 (or whatever).

I actually use this script all the time (the correct one, not the infinite loop version :-)) It makes for a nice smooth transition from opaque to transparent (and back if you need it).

Doug