egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ripz
Voice


Joined: 17 Feb 2008
Posts: 6

PostPosted: Fri Feb 29, 2008 9:23 am    Post subject: Script request! *[TICK 1177] Fri Feb 29 20:00:00 2008 - GMT* Reply with quote

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 Smile

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 Smile
Back to top
View user's profile Send private message
strikelight
Owner


Joined: 07 Oct 2002
Posts: 708

PostPosted: Fri Feb 29, 2008 7:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ripz
Voice


Joined: 17 Feb 2008
Posts: 6

PostPosted: Sat Mar 01, 2008 4:11 am    Post subject: Reply with quote

Thanks, strike Smile

Last edited by ripz on Sat Mar 01, 2008 4:47 am; edited 1 time in total
Back to top
View user's profile Send private message
ripz
Voice


Joined: 17 Feb 2008
Posts: 6

PostPosted: Sat Mar 01, 2008 4:34 am    Post subject: Reply with quote

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
View user's profile Send private message
strikelight
Owner


Joined: 07 Oct 2002
Posts: 708

PostPosted: Sat Mar 01, 2008 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber