Jump to content

catching unsitters


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

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

Recommended Posts

Is there an event to capture the UUID before an av unsits? One strategy would be to keep track of who sat in a global variable, then use that UUID to say they unsat, and empty the variable. However one issue could be if more than one av sat, then it becomes unreliable and/or complicated.

 

ex.

1-1-1-1 sat on me!
1-1-1-1 unsat.

i suppose unsitting is standing. 

 

  • Like 1
Link to comment
Share on other sites

10 hours ago, Khadijah Starchild said:

Oh i see, so react to change links, then iterate all the links to see who is missing.

technically you only need to iterate on the last llGetNumberOfPrims() - llGetObjectPrimCount(llGetKey()) links which should be the same as llList2Integer(llGetObjectDetails(llGetKey(),[OBJECT_SIT_COUNT]),0); sitting avatars are always higher link numbers than linked prims/meshes.

alternatively, iterate on all avatars you think should be sitting on the object and check whether their OBJECT_ROOT is still the object. (but that wouldn't find someone sitting down, only standing up)

Edited by Quistess Alpha
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 6/8/2023 at 9:08 PM, Khadijah Starchild said:

Is there an event to capture the UUID before an av unsits?

There are two main situations here.

  1. Someone stands up, and they end up standing on the chair or table.
  2. What goes on at region crossings.

Both work badly in SL. 2) I've discussed before. So I'm assuming you are talking about #1.

Here's something that might be worth trying in an AO: When the AO detects that a "stand" has happened from a sit, call llGetClosestNavPoint to try to find a walkable spot near there. If there's one within a few meters, move the avatar there. This will at least get your feet on the ground.

Unfortunately, you have to do this from a script in the avatar, such as an AO, rather than from a chair. Once the user clicks "Stand", the seat has no control. This is important as an anti-griefing measure. Also, you have to have the ground marked as "walkable". Few people know how to do that, because it's part of the little-used pathfinding system. Fewer will now that Virtual Kennel Club and their "trainers" have shut down.

Still, it would be nice if standing up didn't put you on top of furniture. That's so tacky.

  • Like 1
Link to comment
Share on other sites

3 hours ago, animats said:

Once the user clicks "Stand", the seat has no control.

Most* seats, though, are at a fixed location, on land controlled by the same owner as the seat. So a script in the seat can apply some physical force or impulse to gently nudge the standing avatar away from wherever they stand. Optionally, the seat script may set itself phantom immediately on a standing CHANGED_LINK, give a shove, then toggle phantom off again. Usually it's enough to just scale the pushing by the mass of the avatar and an assumed constant distance from the pushing object, but in theory the script might find the avatar's location to more precisely direct the force.

This is all custom, per-seat scripting. Not sure there's any useful way to generalize it, so the few times I've bothered, it's been a quite hideous kludge. It's pretty useful, though, to simplify Experience sit-on-collide logic that otherwise needs a frustratingly long hysteresis between sit-eligible collisions.

(All this said, I think the OP really only wanted to "capture" the avatar's UUID to properly congratulate them on escaping the seat.)

___________
* "Most" because vehicles, from which the avatar may stand pretty much anywhere, have a whole different set of problems, and preventing ugly dismounts is usually the least of it.

  • Like 2
Link to comment
Share on other sites

6 hours ago, animats said:

There are two main situations here.

  1. Someone stands up, and they end up standing on the chair or table.
  2. What goes on at region crossings.

Both work badly in SL. 2) I've discussed before. So I'm assuming you are talking about #1.

Here's something that might be worth trying in an AO: When the AO detects that a "stand" has happened from a sit, call llGetClosestNavPoint to try to find a walkable spot near there. If there's one within a few meters, move the avatar there. This will at least get your feet on the ground.

Unfortunately, you have to do this from a script in the avatar, such as an AO, rather than from a chair. Once the user clicks "Stand", the seat has no control. This is important as an anti-griefing measure. Also, you have to have the ground marked as "walkable". Few people know how to do that, because it's part of the little-used pathfinding system. Fewer will now that Virtual Kennel Club and their "trainers" have shut down.

Still, it would be nice if standing up didn't put you on top of furniture. That's so tacky.

 

In my application it does not need to cross a region/sim boundary. I am making a go-kart race and would like to know when the participant stands up from the vehicle, I was getting NULL_KEY in my database I suppose because when that event happens then there is no av UUID. Anyhow, I have enough info from this thread to make it work.   

i bought your escalator. it's great.

Link to comment
Share on other sites

5 hours ago, Qie Niangao said:

Optionally, the seat script may set itself phantom immediately on a standing CHANGED_LINK, give a shove, then toggle phantom off again.

An alternative I've used (for chairs at tables or similar) is to have the chair under the table normally, like it would tend to be in RL, and move out from the table when sat on. When 'unsat', it goes phantom, moves back under the table, then turns phantom off again. That usually does the trick, with maybe a delay between going phantom and moving it back so the avatar doesn't get carried along. I have a similar way with a linkset of chairs/table - in fact this one has the entire room linked and is triggered by AVSit's sit/unsit link messages in the individually AVSit-scripted (and linked) chairs:

link_message(integer sender, integer num, string msg, key id){
   if (sender==llGetLinkNumber()) { // Message is from the AVSit in this prim
      if (num==90060) { // New sitter
         llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,gSitPos,PRIM_ROT_LOCAL,gSitRot]); // Move chair out
      }
      else if (num==90065) { // Lost sitter
         llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_PHYSICS_SHAPE_TYPE,PRIM_PHYSICS_SHAPE_NONE]); // Remove physics from chair
         llSleep(0.5); // Wait while above happens before moving chair
         gSitPos=llGetLocalPos();
         gSitRot=llGetLocalRot();
         llSetObjectDesc((string)gSitPos+","+(string)gSitRot); // Record our 'out' position in case user has moved us while seated
         llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,gInitPos,PRIM_ROT_LOCAL,gInitRot]); // Move back
         llSleep(0.2); // Wait for move before restoring physics
         llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_PHYSICS_SHAPE_TYPE,PRIM_PHYSICS_SHAPE_PRIM]); // Physics on
      }
   }
}

I use it on a stool that's under a built-in dressing table against a wall. Without it, the avatar invariably ends up stood on the table headbutting the wall. With it, worst case is the avatar momentarily stands on the stool as it begins to move, then falls to the floor where the stool was (in the out position). Sometimes it works perfectly and the avatar just stands on the floor. Either way, better than standing on the table.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 386 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...