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.

Bot should read and repeat something

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Bot should read and repeat something

Post by darton »

Hello!
BreakFstO: WTF
When this appears in mIRC my bot should answer for example: "BreakFstO got ownt." But the name isnt always the same. So my bot must read every name before a colon and repeat the same name in its answer. Is that possible?
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub - wtf ownt

proc ownt {n u h c a} {
 puthelp "privmsg $c :$n got ownt"
}
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

(@BRenBot) darton: wtf
(%Bot) darton got ownt.
Thats the way the channel displays the users. And with your script the bot wouldnt say "darton got ownt".
(@darton) wtf
(%Bot) darton got ownt.
Here your script works. But it should work in the first case.
It must look like this:

Code: Select all

bind pubm - *$read: wtf" wtf
proc wtf {nick host hand chan rest} {
  puthelp "privmsg $chan :$read got ownt."
}
But the $read is wrong. I look for a command that makes the bot look what is written before a colon and repeat it.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pubm - * ownt

proc ownt {n u h c a} {
 set nick [lindex [split $a] 0]
 set word [lindex [split $a] 1]
 if {[string equal -nocase wtf $word]} {
  puthelp "privmsg $c :[string trimright $nick :] got ownt"
 }
}
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

Hey its really working. But there is a problem. As my channel is connected with a game and I want that the message will be displayed in the game too I must change the script to: "!msg [string trimright $nick :] got ownt". The message is also displayed in game but it is displayed as: "[]08[]Darton[][] got ownt.
I think the bot transfer my nick with the formatting because the players are displayed in channel in yellow or in red colour.
So is it possible to change the script so that the bot doesn't transfer the formatting?
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

With Sir_Fz's Script it looks like this:
(@BRenBot) darton: wtf
(%Bot) darton got ownt.
But it should look like this:
(@BRenBot) darton: wtf
(%Bot) darton got ownt.
What do I have to change?
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Read Tcl-commands.doc about the [stripcodes] command.
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

I changed it to this and its working now

Code: Select all

bind pubm - * ownt

proc ownt {n u h c a} {
 set nick [lindex [split $a] 0]
 set word [lindex [split $a] 1]
 set nick [stripcodes bcruag $nick]
 if {[string equal -nocase wtf $word]} {
  puthelp "privmsg $c :!msg [string trimright $nick :] got ownt."
 }
}
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

But now I want that the bot only reacts when the BRenBot write "wtf".
(@BRenBot) darton: wtf
(%Bot) darton got ownt.
(@Darton) darton: wtf
(%Bot) darton got ownt.
Here the bot shouldn't react.
Why does this script not work?

Code: Select all

bind pubm - * ownt

proc ownt {n u h c a} {
 set nick [lindex [split $a] 0]
 set word [lindex [split $a] 1]
 set nick [stripcodes bcruag $nick]
 if {[string equal -nocase "BRenBot" $nick]} {
 if {[string equal -nocase wtf $word]} {
  puthelp "privmsg $c :!msg [string trimright $nick :] got ownt."
 }
 }
}
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You need to match on $n instead of $nick.
d
darton
Op
Posts: 155
Joined: Sat Jan 21, 2006 11:03 am

Post by darton »

Argh, sure. Now its working. Thanks a lot.
Post Reply