This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Timer Script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
r
retan
Voice
Posts: 5
Joined: Mon Jun 11, 2007 11:10 pm

Timer Script

Post by retan »

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!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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).
r
retan
Voice
Posts: 5
Joined: Mon Jun 11, 2007 11:10 pm

Post by retan »

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.
Post Reply