MyAvatar.sessionUUID Checking if Valid


#1

Is it possible to check if a stored sessionUUID is currently valid / within Domain via script? I was running through the documentation on my free time at my office, but couldn’t find any use for it.

Out of curiosity, I made an “attach avatar to Entity” script which allows multiple of avatars to “sit” or “strap them selves in” to an Entity last night.and not noticing similar single seat version was done earlier with the click to transport nodes in CellSci.

In its simplicity, Slots, locations and rotations of the slots, and the animations per slots, are assigned to userData of an Entity. Every interaction by a new user assigns the user to a slot, and assigns the local instance of the script to make the user bind to that slot. If the user interacts with the object while it is “attached”, they are detached and removed from the slot. Later on this script can be extended upon onto Vehicles and the likes, with separate permissions being assigned to each slot.

However with a limited number of slots, If a user disconnects, CTDs, or simply moves to another domain, their ID would still persist in the userData list, and use up a slot. I’d like to make a clean up check every time a user clicks on the object to make sure all the UUIDs are current.

Simply put, I would want to be able to just check if a sessionUUID on the list is currently present in the domain Is there are method to do so, as it would give this some use.


#2

Yes,

Checkout the following function. AvatarList.getAvatar(avatarUUID) It returns a pointer to the avatar object

// i.e.
AvatarList.getAvatar(MyAvatar.sessionUUID);

If you give it an invalid UUID with a client-side script it will return MyAvatar.
If the UUID is a valid UUID but not known it will return null

Have fun!