Jump to content

No Object sit


Guest
 Share

You are about to reply to a thread that has been inactive for 4788 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Do you have really neat art/vender setup all around and want people to stop sitting on them. Well act now for only 99.99.99.99 L$ you can get the all in one None Sit Script! (sorry Just alittle humor)

 

This is a very none sit script. Slap it in anything you want to stop people from sitting on. Billboards/Venders/polls/lights etc..

 

Thats really it. Need help or anything else just leave a message I'll get back to you asap

 

Fixed! Thanks to "Dora Gustafson"

 

string who; // This is setup so you can add new features. Like a List or something
default 
{
    state_entry() 
    {
        llSitTarget( <0.0, 0.0, 0.01>, ZERO_ROTATION );
        llSetSitText("No Sit"); // Set the sit text to something new like NO SIT
    }
    
    changed(integer change) 
    { // something changed
        if (change & CHANGED_LINK) 
        { // and it was a link change
            if (llAvatarOnSitTarget() != NULL_KEY) 
            { // somebody is sitting on me
                who = llAvatarOnSitTarget(); // Declares what who means
                
                llUnSit(who); // unsit the Avatar
                
                //llInstantMessage(who,"You cannot sit on me!"); // You can use this to display a message to whoever trying sit on object
            }
            
        }
            
    }
}

 

 

By:Dora Gustafson

 

  • One script will cover a sphere with the sense radius (in this case 10meters)
  • Can unsit up to 16 avatars no matter if they are on one or more objects
  • Will work for agents sitting on the scripted object and agents over land owned by the scripted object's owner

LLSensor could be called in any event handler
Some might find it better to use a llSensorRepeat in order to make a scan at regular time intervals

 

 

// 'sense unsit' script by Dora Gustafson, Studio Dora 2011
default
{
    changed(integer change)
    {
        llSensor("", NULL_KEY, AGENT, 10.0, PI);
    }
    sensor(integer num)
    {
        integer i;
        for (i=0; i<num; ++i)
        if (llGetAgentInfo(llDetectedKey(i)) & AGENT_ON_OBJECT) 
        {
            llUnSit(llDetectedKey(i));
            llWhisper( PUBLIC_CHANNEL, llDetectedName(i)+"! Do not sit!");
        }
    }
}

 

 

 

 

 

 

 

  • Like 2
Link to comment
Share on other sites

Sorry but you haven't tested that script too well.
If llSitTarget() isn't set you can sit on the object as much as you like.

 


Mulligan Silversmith wrote:

string who; // This is setup so you can add new features. Like a List or something
default
{
state_entry()
{
llSetSitText("No Sit"); // Set the sit text to something new like NO SIT
}

changed(integer change)
{ // something changed
if (change & CHANGED_LINK)
{ // and it was a link change
if (llAvatarOnSitTarget() != NULL_KEY)
{ // somebody is sitting on me
who = llAvatarOnSitTarget(); // Declares what who means

llUnSit(who); // unsit the Avatar

//llInstantMessage(who,"You cannot sit on me!"); // You can use this to display a message to whoever trying sit on object
}

}

}
}

It could be done like this:

// 'do not sit' script by Dora Gustafson, Studio Dora 2010
default
{
state_entry()
{
llSitTarget( <0.0, 0.0, 0.01>, ZERO_ROTATION );
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key sitter = llAvatarOnSitTarget() ;
if(sitter != NULL_KEY)
{
llUnSit(sitter);
llInstantMessage( sitter, "Do not sit on me, touch me!");
}
}
}
}

 

Link to comment
Share on other sites

eyeroll

default{	changed( integer vBitChg ){		if (CHANGED_LINK & vBitChg ){			vBitChg = llGetNumberOfPrims() * !!llGetAttached() + llGetObjectPrimCount( llGetKey() );			while (llGetNumberOfPrims() > vBitChg){				 //-- you could insert animations or other player abuse here, reposition them, etc				llUnSit( llGetLinkKey( -~vBitChg ) );			}		}	}}

this will catch all avatars on the object, and requires no sit target... (if you only target the one on the sit target, you miss the ones that might not be on it) =X

Link to comment
Share on other sites

The script does what is claimed but
She who's name must not be spoken has once more managed to create a code I have a hell of a time reading:smileymad:


Void Singer wrote:

eyeroll

this will catch all avatars on the object, and requires no sit target... (if you only target the one on the sit target, you miss the ones that might not be on it)
=X

I fail to see though, how could it be possible to unsit more avatars on an object when this or one of the simple scripts are in it?
(They will unsit any avatar trying to sit)

 

Link to comment
Share on other sites

 


Dora Gustafson wrote:

I fail to see though, how could it be possible to unsit more avatars on an object when this or one of the simple scripts are in it?

(They will unsit any avatar trying to sit)

 

Good point. If the sit target is set, then a simple llUnSit(llAvatarOnSitTarget()) should prevent one or more avatars from sitting (unless they are using a viewer that allows the av to override that restriction).  I'm stretching to think of a situation where I might want to use Void's method, but it does show a way to handle the unsit without defining a sit target.

 

Link to comment
Share on other sites

Two situations

A) Ridiculous lag makes the script slow enough that it can't respond fast enough to catch multiple sitters at once (unlikely, but possible)

B) The script is incorporated into a larger script, and another event or processing causes the delay of the changed event and more than on person sits (a very real possibility)

 

the only real trickery is the line that gets the prim count..

llGetNumberOfPrims returns a count including avatars (which can't be present if it's an attachment), llGetObjectPrimCount give accurate counts, ignoring avatars, but is bugged on attachments to return 0. So to get accurate prim count regardless you have to use both. llGetAttached NOT'ed twice gives a true/false value to multiply by (letting you cancel the one you don't need)... The reasoning behind doing it is so that the changed event doesn't get triggered in an infinite loop (since we're comparing prim to avatar counts) if for some reason the object is also attached latter.

the reused variable is technically not good practice, since code that comes after may expect it's original contents, but it does save creating a new variable.

the bitwise operation of (-~) is equal to adding 1 to the value, in this case one link number past the end of prim linkset, which is the first seated avatars linknumber...

Link to comment
Share on other sites

To day I had a deeper understanding for some LSL functions! That's nice, Thank you:)


Void Singer wrote:

llGetNumberOfPrims returns a count including avatars (which can't be present if it's an attachment), llGetObjectPrimCount give accurate counts, igonring avatars, but is bugged on attachments to return 0. so to get accurate prim count regardless you have to use both. llGetAttached NOT'ed twice gives a tru false value to multiply by... the reasoning behind doing it is so that the changed event doesn't get triggered in an infinite loop if for some reason the object is also attached latter.


 

Link to comment
Share on other sites

Here is yet another approach:

 

// 'sense unsit' script by Dora Gustafson, Studio Dora 2011
default
{
changed(integer change)
{
llSensor("", NULL_KEY, AGENT, 10.0, PI);
}
sensor(integer num)
{
integer i;
for (i=0; i<num; ++i)
if (llGetAgentInfo(llDetectedKey(i)) & AGENT_ON_OBJECT)
{
llUnSit(llDetectedKey(i));
llWhisper( PUBLIC_CHANNEL, llDetectedName(i)+"! Do not sit!");
}
}
}

 

  • One script will cover a sphere with the sense radius (in this case 10meters)
  • Can unsit up to 16 avatars no matter if they are on one or more objects
  • Will work for agents sitting on the scripted object and agents over land owned by the scripted object's owner

LLSensor could be called in any event handler
Some might find it better to use a llSensorRepeat in order to make a scan at regular time intervals

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4788 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...