egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bot should read and repeat something

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sat Jan 28, 2006 6:28 pm    Post subject: Bot should read and repeat something Reply with quote

Hello!
Quote:
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?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Jan 28, 2006 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sat Jan 28, 2006 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Jan 28, 2006 9:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sun Jan 29, 2006 8:11 am    Post subject: Reply with quote

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
View user's profile Send private message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sun Jan 29, 2006 9:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jan 29, 2006 10:34 am    Post subject: Reply with quote

Read Tcl-commands.doc about the [stripcodes] command.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sun Jan 29, 2006 11:08 am    Post subject: Reply with quote

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
View user's profile Send private message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sun Jan 29, 2006 7:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jan 29, 2006 7:13 pm    Post subject: Reply with quote

You need to match on $n instead of $nick.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sun Jan 29, 2006 7:29 pm    Post subject: Reply with quote

Argh, sure. Now its working. Thanks a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber