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.

Counter and Notice tcl

Old posts that have not been replied to for several years.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Counter and Notice tcl

Post by neokenzo »

I would like my bot to greet everyone that comes in to my channel like so:

(..notice..) KinKs: Welcome Neokenzo you're visitor 227748 since Nov 1999. Please ask your question in channel (no need to ask if you can ask:) and someone will help as soon as they can. To view available help topics, type !help.

I think that is a personalised tcl. I dont actually need the !help. I would like the Welcome $name, counter since a set date and notice that I can edit. Anyone knows of such tcl or can help me code one?

Thanks in advance.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set joins "joins.dat"
set date "April 10 2003"

bind join - "*" the:counting

proc the:counting {nick uhost handle chan} {
if {$nick == $::botnick} { return }

if {![file exists $::joins]} {
putlog "$::joins file dosen't exist, creating file.."
set file [open $::joins w]
puts $file "0"
catch {close $file}
}

set file [open $::joins r] 
set tilnow "[gets $file]"
catch {close $file}

set file [open $::joins w] 
puts $file "[expr $tilnow + 1]"
set tilnow [expr $tilnow + 1]
catch {close $file}

putserv "NOTICE $nick :You are person number \002$tilnow\002 to join $chan since $::date. Please ask your question in channel (no need to ask if you can ask:) and someone will help as soon as they can. To view available help topics, type !help."
}
Once the game is over, the king and the pawn go back in the same box.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

Thanks for the code. I made a minor change because I want it to notice just one channel. Anyway, when I load the bot, it says this:

Tcl error [the:counting]: syntax error in expression "!file[file exists $::joins]"

Anyway, here is the slight change of code I did, could you see what I did wrong?

Code: Select all

set joins "joins.dat"
set date "11 April 2003"
set chan "#testchannel"

bind join - "*" the:counting

proc the:counting {nick uhost handle chan} {
if {$nick == $::botnick} {return}

if {!file[file exists $::joins]} {
putlog "$::joins file doesnt exists, creating file..."
set file [open $::joins w]
puts $file "0"
catch {close $file}
}

set file [open $::joins r]
set tilnow "[gets $file]"
catch {close $file}

set file [open $::joins w]
puts $file "[expr $tilnow + 1]"
set tilnow [expr $tilnow + 1]
catch {close $file}

putserv "NOTICE :12Welcome $nick to #testchannel, you're visitor number \002$tilnow\002 to join $::chan since $::date. Please be aware that #testchannel is NOT a place for any form of swearing/cursing/profanity, personal attacks/flames, harassments or threats. Thank you and do enjoy your stay :)"
}
Any suggestions?

Thanks in advance.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

replace from:

Code: Select all

