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.

putnotc $nick help

Help for those learning Tcl or writing their own scripts.
Post Reply
x
xmods
Voice
Posts: 3
Joined: Wed Sep 08, 2010 7:37 am

putnotc $nick help

Post by xmods »

im trying to change this script to notice nic instead on msg channel, when i change putmsg $channel "\002$tellnick\002: ($dbfact) $out1" to putnotc $nick "\002$tellnick\002: ($dbfact) $out1" it only notices the nic sending the command

it's the faq.tcl i just changed all the rest with putnotc $nick so people can't flood the chan and it goes specifically to the nic it's ment for

Code: Select all

proc faq:tell_fact {nick idx handle channel args} {
	global faq
	if { [lsearch -exact [split [string tolower $faq(channels)]] [string tolower $channel]] < 0 } {
		return 0
	}
	if {$faq(status)==1} {
		putnotc $nick "The faq-database is \002closed\002."
		return 0
	}
	if {![file exist $faq(database)]} {
		set database [open $faq(database) w]
		puts -nonewline $database ""
		close $database
	}
	set tellnick [ lindex [split [join $args]] 0 ]
	set fact [ string trim [ string tolower [ join [ lrange [split [join $args]] 1 end ] ] ] ]
	if {$tellnick == ""} {
		putnotc $nick "Syntax: [string trim $faq(cmdchar)]faq \002nick\002 keyword"
		return 0
	}
	if {$fact == ""} {
		putnotc $nick "Syntax: [string trim $faq(cmdchar)]faq nick \002keyword\002"
		return 0
	}
	set database [open $faq(database) r]
	set dbline ""
	while {![eof $database]} {
		gets $database dbline
		set dbfact [ string tolower [ lindex [split $dbline [string trim $faq(splitchar)]] 0 ] ]
		set dbdefinition [string range $dbline [expr [string length $fact]+1] end]
		if {$dbfact==$fact} {
			if {[string match -nocase "*$faq(newline)*" $dbdefinition]} {
				set out1 [lindex [split $dbdefinition "$faq(newline)"] 0]
				set out2 [string range $dbdefinition [expr [string length $out1]+2] end]
				putmsg $channel "\002$tellnick\002: ($dbfact) $out1"
				putmsg $channel "\002$tellnick\002: ($dbfact) $out2"
			} else {
				putmsg $channel "\002$tellnick\002: ($dbfact) $dbdefinition"
			}
			putlog "FAQ: Send keyword \"\002$fact\002\" to $tellnick by $nick ($idx)"
			close $database
			return 0
		}
	}
	close $database
	putnotc $nick "I don't have the keyword \002$fact\002 in my database."
	if {[matchattr $handle [string trim $faq(glob_flag)]|[string trim $faq(chan_flag)] $channel]} {
		putnotc $nick "You could add \002$fact\002 by using [string trim $faq(cmdchar)]addword \002$fact\002[string trim $faq(splitchar)]Definition goes here."
	} else {
		putnotc $nick "If you're looking for a TCL-Script try http://www.egghelp.org/cgi-bin/tcl_archive.tcl?strings=$fact"
	}
	return 0
}
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

Code: Select all

            putnotc $tellnick "\002$tellnick\002: ($dbfact) $out1"
            putnotc $tellnick "\002$tellnick\002: ($dbfact) $out2"
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Post Reply