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.

need help in this script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

need help in this script

Post by mrdr »

Code: Select all

set birthday(file) "birth.txt"
 
if {[file exists $birthday(file)]} { 
  set birthday(data) [split [read [set inf [open $birthday(file) r]]] \n][close $inf] 
  unset inf 
} else { 
  set birthday(data) [list] 
} 
 
bind pub - !birth pub:birthdays 
proc pub:birthdays {nick uhost hand chan text} { 
  global birthday 
  set day [lindex [split $text] 0] 
  set line [list] 
  foreach i [lsearch -regexp $birthday(data) "$day *"] { 
    lappend line [join [lrange [split [lindex $birthday(data) $i]] 1 end]] 
  } 
  set line [join $line] 
  putserv "PRIVMSG $chan :$day $line" 
}
I got this script, I think you know what it does.
How to make that when I enter !birth bot notice how to use it.
ex.
(@me) !birth
Notice -- (bot) -- Usage: !birth month.day

:)
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

After

Code: Select all

set day [lindex [split $text] 0]
add

Code: Select all

if {$day == ""} {
 puthelp "NOTICE $nick :Usage: !birth month.day"
 return 0
}
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

Post by mrdr »

Thank you, Sir_Fz. :)
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Post Reply