if {!file[file exists $::joins]} { 
to this:

Code: Select all

if {![file exists $::joins]} {
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also, I've noticed that your minor change won't do what you want to do, so replace from:

Code: Select all

if {$nick == $::botnick} {return} 
to this:

Code: Select all

if {$nick == $::botnick || $chan != $::counting } { return } 
also, from the:

Code: Select all

set chan "#testchannel"
to this:

Code: Select all

set counting "#testchannel"
In that notice thing don't put "#testchannel" put instead "$chan" cos will say the channel he is only running wich is in fact #testchannnel.
Also, for bold use \002something with bold\002 and for colours use \003colour some text\003 (eg. \0034bla\003 will say bla with a red colour).
Once the game is over, the king and the pawn go back in the same box.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

I have made all the changes that you have listed and rehashed my bot. When anyone joins the channel, this message appears in the bot:

Tcl error [the:counting]: can't read "chan": no such variable

I tried changing that particular coding but with no avail. Here is the my updated code at the moment:

Code: Select all

set joins "joins.dat"
set date "11 April 2003"
set counting "#testchannel"

bind join - "*" the:counting

proc the:counting {nick uhost handle chan} {
if {$nick == $::botnick || $chan != $::counting } {return}

if {![file exists $::joins]} {
putlog "$::joins file doesnt exists, creating file..."
set file [open $::joins w]
puts $file "0"
catch {close $file}
}

set file [open $::joins r]
set tilnow "[gets $file]"
catch {close $file}

set file [open $::joins w]
puts $file "[expr $tilnow + 1]"
set tilnow [expr $tilnow + 1]
catch {close $file}

putserv "NOTICE :12Welcome \003$nick\003 to $chan, you're visitor number \002$tilnow\002 to join $chan since $::date. 3Please be aware that $chan is NOT a place for any form of swearing/cursing/profanity, personal attacks/flames, harassments or threats. Thank you and do enjoy your stay :)"
}

putlog "Join Counter Notice loaded!"
##### EOF #####
I assume the 'set counting "#testchannel"' that I cant put a capital T right? And its trying to send notice to all the channels that the bot is in because whenever somebody joins other channels, the error message comes out. How can I make it to notice just this 1 channel?

I really appreciate your help but unfortunately I still need more to solve this problem.

Many thanks.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

This seems to be working fine, except with a few things that can be changed. Replace from:

Code: Select all

if {$nick == $::botnick || $chan != $::counting } {return} 
to this:

Code: Select all

if {[string tolower $nick] == [string tolower $::botnick] || [string tolower $chan] != [string tolower $::counting] } { return } 
Also, you've missed the $nick in the notice msg, replace from:

Code: Select all

putserv "NOTICE :12Welcome \003$nick\003 to $chan, you're visitor number \002$tilnow\002 to join $chan since $::date. 3Please be aware that $chan is NOT a place for any form of swearing/cursing/profanity, personal attacks/flames, harassments or threats. Thank you and do enjoy your stay :)" 
to this:

Code: Select all

putserv "NOTICE $nick :12Welcome \003$nick\003 to $chan, you're visitor number \002$tilnow\002 to join $chan since $::date. 3Please be aware that $chan is NOT a place for any form of swearing/cursing/profanity, personal attacks/flames, harassments or threats. Thank you and do enjoy your stay :)" 
and should be working fine like it dose at me.. Oh, and now you can put how many capital letters you want..
Once the game is over, the king and the pawn go back in the same box.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

I did the changes. Still having problems. Its still trying to notice all the channels instead of just the one. Now wehenever someone comes in to any of the channel its in, this message come out in the bot's partyline:

Tcl error [the:counting]: called "the:counting" with too many arguments

Here is my updated code:

Code: Select all

set joins "joins.dat"
set date "11 April 2003"
set counting "#Testchannel"

bind join - "*" the:counting

proc the:counting {nick uhost handle chan} {
if {[string tolower $nick] == [string tolower $::botnick] || [string tolower $chan] != [string tolower $::counting] } { return }

if {![file exists $::joins]} {
putlog "$::joins file doesnt exists, creating file..."
set file [open $::joins w]
puts $file "0"
catch {close $file}
}

set file [open $::joins r]
set tilnow "[gets $file]"
catch {close $file}

set file [open $::joins w]
puts $file "[expr $tilnow + 1]"
set tilnow [expr $tilnow + 1]
catch {close $file}

putserv "NOTICE $nick :12Welcome \003$nick\003 to $chan, you're visitor number \002$tilnow\002 to join $::chan since $::date. 3Please be aware that $chan is NOT a place for any form of swearing/cursing/profanity, personal attacks/flames, harassments or threats. Thank you and do enjoy your stay :)"
}

putlog "Join Counter Notice 1.0 by loaded!"
##### EOF #####
My is running eggdrop version 1.6.13 on Linux 2.4.19-grsec if its anyhelp to you. Thanks again for you help dude.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The code is correct, is working fine at me. Stupid question: after you've made the changes have you .rehash'ed your eggdrop?
Once the game is over, the king and the pawn go back in the same box.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

I did rehashed, as you can see, the bot error message changed from before. I myself dont know why its doing that as well. Any more suggestions?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You must have a bind somwhere, that is calling the:counting for another event, other than just the join bind.

I sugest using ".restart" to iliminate past failures, and checking toher scripts you ahve loaded for name clashing.
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

I have rehashed and restart the bot. Still having the same problems. I'm a newbie when it comes to coding, so I'm not quite sure whats wrong with it. Can anyone check the code I've included and give me suggestions how to rectify this problem?

Thanks in advance.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

try changing the name of the proc

Code: Select all

bind join - "*" the:counting

proc the:counting {nick uhost handle chan} { 
Elen sila lúmenn' omentielvo
n
neokenzo
Voice
Posts: 14
Joined: Tue Apr 01, 2003 6:46 pm

Post by neokenzo »

Tried that. Still the same. Still says to many arguements. What does that mean how to fix it?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Type and paste the result of an: .bind join
Once the game is over, the king and the pawn go back in the same box.
Locked