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.

MSG in a chan, MSG -> other chan

Help for those learning Tcl or writing their own scripts.
Post Reply
R
Redento
Voice
Posts: 3
Joined: Wed Jun 13, 2007 8:55 am

MSG in a chan, MSG -> other chan

Post by Redento »

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: Select all

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.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

pub doesn't allow a wildcard, use pubm.
R
Redento
Voice
Posts: 3
Joined: Wed Jun 13, 2007 8:55 am

Post by Redento »

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: Select all

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. :(
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Think you've missed a space between the target (channel), and the start of the message:

Code: Select all

putserv "privmsg #mychan:test $text abc"
Most likely, it should be

Code: Select all

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
Post Reply