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.

make bot blind for color codes and other codes

Help for those learning Tcl or writing their own scripts.
Post Reply
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

make bot blind for color codes and other codes

Post by simo »

we are using this small code on dalnet to make bot blind for color codes and other codes and it seems to give some errors while on other networks it works fine and i cant figure why

Code: Select all


catch {unbind raw - PRIVMSG *raw:irc:msg}
bind raw - PRIVMSG striprivmsg

proc striprivmsg {f k a} {
 set a [string map [list \017 ""] [stripcodes abcgru $a]]
  *raw:irc:msg $f $k $a
}


getting this error :
Tcl error [striprivmsg]: invalid command name "*raw:irc:msg"
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: make bot blind for color codes and other codes

Post by willyw »

simo wrote:... and it seems to give some errors while on other networks it works fine and i cant figure why
...
Addressing only the "why" part - not addressing how to fix it, right now :


I suspect that this experiment on different networks was also done with different bots - not testing the script on same bot by having bot log into each network.

For the heck of it, I tried this command in the partyline:

Code: Select all

.binds *raw:irc:m* all
Please try it, and see what you get. If you're using more than one bot, try it on each bot.

I tried it on two bots.

Here's what I got on one:
<myhandle> .binds *raw:irc:m* all
<botnick> [12:03:13] #myhandle# binds *raw:irc:m* all
<botnick> Command bindings:
<botnick> TYPE FLAGS COMMAND HITS BINDING (TCL)
<botnick> raw -|- PRIVMSG 80 *raw:irc:msg
<botnick> raw -|- MODE 18 *raw:irc:mode
The above was on bot:
<botnick> I am botnickhere, running eggdrop v1.8.3: 67 users (mem: 193k)
Next, I tried that command on another bot:
<myhandle> .binds *raw:irc:m* all
<botnick> [14:03:27] #myhandle# binds *raw:irc:m* all
<botnick> Command bindings:
<botnick> TYPE FLAGS COMMAND HITS BINDING (TCL)
<botnick> raw -|- MODE 3 *raw:irc:mode
This time, this bot is:
<botnick> I am botnickhere, running eggdrop v1.9.3: 1 user (mem: 263k).
So - it appears that command does not exist anymore, on new version of bot.

Please let us know if my guess is correct - that you are trying it on two different bots, and if so, what the version numbers of each bot is.

Assuming that we now know what is going on - that's the first step. :)
Now we need to figure out how to get you up and running again.
I'm sorry - I don't have the time at the moment to research it further. I'm posting this because it came to mind, and looks like it might be right, so far - and thus might help somebody else keep the ball rolling for you. Maybe I can get back to it later.

I hope this helped.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I guess you're using eggdrop 1.9.3 ?

Use rawt - PRIVMSG *rawt:irc:msg
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Thanks willyw and crazycat for your swift reply the bot version im running is 1.9.3
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tried your suggestion CrazyCat and gave me this error:
Tcl error [striprivmsg]: wrong # args: should be "striprivmsg f k a"
invalid command name "*raw:irc:msg"
your suggestion i didnt understand willyw i used that command in PL and it returned the bind
15:09:19 <Cappuccino> .binds *raw:irc:m* all
15:09:19 <HawkONE> [18:09:19] #ctcp# binds *raw:irc:m* all
15:09:19 <HawkONE> Command bindings:
15:09:19 <HawkONE> TYPE FLAGS COMMAND HITS BINDING (TCL)
15:09:19 <HawkONE> raw -|- MODE 27 *raw:irc:mode
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Read the manual !
RAWT (stackable)
bind rawt <flags> <keyword> <proc>
procname <from> <keyword> <text> <tag>
Your procedure must now integrate the tag argument. And send it to *rawt:irc:msg
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried it like this and still get errors:

Code: Select all

catch {unbind rawt - PRIVMSG *rawt:irc:msg}
bind rawt - PRIVMSG striprivmsg

 proc striprivmsg {f k a} {
      set a [string map [list \017 ""] [stripcodes abcgru $a]]
	*rawt:irc:msg $f $k $a
}
errors:
Tcl error [striprivmsg]: wrong # args: should be "striprivmsg f k a"
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

now i tried it like this :

Code: Select all

catch {unbind rawt - PRIVMSG *rawt:irc:msg}
bind rawt - PRIVMSG striprivmsg

 proc striprivmsg {f k text tag} {
     set a [string map [list \017 ""] [stripcodes abcgru $text]]
	*rawt:irc:msg $f $k $text $tag
}
no errors but not sure if its proper
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Why don't you read all the words in my post ?

Code: Select all

 proc striprivmsg {f k a t} {
      set a [string map [list \017 ""] [stripcodes abcgru $a]]
   *rawt:irc:msg $f $k $a $t
}
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Yea sorry about that i overlooked but got it error free
Not sure if it actually works properly

il test it some more thanks crazycat, willyw
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

First, try to solve your troubles before posting, post only when you have tried different things.

Second, there are 2 binds, so this is what you have to do:

Code: Select all

unbind rawt - PRIVMSG *rawt:irc:msg
unbind rawt - PRIVMSG *rawt:PRIVMSG
bind rawt - PRIVMSG striprivmsg
proc striprivmsg {from key text tag} {
  set text [stripcodes * $text]
  *rawt:irc:msg $from $key $text $tag
  *rawt:PRIVMSG $from $key $text $tag
}
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks CrazyCat
Post Reply