Hi, I am working on the transparency script (and leaving the colour changing script for the time being).
I've put some bits together from a few of the scripts that I have seen in the tutorials, but cannot get it quite right. I wonder if you could take a look and see what I might be doing wrong?
The script below is doing a nice job of fading the object in and out repeatedly when an avatar is near. I would like it to stay transparent for a little longer (say 2s) before returning to it's previous state. I've tried adding a timer, but I think I may be missing something? (I'm trying to create the impression of a flickering projection).
integer counter;
float gap = 2.0;
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 10, PI, 5);
llSetTimerEvent(gap);
}
sensor(integer total_number) {
// fade out
float alpha = 0.3;
while (alpha >= 0.0)
{
llSetLinkAlpha(LINK_SET, alpha, ALL_SIDES);
alpha -= 0.001;
}
// fade in
while (alpha < 0.3)
{
alpha += 0.001;
llSetLinkAlpha(LINK_SET, alpha, ALL_SIDES);
}
}
}