Timer and HUD question
|
|
Emma Soyinka
Got moo? o_o
Join date: 13 Sep 2005
Posts: 218
|
12-14-2005 19:53
Just out of curiosity and a newfangled - though potentially shortlived - interest in SL because of these shiny new HUD attachments I have two questions:
1. I assume that it's out of the question, no way in hell to keep a non rezzed/non attached item running a timer? As in, when it's in someone's inventory. All I could find on the wiki is that the state is saved, but that doesn't help much.
2. Since there are fixed positions where you attach things to the HUD, I assume if you attach something where another thing was already attached, the other thing is plunked back into the inventory?
Actually, I also assume timers die on attachments as soon as the person wearing them logs off?
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
12-14-2005 21:03
Timers don't necessarily die... when you put a scripted object into inventory, the script is basically freeze-dried - if the script was a VCR, the simulator hits its pause button. Once the scripted object is rerezzed, the simulator presses the "play" button, letting it continue where it left off.
If you wanted your object to know how long its been in inventory, every so often record the value from llGetTimestamp. Running it through a timestamp->integer function (on the wiki), you can subtract the value you last stored from the value you get in the on_rez event. Are you trying to create some kind of "rentable" object? ==Chris
|
|
Emma Soyinka
Got moo? o_o
Join date: 13 Sep 2005
Posts: 218
|
12-14-2005 21:27
Actually I'm trying to create an object that is "always on" unless explicitly put into sleep mode by the user. But I suppose it automatically going into sleep mode while the user is logged off or while the object is in inventory would be acceptable.
|
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
12-14-2005 22:22
From: Emma Soyinka Actually I'm trying to create an object that is "always on" unless explicitly put into sleep mode by the user. But I suppose it automatically going into sleep mode while the user is logged off or while the object is in inventory would be acceptable. WTH would require a that kind timer functionality, if you don't mind my asking?
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
12-14-2005 23:22
Timers don't turn off, even in attachments, when you log off as far as I know. They certainly don't automatically return to your inventory. That said what they do if attached is moot - because they're not there either.
|
|
Emma Soyinka
Got moo? o_o
Join date: 13 Sep 2005
Posts: 218
|
12-15-2005 08:10
That's kind of confusing, that timers don't turn off when the attached PC logs off? X_x Hrm I really wish there was better documentation on this, it's kind of arcane.
As for what needs it, something that autonomously needs to keep increasing its state regardless of user input. But right now I'm figuring it'll just autosleep in inventory (like it would, apparantly) and if there is a way to trap if the attached PC goes or is offline to autosleep as well. Any tips for that list bit would be appreciated.
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
12-15-2005 12:41
From: Emma Soyinka Actually I'm trying to create an object that is "always on" unless explicitly put into sleep mode by the user. Then it has to be always rezzed into the world as an independent object.
|
|
Ghordon Farina
Script Poet
Join date: 1 Nov 2005
Posts: 126
|
12-15-2005 20:16
From: Emma Soyinka That's kind of confusing, that timers don't turn off when the attached PC logs off? X_x Hrm I really wish there was better documentation on this, it's kind of arcane.
As for what needs it, something that autonomously needs to keep increasing its state regardless of user input. But right now I'm figuring it'll just autosleep in inventory (like it would, apparantly) and if there is a way to trap if the attached PC goes or is offline to autosleep as well. Any tips for that list bit would be appreciated. What this means is: you can rez an object in world, and whether you're online or not, it won't stop running. However, if you attatch something to your body, or your HUD, the timer WILL stop when you log off or unattatch. In the case of autosleeping when the owner goes offline, this will happen automatically ONLY if you are wearing it or attatched to HUD. If you want it to autosleep even when it's rezzed in-world, you'll want it to check your online status. When you're offline, it should detect that and sleep. (This can probably be done via a timer event.) So, if you're making an attatchment or a prim to check how often / how long you're online in SL, you'd want it to either 1. be attatched and have a timer, or 2. be rezzed in world and log the time you log in and the time you log out, then subtract the first from the second to see how long you were in.
|