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.

on join help!

Help for those learning Tcl or writing their own scripts.
Post Reply
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

on join help!

Post by mindflow »

I havent been working in TCL for a long time now, and i need 1 channel to be excluded from the "join" event, this is how it looks like now.

Code: Select all

bind join * * msg_jmsg1

proc msg_jmsg1 {nick uhost hand channel args} {
	global botnick
    putserv "NOTICE $nick : Hi $nick, I'm $botnick. Rest of my message here. :)" 
    return 1
}
how would i make this see if the channel the person join is the excluded channel, the bot are on 6 channels i want it to send the notice on join, then 1 i dont want it to send the notice too.. someone that can help me with this?[/code]
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

Post by mindflow »

uhum, thats a link to other peoples TCL, all i need is a if statement, if {chan == #channel} do nothing

dont remember how to write it right tho..
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Code: Select all

set excludedchans "#channelname #chan2 #whatever"

proc msg_jmsg1 {nick uhost hand channel args} {
    global botnick
     if {[lsearch -exact $::excludedchans $channel] == -1}
          putserv "NOTICE $nick : Hi $nick, I'm $botnick. Rest of msg"
     } else {
          return
     }
}
BTW "args" is a special case in tcl, in case you run into problems using it.
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

Post by mindflow »

rosc2112 wrote:

Code: Select all

set excludedchans "#channelname #chan2 #whatever"

proc msg_jmsg1 {nick uhost hand channel args} {
    global botnick
     if {[lsearch -exact $::excludedchans $channel] == -1}
          putserv "NOTICE $nick : Hi $nick, I'm $botnick. Rest of msg"
     } else {
          return
     }
}
BTW "args" is a special case in tcl, in case you run into problems using it.
Thnx for the help, the code didnt work as it should tho.. any other idea? :?

* EDIT *

Forgot to say, the bot dies when i rehach it:
(03:45) « bot » (file "scripts/fun.tcl" line 710)
(03:45) « bot » invoked from within
(03:45) « bot » "source scripts/fun.tcl"
(03:45) « bot » (file "bot.conf" line 1220)
(03:45) « bot » [05:44] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

Line 710 in the tcl:

proc msg_jmsg1 {nick uhost hand channel} {
tryed to edit it a bit, but still same result.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

* off topic *
mindflow stop checking the 'Disable BBCode in this post' if you use BBCode in your replyes.

* on topic *
if {[lsearch -exact $::excludedchans $channel] == -1}
is missing a "{"

Code: Select all

if {[lsearch -exact $::excludedchans $channel] == -1} {
Also, if the channel name will be #foo and in the 'excludedchans' you have #FOO or something different than #foo then it will send the message. I would go for 'setudef'.
Once the game is over, the king and the pawn go back in the same box.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

I thought lsearch was case-sensitive when using the -exact switch? Hmm, just looked at the lsearch manpage, guess you'd have to use -exact -ascii for it to be case-sensitive.

And about crashing the bot, sorry! <grin>

Read this post and you'll never have a bot crash from loading scripts:

http://forum.egghelp.org/viewtopic.php?p=63899#63899
m
mindflow
Voice
Posts: 22
Joined: Thu Mar 10, 2005 11:14 am

Post by mindflow »

caesar wrote:* off topic *
mindflow stop checking the 'Disable BBCode in this post' if you use BBCode in your replyes.

* on topic *
if {[lsearch -exact $::excludedchans $channel] == -1}
is missing a "{"

Code: Select all

if {[lsearch -exact $::excludedchans $channel] == -1} {
Also, if the channel name will be #foo and in the 'excludedchans' you have #FOO or something different than #foo then it will send the message. I would go for 'setudef'.
Ok. the TCL working now, but i got a strange behavior from the bot, after added that line i got a huge "lag" or "delay" when the bot auto op me, i know auto op is a bad this to use, but since the channels are protected by channel service i use it any way ;)

Problem:
befor that line i got auto oped 2 sec after i joined, now it takes up to 1 minute befor i got my @, the bot are on 4 channels with maybe 100 users total, so that shouldent be any problem, anyone that have a suggestion about this? and i have a of topic question too, to change the eggdrop version reply i need to add 1 line in the eggdrop.con file, i forgot what line that is. someone that know what i mean?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

If it's under heavy join/parts then it gets lagged thus leading to the delay in oping. If you really need this implement a *delay* function else remove it.
Once the game is over, the king and the pawn go back in the same box.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I'd also recommend using puthelp as it uses a different queue with a lower priority
NML_375
Post Reply