| View previous topic :: View next topic |
| Author |
Message |
retan Voice
Joined: 11 Jun 2007 Posts: 5
|
Posted: Mon Jun 11, 2007 11:23 pm Post subject: Timer Script |
|
|
hello,
I've got three eggdrops and when I type !uptime, every eggdrop is posting his serveruptime since he was started.
It looks like this:
<Bot1> 12 days up
<Bot2> 13 days up
<Bot3> 14 days up
Now I need a script which shows me the total uptime of all servers. (it has to sum up 12,13 and 14)
So when I type !uptime, it has to come this:
<Bot1> 12 days up
<Bot2> 13 days up
<Bot3> 14 days up
<anotherBot> The total uptime of all servers: 39 days
How can I manage this?
What about a Timer?
My suggestion: When I type !uptime, the script should wait 5 seconds (until all three Bots posted there server uptime) and then the script sums up the total uptime. -> the problem is now how to read the specified strings. probably with reg expr?
Which tcl commands will I need or how has the code to look like?
Thank you all! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jun 12, 2007 5:27 am Post subject: |
|
|
The sum of the uptimes isn't the total uptime. Actually, in your case you can't calculate a total uptime, each is independent. You should either consider the lowest uptime as the total uptime or the highest uptime (I guess the latter is better). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
retan Voice
Joined: 11 Jun 2007 Posts: 5
|
Posted: Tue Jun 12, 2007 2:08 pm Post subject: |
|
|
I dont understand you.
Each eggdrop is running on another server, so the uptime of every eggdrop is different.
I just want all three uptimes summed up.
The script just has to search for the string "<Bot1>" and sum the letter after it (12) up with the other days (13 and 14).
The total uptime for me is: 39 days in my example.
So the method I thought about, is to make a timer, that the script wait for 5 secs after !uptime is typed. After the 5 seconds it searches the string between "<Bot1>" and "days up" (for all three bots). Then the script just has to sum the three uptimes up and puts it to the channel. |
|
| Back to top |
|
 |
|