| View previous topic :: View next topic |
| Author |
Message |
Redento Voice
Joined: 13 Jun 2007 Posts: 3
|
Posted: Wed Jun 13, 2007 9:03 am Post subject: MSG in a chan, MSG -> other chan |
|
|
Hi all
I've been learning TCL for a few times, but not as much as i can complete my first little tcl of my own.
Aim is simple: when a *text* is typed in a chan, eggdrop has to report it, as it is, in another chan.
What i did so far is this:
| Code: |
bind pub - * procedura
proc procedura {nick host handle chan text} {
set comando [lindex [split $text " "] 0]
set comando2 [lindex [split $text " "] 0]
if {($comando == "TEST") && ($nick == "mynick") && ($chan == "#mychan")} {
set $comando2 == $text
putquick "privmsg #otherchan: $comando2 $nick $text test123"
return 0
}
|
I've even tried creating a temporary txt file, but it's still too much for my actuals knowledge. If someone can point me out for a example tcl where i might learn from, or to help me with above one.
Thanks in advance. |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Jun 13, 2007 12:22 pm Post subject: |
|
|
| pub doesn't allow a wildcard, use pubm. |
|
| Back to top |
|
 |
Redento Voice
Joined: 13 Jun 2007 Posts: 3
|
Posted: Sun Jun 17, 2007 1:35 pm Post subject: |
|
|
| metroid wrote: | | pub doesn't allow a wildcard, use pubm. |
Well, i did that, but unluckily no luck yet.
Been searching in threads for more than a while, but no way.
I did modify the proc many times, doing various test, though. What i did, or at least, one of the many tries.
| Code: |
bind pubm - "*word*" procedura
proc procedura { nick host hand keyword text} {
if {[string match "*word*" $text]} {
putserv "privmsg #mychan:test $text abc"
}
}
|
Still doesn't work.  |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Mon Jun 18, 2007 1:48 pm Post subject: |
|
|
just to note, setting comando and comando2 to the same is wrong, and also why set comando2 to text when you can just use $text itself... _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Jun 18, 2007 2:13 pm Post subject: |
|
|
Think you've missed a space between the target (channel), and the start of the message:
| Code: | | putserv "privmsg #mychan:test $text abc" |
Most likely, it should be
| Code: | | putserv "privmsg #mychan :test $text abc" |
Also, the if-statement within the proc is kinda pointless, as it will (almost) always match when the binding triggers (unless "word" is part of the channelname) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|