| View previous topic :: View next topic |
| Author |
Message |
ripz Voice
Joined: 17 Feb 2008 Posts: 6
|
Posted: Fri Feb 29, 2008 9:23 am Post subject: Script request! *[TICK 1177] Fri Feb 29 20:00:00 2008 - GMT* |
|
|
Hey,
Im looking for a script that does this:
(or someone that have the knowledge to make it)
[13:06] <Nick> !tick 1177
[13:06] <@nick> [TICK 1177] Fri Feb 29 20:00:00 2008 - GMT
[13:06] <Nick> !tick 1178
[13:06] <@nick> [TICK 1178] Fri Feb 29 21:00:00 2008 - GMT
I dont really know how to explain this easy enough. (This is for a bot i have that i use for an online game planetarion)
The game always starts at tick 1 at a specific date and time.. So need to be able to put that into the bot..
(1 tick is 1 hour)
So if they game starts Tue March 15 20:00:00 2008 - GMT
i want it to understand that next tick will be one hour later (21:00:00 GMT)
Or if i wanna check what date/time tick 100 is too
And so on untill that round is over.
If i explained this unclear.. let me know
And thanks if there is someone out there that is able to help me with this.. Would be really awesome..
I have a feeling that this is a huge script so i dont really think anyone wanna do this.. but ill post it anyway  |
|
| Back to top |
|
 |
strikelight Owner

Joined: 07 Oct 2002 Posts: 708
|
Posted: Fri Feb 29, 2008 7:30 pm Post subject: |
|
|
I'm not really sure of the practicality of this or the full implementation, but here's an example of what you would want, from what I gather:
| Code: |
# initiate the start time
bind pub - !starttick tick:start
proc tick:start {nick uhost hand chan text} {
global tick
set tick(start) [clock seconds]
puthelp "PRIVMSG $chan :Started tick count at [clock format $tick(start)]"
}
bind pub - !tick tick:display
proc tick:display {nick uhost hand chan text} {
global tick
#incase !starttick wasn't used to (re)initiate the 'ticking'
if {![info exists tick(start)]} { set tick(start) [clock seconds] }
set ticks [lindex [split $text] 0]
#if <ticks> argument wasn't specified, set default value
if {![string length $ticks]} { set ticks 0 }
#tick calculations (60 seconds in a minute, 60 minutes in an hour)
set ticktime [expr {$tick(start) + (60 * 60 * $ticks)}]
#display to user
puthelp "PRIVMSG $chan :\[TICK $ticks\] [clock format $ticktime]"
}
|
Untested code... You should be able to manipulate the above code to your liking. |
|
| Back to top |
|
 |
ripz Voice
Joined: 17 Feb 2008 Posts: 6
|
Posted: Sat Mar 01, 2008 4:11 am Post subject: |
|
|
Thanks, strike 
Last edited by ripz on Sat Mar 01, 2008 4:47 am; edited 1 time in total |
|
| Back to top |
|
 |
ripz Voice
Joined: 17 Feb 2008 Posts: 6
|
Posted: Sat Mar 01, 2008 4:34 am Post subject: |
|
|
I have tried to make some changes.. but it never works :p
1. I want to make the bot remember the starttick even if it restarts or loose connection.
2. Make it so it understand GMT (the game is GMT 0). It only shows CET
3. Make the !starttick and owner command.
Looks like its over my knowledge.. |
|
| Back to top |
|
 |
strikelight Owner

Joined: 07 Oct 2002 Posts: 708
|
Posted: Sat Mar 01, 2008 1:55 pm Post subject: |
|
|
1. you'd need to write to file, so your starttick proc would become:
| Code: |
proc tick:start {nick uhost hand chan text} {
global tick
set tick(start) [clock seconds]
puthelp "PRIVMSG $chan :Started tick count at [clock format $tick(start)]"
set outfile [open "tickstart.txt" w]
puts $outfile $tick(start)
close $outfile
}
|
and at the end of the script, something like:
| Code: |
if {![info exists tick(start)]} {
if {![file exists "tickstart.txt"]} {
set tick(start) [clock seconds] ;# set default value if file doesn't exist
} else {
set infile [open "tickstart.txt" r]
gets $infile tick(start)
close $infile
unset infile
}
}
|
2. Look for all [clock format .... commands, and simply add " -gmt 1" before the "]"
3. Change the "bind pub - !starttick tick:start" line to "bind pub n !starttick tick:start"
Enjoy. |
|
| Back to top |
|
 |
|