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.

script to send notice that @nickname trigger don't work

Old posts that have not been replied to for several years.
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

Post by Bytez »

Strikelight, I changed my code to:

bind pub - @$bot reply:share

proc reply:share {nick uhost hand chan arg} {
puthelp "NOTICE $nick :I'm a robot, NOT sharing files!"
}

and got this error:

can't read "bot": no such variable
while executing
"bind pub - @$bot reply:share "
(file "scripts/notrigger.tcl" line 1)
invoked from within
"source scripts/notrigger.tcl"
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

He said $nick not $bot silly :P
Once the game is over, the king and the pawn go back in the same box.
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

Post by Bytez »

:oops: :x
d
dun_dacil
Voice
Posts: 16
Joined: Wed Sep 04, 2002 3:36 pm
Location: Pisa, Italy

Post by dun_dacil »

Another alternative to the @$nick binding suggested by strikelight could be to bind the pub bind to an evnt init-server: something like:

bind evnt - init-server init_the_proc

proc init_the_proc {type} {
global botnick
bind pub - @$botnick ....
}

The slight advantage of this is that the bind is in operation only after the bot is on the IRC server, and $botnick holds the actual bot nickname (which, incidentally, may not coincide with $nick). I'd suggest also to check for bot's nick changes, and change the bind as appropriate.

dun
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Or, instead of doing all that work, have a bind to match all public text against the desired trigger (@), and check for the appropriate botnick from within that proc itself, if you want/need to handle all those cases.

ie.

Code: Select all

bind pubm - "#% @*" mybind
proc mybind {nick uhost hand chan text} {
  global botnick
  set who [string tolower [lindex [split $text] 0]]
  if {@[string tolower $botnick] != $who} { return }
  puthelp "NOTICE $nick :I am not serving right now"
}
(Heh, that bind looks like censored cursing)
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

Post by Bytez »

strikelight wrote:One possibility is that you entered the code wrong initially, changed it, rehashed (instead of restarting), thus leaving the original incorrect bind in tact and still usable...

Another possibility is that you loaded the bot from scratch and when doing so, the bot has not yet connected to irc, and botnick may be "" (empty), thus meaning that the bind would just be "@".... If this is the problem, then a better bind would be bind pub - @$nick <proc> instead.
all bots still reply to just @ after I did a rehash :roll: .. I'll try the alternative codes later today. I appreciate all the input.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Bytez wrote:
strikelight wrote:One possibility is that you entered the code wrong initially, changed it, rehashed (instead of restarting), thus leaving the original incorrect bind in tact and still usable...

Another possibility is that you loaded the bot from scratch and when doing so, the bot has not yet connected to irc, and botnick may be "" (empty), thus meaning that the bind would just be "@".... If this is the problem, then a better bind would be bind pub - @$nick <proc> instead.
all bots still reply to just @ after I did a rehash :roll: .. I'll try the alternative codes later today. I appreciate all the input.
That's exactly what I was saying... you should NOT use .rehash...
you should have used .restart.
Locked