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.

Script request! *[TICK 1177] Fri Feb 29 20:00:00 2008 - GMT*

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
r
ripz
Voice
Posts: 6
Joined: Sun Feb 17, 2008 1:00 pm

Script request! *[TICK 1177] Fri Feb 29 20:00:00 2008 - GMT*

Post by ripz »

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 :)
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

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: Select all

# 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.
r
ripz
Voice
Posts: 6
Joined: Sun Feb 17, 2008 1:00 pm

Post by ripz »

Thanks, strike :)
Last edited by ripz on Sat Mar 01, 2008 4:47 am, edited 1 time in total.
r
ripz
Voice
Posts: 6
Joined: Sun Feb 17, 2008 1:00 pm

Post by ripz »

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..
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

1. you'd need to write to file, so your starttick proc would become:

Code: Select all

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: Select all

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