| View previous topic :: View next topic |
| Author |
Message |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Jan 28, 2006 6:28 pm Post subject: Bot should read and repeat something |
|
|
Hello!
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? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Jan 28, 2006 7:13 pm Post subject: |
|
|
| Code: | bind pub - wtf ownt
proc ownt {n u h c a} {
puthelp "privmsg $c :$n got ownt"
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Jan 28, 2006 7:29 pm Post subject: |
|
|
| Quote: | (@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".
| Quote: | (@darton) wtf
(%Bot) darton got ownt. |
Here your script works. But it should work in the first case.
It must look like this:
| Code: | 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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Jan 28, 2006 9:13 pm Post subject: |
|
|
| Code: | 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"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Jan 29, 2006 8:11 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Jan 29, 2006 9:46 am Post subject: |
|
|
With Sir_Fz's Script it looks like this:
| Quote: | (@BRenBot) darton: wtf
(%Bot) darton got ownt. |
But it should look like this:
| Quote: | (@BRenBot) darton: wtf
(%Bot) darton got ownt. |
What do I have to change? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 29, 2006 10:34 am Post subject: |
|
|
Read Tcl-commands.doc about the [stripcodes] command. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Jan 29, 2006 11:08 am Post subject: |
|
|
I changed it to this and its working now
| Code: | 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."
}
} |
|
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Jan 29, 2006 7:08 pm Post subject: |
|
|
But now I want that the bot only reacts when the BRenBot write "wtf".
| Quote: | (@BRenBot) darton: wtf
(%Bot) darton got ownt. |
| Quote: | (@Darton) darton: wtf
(%Bot) darton got ownt. |
Here the bot shouldn't react.
Why does this script not work?
| Code: | 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."
}
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sun Jan 29, 2006 7:29 pm Post subject: |
|
|
| Argh, sure. Now its working. Thanks a lot. |
|
| Back to top |
|
 |
|