These forums are CLOSED. Please visit the new forums HERE
Multiple Timers! |
|
Rebecca Naidoo
Registered User
Join date: 28 May 2008
Posts: 82
|
07-18-2008 06:22
In LSL multiple timers, that are simply assigned to a variable and can be deleted.
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
07-19-2008 05:33
Hmm, you mean to have a timer() event with a parameter that lets you identify the particular event? It could be useful, but it's technically possible to do this yourself through LSL scripting, it'd mean using lists but it's do-able using something like:
CODE list events = []; Basically you just throw your event handling into the handEvent(integer) function. It can be tailored easily depending on your needs, as this version is intended for events which finish at a specific time (a unix timestamp). If you want events that execute in 30 seconds, then you could modify the script to accept a float value for time in the scheduleEvent(integer, integer) function instead, making sure to change setTimer() accordingly. _____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb) |
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
07-19-2008 07:00
Added a slightly more generalised version to the LSL wiki:
https://wiki.secondlife.com/wiki/Scheduler _____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb) |
Rebecca Naidoo
Registered User
Join date: 28 May 2008
Posts: 82
|
07-22-2008 16:40
No......
I mean give it multiple timers like all other languages have, So you could have like timer1:Timer = new timer(5); timer2:Timer = new timer(6); timer1(){ do whatever ever 5 seconds } timer2(){ do whatever ever 6 seconds } |
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
07-23-2008 05:05
I know what you mean, but LSL is an event driven language with a finite amount of space for events on its queue. What are your cases? There are possibly other solutions.
I've never encountered a case where I need multiple timers except the ones I'd use a scheduling system for, e.g; closing listens after a minute, freeing up control of an item to other users after two minutes, and so-on. _____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb) |
Rebecca Naidoo
Registered User
Join date: 28 May 2008
Posts: 82
|
07-23-2008 06:24
A lot of languages are event driven they work this way.
As long as you destroy the timers my assigning them to a blank value it would not require more system resources etc and in other language the way I'm proposing is the correct way. The code your using there is calling a lot more in built functions than mine would to do the same job. This is a feature request forum, not a scripting help forum. I know how to go a huge way round to achieve this and take up loads of code and resources, what I'm asking for is a as a feature request is to add the function ability that other languages have. |
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
07-24-2008 05:35
I understand that, and I'm not really opposed to it. But the thing is that there are two alternatives scheduling and using extra timer scripts, both of which are available now. The problem being that this makes the request fairly minor so I'm not sure it's likely LL will pay attention to it, the other issue being that the current timer() event is not well suited to it; I'm unsure LL are likely to implement a second timer type event to support multiple timers when you there are alternatives.
Unfortunately these are the kinds of hurdles that would be faced in trying to get such a feature implemented. My intention isn't to insult you, and I apologise if I did, but with readily available alternatives LL are unlikely to do this =( _____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb) |
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
08-23-2008 14:25
i'm sure it's already been done. i'm thinking about making a door that listens for password when touched. i would want the timer to remove the listen after so many seconds if nothing was said. but also the door itself would be on a timer to make it close if it was opened. i guess an easy solution would be to have 2 scripts? one that listens when touched, if the correct password is said it sends a link message to itself. and then in the second script it would receive the link message, open the door, and turn on the timer to close the door
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
08-24-2008 09:16
The scheduler script I linked to should suit your needs, you can of course edit as you require. Since you only really have two events then you may find it better also to take the ideas presented in the script and create a more specific implementation for your door.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb) |
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
08-24-2008 10:14
i have done multiple timers in one script.
one of many timers gets an integer or even a string as timestamp vvhen it shoud be triggered and set again. the main timer() checks a vvorld time such as unix time or llgettimestamp and if that is past one of the timers memorized timestamps that event gets triggered and reset to be triggeret --at east every n seconds-- its inaccurate but less effected by time dilation. a usefull sceduer |