|
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
|
12-21-2008 13:31
I've written a script that cycles colors with two for loops. In order to slow down the color cycling I've added a llSleep statement with a value of .025 stored in a float named "gradient_delay". Initially, I was testing the script using just .025 in the llSleep statement, but then after I added my notecard reading code, which populates gradient_delay with the same value of .025, I noticed my for loop slowed down considerably. I switched the llSleep statement back to the value of .025 and it runs normally again. I checked gradient_delay to make sure it's receiving the correct setting and it is. My question is, why is there such a performance hit? I know the LSL has to look up the float value, but there shouldn't be such a performance difference. Are there any alternatives? From: someone integer t; integer y; for(y=0;y<list_length;y++) { start_color = (vector)llList2String(start_colors,y); end_color = (vector)llList2String(end_colors,y); for(t=0;t<ceiling;t++) { llSetColor(colorForStep(t),ALL_SIDES); llSleep(.025); } llSleep(cycle_delay); }
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
12-21-2008 14:16
What happens if you use a variable, but just initialise it to 0.025 in code (rather than from a notecard)? Does the same thing happen?
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
12-21-2008 15:01
Do you do the color cycling after you've read in the whole notecard?
|
|
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
|
12-21-2008 16:08
Ah yes... I found the problem. As I do sometimes to save time I copied an if statement in my notecard parsing and forgot to change the variable name. That's what was causing it. Thanks for your time and help. *slaps forehead*
|