DONTSITONME

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
{{Template:Quicklinks}}
+
{{Quicklinks}}
<br />
+
default
+
{
+
    state_entry()
+
    {
+
        llSetTimerEvent(25);
+
        llSitTarget(<0,0,0.1f>,<0,0,0,1>);
+
        llSay(0,"Dont sit on me!");
+
    }
+
    changed(integer how)
+
    {
+
        if ((how & CHANGED_LINK) != 0)
+
        {
+
            if (llAvatarOnSitTarget() != "")
+
            {
+
                llSay(0,"ACK!  GET OFF!!!!!!!");   
+
            }
+
        }
+
    }
+
    timer()
+
    {
+
        llSay(0,"Please don't sit on me");   
+
    }
+
}
+
  
 +
Statement: This script defines an object in the OpenSim environment that sends warning messages to the public chat channel when avatars attempt to sit on it.
 +
It sets a sit target for avatars, sets a timer event to periodically send warning messages, and triggers a warning message when an avatar sits on the object.
 +
 +
<source lang="lsl">
 +
// 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");   
 +
    }
 +
}
 +
</source>
  
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Latest revision as of 02:54, 5 March 2024

Statement: This script defines an object in the OpenSim environment that sends warning messages to the public chat channel when avatars attempt to sit on it. It sets a sit target for avatars, sets a timer event to periodically send warning messages, and triggers a warning message when an avatar sits on the object.

// 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");    
    }
}
Personal tools
General
About This Wiki