It's been a few days now since I started reading the documentation on the LSL. I thought about halting this journey many times, but I'm happy that I've finally decided to learn this language. I hope to receive much criticism from many of you, so that I can better myself as I continue learning the LSL. :smileyvery-happy: /*************************************************
* Scripted by EvelynBianchi, also known as Lyn. *
* Date: 15/gennaio/2016 *
* Description: Simulates a two-way switch. *
*************************************************/
// Colour Palette
vector BIANCO = <1.0, 1.0, 1.0>; // WHITE
vector GRIGIO = <0.667, 0.667, 0.667>; // GRAY
vector BLU = <0.0, 0.45, 0.851>; // BLUE
float OPAQUE = 1.0;
integer gSwitch = TRUE; // Switch is on.
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
llSetColor(BIANCO, ALL_SIDES);
llSetText("On.", BLU, OPAQUE);
}
touch_start(integer num)
{
gSwitch = !gSwitch;
if (gSwitch) {
llSetColor(BIANCO, ALL_SIDES);
llSetText("On.", BLU, OPAQUE);
}
else {
llSetColor(GRIGIO, ALL_SIDES);
llSetText("Off.", BLU, OPAQUE);
}
}
}