Artix Ruxton Posted May 15, 2011 Share Posted May 15, 2011 Does anyone know how to llUnsit an avatar from a prim if another avatar is already sitting on it? AKA make an object that ONLY one person can sit on at a time.-- Artix Link to comment Share on other sites More sharing options...
Qwalyphi Korpov Posted May 15, 2011 Share Posted May 15, 2011 The resident who provided the previous content, if any, has replaced it with this generic statement. Link to comment Share on other sites More sharing options...
Artix Ruxton Posted May 15, 2011 Author Share Posted May 15, 2011 Yeah I've been trying that but for some reason when a second avatar sits down and I try to llUnSit(llAvatarOnSitTarget()) it unsits the person that's already sitting down, not the person thats trying to sit down. Here's a code snippet: key user = NULL_KEY; // global variable changed(integer change) { if (change & CHANGED_LINK) { key sitter = llAvatarOnSitTarget(); if(sitter) { if(user == NULL_KEY) { user = sitter; llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION); llStartAnimation("sleep"); } else if(sitter != user) { Say(llKey2Name(user)+" is resting here."); llUnSit(user); } } else { llResetScript(); } } Link to comment Share on other sites More sharing options...
Artix Ruxton Posted May 15, 2011 Author Share Posted May 15, 2011 sorry type in that, should read llUnSit(sitter); Also, I was thinking of recursing through the set of linked prims and finding the second person to sit down's UUID and compare that to the llAvatarOnSitTarget(), because it seems like only the first person to sit down on the prim registers as being on the Sit Target Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 That's right. You can only have one person on a sit target at a time. And a prim can only have one sit target. That doesn't mean that a second person can't sit. If the prim is large enough to have space for a second (or third....) person, that person can sit anywhere. llUnSit only applies to the person who is on the actual sit target, though. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 I haven't tried this, but it might be worth seeing if you can rez a second phantom version of the seat just barely above the actual one as soon as person A sits down. Then, put a sit target in that seat, along with a short script that automatically unseats anyone who sits on it. Kill that phony seat as soon as person A stands up. 1 Link to comment Share on other sites More sharing options...
Artix Ruxton Posted May 15, 2011 Author Share Posted May 15, 2011 That's what I figured Rolig, so is there's no way to llUnsit additional avatars who sit on the prim huh? Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 15, 2011 Share Posted May 15, 2011 I've not tested it, but something on these lines might do it. The idea is that llGetObjectPrimCount(llGetKey()) will return the number of prims in the linkset -- assuming it's in the root prim, otherwise I guess you need llGetObjectPrimCount(llGetLinkKey(1)) -- while llGetNumberOfPrims() is prims plus seated avatars. Worth a try, anyway. key av; default { state_entry() { llSitTarget(<0.0,0.0,0.5>,ZERO_ROTATION); } changed(integer change) { if(change & CHANGED_LINK){ av = llAvatarOnSitTarget(); if(av!=NULL_KEY){ if(llGetNumberOfPrims()>(llGetObjectPrimCount(llGetKey()) + 1)){ llUnSit(av); } } } } } ETA -- dunno what's happening with the editor 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 Hey! I just tried it. It DOES work, beautifully. Here's the script for a real seat.... default { state_entry() { llSitTarget(<0.85,0.0,0.8>,ZERO_ROTATION); } changed(integer change) { if(change & CHANGED_LINK) { integer CHAN = (integer)("0xF" + llGetSubString(llGetKey(),0,6)); key AV = llAvatarOnSitTarget(); if (AV) { llRezAtRoot("NewSeat",llGetPos() + <0.0,0.0,0.02>, ZERO_VECTOR,ZERO_ROTATION,CHAN); } else { llWhisper(CHAN,"Get Lost!"); } } } } And here's a script to put in an identical phony seat, which you thent put into the real seat.... default { on_rez(integer startup) { llListen(startup,"","",""); llSitTarget(<0.0,0.0,0.1>, ZERO_ROTATION); } changed (integer change) { if(change & CHANGED_LINK) { if(llAvatarOnSitTarget()) { llUnSit(llAvatarOnSitTarget()); } } } listen(integer channel, string name, key id, string msg) { if (msg == "Get Lost!") { llDie(); } } } ETA: WHAT IS GOING ON with this stupid editor??? This looks really dumb, but the scripts do work. I just can't get them to format correctly here. Cut and paste them into your own editor, though... :smileymad: Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 Hehehe... Not as tricky as my solution, but I like it better. Saves an extra script and an extra prim. Brava! Link to comment Share on other sites More sharing options...
Void Singer Posted May 15, 2011 Share Posted May 15, 2011 they broke Cerise's wonderful highlighter =( they've mucked up the pre tags even worse somehow, and now they don't actually work if they contain any formatting code, and start collapsing spaces and line returns... I am very annoyed Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted May 15, 2011 Share Posted May 15, 2011 Oh it broke? OK I'll look at it. Link to comment Share on other sites More sharing options...
Void Singer Posted May 15, 2011 Share Posted May 15, 2011 span tags are being stripped of spaces and line returns are being replaced within them... Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Share Posted May 15, 2011 The script and style sheet have been updated to compensate well enough for now, details here. The new editor does not get along with the white-space:pre override any more. 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