set count 0
bind pub - "#PrecisionEffect %" foo
proc foo {n u h c} {
incr ::count
puthelp "notice $n :You are number $::count to join $c since January 1, 2005"
}
That small script will work fine but it wont remember the number it got to if you rehash the bot it will start back at 1.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Ofcourse it will reset the count if you rehash/restart. If you do not want it to reset you can use another bind evnt on prerehash and restart allowing not to reset the counter or transferring it to a dummy var, and after rehash/restart transfer it back to your count var.
The easiest and most efficient one would be to write it to a file, which would never get reset, and read it from there always.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
setudef str count
set count [channel get #precisioneffect count]
bind join - "#PrecisionEffect %" foo
proc foo {n u h c} {
incr ::count
puthelp "notice $n :You are number $::count to join $c since January 1, 2005"
channel set #precisioneffect count $count
}
Last edited by metroid on Thu Dec 30, 2004 5:40 am, edited 1 time in total.
setudef str count
set count [channel get #precisioneffect count]
bind pub - "#PrecisionEffect %" foo
proc foo {n u h c} {
incr ::count
puthelp "notice $n :You are number $::count to join $c since January 1, 2005"
channel set #precisioneffect count $count
}
That would work too if you changed the pub to join but again if you happen to remove the bot from the chan by accident you would lose this count. Awyeahs suggestion is the wisest move in my opinion.
## Set the filename here
set gJoinFile "JoinLog.log"
bind join - "#PrecisionEffect %" foo
proc foo {nick uhost hand chan} {
global gJoinFile
## Open file and read the variable
if { [file exists $gJoinFile] == 1 } {
set FileHandle [open $gJoinFile "r"]
set TempString [read $FileHandle]
close $FileHandle
set lines [split $TempString "\n"]
set gJoinCounter [lindex $lines 0]
} else {
# Set the JoinCounter to 0 initially
set gJoinCounter 0
}
puthelp "notice $nick :You are number $gJoinCounter to join $chan since January 1, 2005"
incr gJoinCounter 1
## Write the variable to file (remember opening with 'w' mode truncates the file contents)
set FileHandle [open $gJoinFile "w"]
puts $FileHandle $gJoinCounter
close $FileHandle
return
}
cheers
// Edit Ooops Thanks Metroid
Last edited by ^DooM^ on Thu Dec 30, 2004 5:39 am, edited 1 time in total.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born