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.

Can anyone convert this into TCL please?

Old posts that have not been replied to for several years.
Locked
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Can anyone convert this into TCL please?

Post by stevegarbz »

on *:JOIN:#PrecisionEffect:{
inc %join
notice $nick You are number %join to join $chan since January 1, 2005
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

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"
}
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Hmm.. doesn't work for some reason?

- Won't notice me.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

oops.. bind join, not bind pub
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Lemme test it out, 1 sec :)
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Awesome, thank you very much :D
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

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
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

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.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Making a channel string would work too

Code: Select all

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.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

MeTroiD wrote:Making a channel string would work too

Code: Select all

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.

This should help.

Code: Select all

## 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 :wink:
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
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

You forgot to global it though
Locked