|
Carina Cannoli
Registered User
Join date: 22 Aug 2005
Posts: 13
|
12-04-2008 02:01
Ok I have this script that I can touch to make it fade, and it works great, but I want to be able to touch it again to make it back to 0 transparency. When it is 100% transparent, I might not be able to click it because I can't see it, so could I change it to voice command..show/hide. I prefer touch, but either way I don't know how to make it work. Could anyone help me...thank you.
float alpha;
default { state_entry() { llSetAlpha(1.0, ALL_SIDES); alpha = 1.0; }
touch_start(integer total_number) { while(alpha > 0.0) { alpha = (alpha - 0.1); llSetAlpha(alpha, ALL_SIDES); llSleep(0.05); } } }
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
12-04-2008 02:44
You can make it respond to chat commands using a couple of things: the "llListen" function to set it up (call that in the state_entry event usually), and the "listen" event which actually receives the chat messages. Here's a very basic example: state_entry() { llListen(0, "", NULL_KEY, "show"); }
listen(integer channel, string name, key id, string msg) { if (msg == "show") { alpha = 1.0; llSetAlpha(alpha, ALL_SIDES); } }
That will listen to anybody in chat range saying "show" on the public chat channel. You can change to a private channel, change it to only listen to the owner, and change "show" command to something else.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-04-2008 03:57
And for future reference here is how you do a touch switch: float alpha; integer switch = 1;
default { state_entry() { llSetAlpha(1.0, ALL_SIDES); alpha = 1.0; }
touch_start(integer total_number) { if (switch) { while (alpha > 0.0) { alpha -= 0.1; llSetAlpha(alpha, ALL_SIDES); llSleep(0.05); } } else { while (alpha < 1.0) { alpha += 0.1; llSetAlpha(alpha, ALL_SIDES); llSleep(0.05); } } switch = !switch; } }
_____________________
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
|
|
Carina Cannoli
Registered User
Join date: 22 Aug 2005
Posts: 13
|
12-04-2008 04:52
Thank you very much for your replies, it works great 
|