Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

preloading sounds, avatar login/logout

Waffle Projects
Registered User
Join date: 9 Aug 2006
Posts: 38
12-12-2007 12:58
I am writing a script that should preload all the sounds in its inventory when an avatar comes withing 10 meters of it. on its own, that works fine. however, i don't want to do this when I don't need to - so if the same avatar leaves and comes back, i don't need to reload those sounds again. fair enough, i just keep a running list of keys of avatars that i've already pre-loaded for and only do a preload if the sensed avatar is not on my list.

only problem is, if a person logs out and logs back in, they will still be on the list but may not have the sounds in their cache any more. what's the best solution to this? is there a way to detect whether an avatar has logged out and back in? was kinda hoping that maybe you get a different key each time you log in but that is not so. so... what can I do?
LarryS Laffer
Registered User
Join date: 29 Apr 2006
Posts: 1
12-12-2007 14:51
From: Waffle Projects
I am writing a script that should preload all the sounds in its inventory when an avatar comes withing 10 meters of it. on its own, that works fine. ... is there a way to detect whether an avatar has logged out and back in? was kinda hoping that maybe you get a different key each time you log in but that is not so. so... what can I do?


It kinda depends on how often the same agent comes by that object, but I would use a stride list, http://wiki.secondlife.com/wiki/LlList2ListStrided , adding the epoch time to the agent key, and if a set amount of time has passed, remove the agent key and epoch time from the list.

Depending on traffic passing by you could use the data server, http://wiki.secondlife.com/wiki/LlRequestAgentData, to check if an agent is online, and if not, remove the agents' key from the list.
Bjorn Collins
Will draw for food..
Join date: 2 Sep 2007
Posts: 18
12-13-2007 10:02
You could try using the xmlrpc (http://wiki.secondlife.com/wiki/Current_login_protocols), which is handling the login's of your avatars, for updates.

You can also use this area, for reference:

http://www.libsecondlife.org/wiki/Login#Client_XML-RPC_Request_.28Encapsulated_in_TLS_1.0.29

Good luck.
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
12-13-2007 13:17
If I am not mistaken, you could also have a list of avatars that the object has not preloaded the sound for. If the avatar is not on the list, preload the sound then have the object add the avatar to the list.
_____________________
-Smithy
Bjorn Collins
Will draw for food..
Join date: 2 Sep 2007
Posts: 18
12-13-2007 23:58
From: Smithy Zeno
If I am not mistaken, you could also have a list of avatars that the object has not preloaded the sound for. If the avatar is not on the list, preload the sound then have the object add the avatar to the list.


He has already made that :)

From: Waffle Projects
[...] so if the same avatar leaves and comes back, i don't need to reload those sounds again. fair enough, i just keep a running list of keys of avatars that i've already pre-loaded for and only do a preload if the sensed avatar is not on my list.