DONTSITONME
From OpenSimulator
(Difference between revisions)
m (Indentation) |
|||
Line 3: | Line 3: | ||
<source lang="lsl"> | <source lang="lsl"> | ||
+ | // This script defines an object that will send warning messages when sat upon. | ||
+ | |||
+ | // Define default state | ||
default | default | ||
{ | { | ||
+ | // State entry function called when the script starts or resets | ||
state_entry() | state_entry() | ||
{ | { | ||
+ | // Set a timer event to trigger every 25 seconds | ||
llSetTimerEvent(25.0); | llSetTimerEvent(25.0); | ||
+ | |||
+ | // Set the sit target for avatars to sit on | ||
llSitTarget(<0.0, 0.0, 0.1>, <0.0, 0.0, 0.0, 1.0>); | llSitTarget(<0.0, 0.0, 0.1>, <0.0, 0.0, 0.0, 1.0>); | ||
− | llSay(PUBLIC_CHANNEL, " | + | |
+ | // Send a message to the public chat channel | ||
+ | llSay(PUBLIC_CHANNEL, "Don't sit on me!"); | ||
} | } | ||
+ | // Changed event handler called when something about the object changes | ||
changed(integer how) | changed(integer how) | ||
{ | { | ||
+ | // Check if the change involves a link | ||
if ((how & CHANGED_LINK) != 0) | if ((how & CHANGED_LINK) != 0) | ||
{ | { | ||
+ | // Check if an avatar is sitting on the sit target | ||
if (llAvatarOnSitTarget() != "") | if (llAvatarOnSitTarget() != "") | ||
{ | { | ||
+ | // Send a warning message to the public chat channel | ||
llSay(PUBLIC_CHANNEL, "ACK! GET OFF !!!"); | llSay(PUBLIC_CHANNEL, "ACK! GET OFF !!!"); | ||
} | } | ||
Line 23: | Line 36: | ||
} | } | ||
+ | // Timer event handler called when the timer event triggers | ||
timer() | timer() | ||
{ | { | ||
+ | // Send a periodic warning message to the public chat channel | ||
llSay(PUBLIC_CHANNEL, "Please don't sit on me"); | llSay(PUBLIC_CHANNEL, "Please don't sit on me"); | ||
} | } |
Revision as of 02:52, 5 March 2024
// This script defines an object that will send warning messages when sat upon. // Define default state default { // State entry function called when the script starts or resets state_entry() { // Set a timer event to trigger every 25 seconds llSetTimerEvent(25.0); // Set the sit target for avatars to sit on llSitTarget(<0.0, 0.0, 0.1>, <0.0, 0.0, 0.0, 1.0>); // Send a message to the public chat channel llSay(PUBLIC_CHANNEL, "Don't sit on me!"); } // Changed event handler called when something about the object changes changed(integer how) { // Check if the change involves a link if ((how & CHANGED_LINK) != 0) { // Check if an avatar is sitting on the sit target if (llAvatarOnSitTarget() != "") { // Send a warning message to the public chat channel llSay(PUBLIC_CHANNEL, "ACK! GET OFF !!!"); } } } // Timer event handler called when the timer event triggers timer() { // Send a periodic warning message to the public chat channel llSay(PUBLIC_CHANNEL, "Please don't sit on me"); } }