Mulligan Silversmith Posted March 14, 2011 Share Posted March 14, 2011 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 objectsWill work for agents sitting on the scripted object and agents over land owned by the scripted object's ownerLLSensor could be called in any event handlerSome 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!"); } } } 2 Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted March 14, 2011 Share Posted March 14, 2011 You know, I probably wouldn't have thought of posting something as 'anti-functional as this but I can see why people might want to use it. Well done you! Link to comment Share on other sites More sharing options...
WeeWillian Wylie Posted March 14, 2011 Share Posted March 14, 2011 Thank you...I happen to have a thing or two I would prefer people didn't sit on but never thought to ask if it oculd be done through scripting. Nice piece of work there. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 14, 2011 Share Posted March 14, 2011 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 More sharing options...
Mulligan Silversmith Posted March 14, 2011 Share Posted March 14, 2011 Sorry about that.. I know I forgotSomething, Thanks llSitTarget( <0.0, 0.0, 0.01>, ZERO_ROTATION ); Link to comment Share on other sites More sharing options...
Void Singer Posted March 15, 2011 Share Posted March 15, 2011 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) Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 15, 2011 Share Posted March 15, 2011 The script does what is claimed butShe 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: 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) 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 More sharing options...
Rolig Loon Posted March 15, 2011 Share Posted March 15, 2011 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 More sharing options...
Void Singer Posted March 15, 2011 Share Posted March 15, 2011 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 More sharing options...
Dora Gustafson Posted March 15, 2011 Share Posted March 15, 2011 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 More sharing options...
Dora Gustafson Posted March 16, 2011 Share Posted March 16, 2011 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 More sharing options...
Void Singer Posted March 16, 2011 Share Posted March 16, 2011 pretty nifty, I like.... one major limitation though.... it doesn't care if you are sitting on legit items or not... it will roust you from anything if youare in the sphere of influence (might make some local TP devices act twitchy too) Link to comment Share on other sites More sharing options...
Recommended Posts
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