For the first week of examples, as a gentle introduction into Linden script we were instructed to make a simple box that counted to 10 then touched. The script for this was reasonably simple to find on the lsl wiki page, once built the box counted to ten when it was touched and had a few other simple shouts when it was touched to many times at once, even a box doesnt like being manhandled too many times!
Below is the script for this box:
default
{
touch_start(integer total_number)
{
llOwnerSay(llDetectedName(0)+" has touched me");
llSetTimerEvent(10);
llOwnerSay("1");
}
timer()
{
llSetTimerEvent(12);
llOwnerSay("2");
llSetTimerEvent(9);
llOwnerSay("3");
llSetTimerEvent(7);
llOwnerSay("4");
llSetTimerEvent(6);
llOwnerSay("5");
llSetTimerEvent(5);
llOwnerSay("6");
llSetTimerEvent(4);
llOwnerSay("7");
llSetTimerEvent(3);
llOwnerSay("8");
llSetTimerEvent(2);
llOwnerSay("9");
llSetTimerEvent(1);
llOwnerSay("10");
state tickled;
}
}
state tickled
{
touch_start(integer total_number)
{
llOwnerSay("Thank you, that felt good.");
state annoyed;
}
}
state annoyed
{
touch_start(integer total_number)
{
llOwnerSay("not again");
state scream;
}
}
state scream
{
touch_start(integer total_number)
{
llOwnerSay("HELP!!!!!!!!!!!!!!");
state default;
}
}
This is the screenshot from Second Life showing the script in work on the box.
The timer didnt really seem to work more than once, hopefully i will be able to find out how the timer can be applied to more than one instance.

No comments:
Post a Comment