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.

A little help needed

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juggle
Voice
Posts: 15
Joined: Sat Sep 01, 2018 1:04 am

A little help needed

Post by juggle »

Can you guys please help me on this.. instead of giving command to the channel with !mytutil how do i change it to !mytitle

Code: Select all

### mytitul
proc ::tpub::cmd_mytitul {nick chan text} { variable conf
	 if {$text == "?help?"} { return [usage $nick $chan mytitul "?text...?" "sets the title to be displayed in !in/!out at the entrance to the channel. If you want to delete the title, set the parameter none."] }
		set hand [nick2hand $nick]
		if {$hand == "" || $hand == "*"} {putnot $nick "You are not registered on the bot.."; return}
		array set usr [users get $hand]
		set honor ""
		set ko 0
		foreach item $conf(drank) { 
		if {$usr(score)<=$item} { set honor [lindex $conf(rank) $ko]; break}
		incr ko } 
		if {$honor != "" || ![users isintop $hand] || ![matchattr $hand n]} {
			putpvt $nick $chan "You are not in the top five players or your current rank is not equal to the maximum possible - \"$conf(dmax)\" - , therefore, you cannot set your own title."
			return
		}
		if {[lindex $text 0]!="none"} {
set tremort [lindex $text 0]
		set usr(tremort) $tremort
		users set [list $hand [array get usr]]
		putpvt $nick $chan "Your title is set to \"$tremort\""
		} else {
		unset usr(tremort)
		users set [list $hand [array get usr]]
		putpvt $nick $chan "Your title has been removed.."

		}
		
}
Please help me ..... Thanks & sorry for my bad English
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: A little help needed

Post by willyw »

juggle wrote:Can you guys please help me on this.. instead of giving command to the channel with !mytutil how do i change it to !mytitle
You have not posted the complete script. I say that because there is no bind command appearing.

The bind <type> command is what creates an association between an event and the calling of a procedure.

Typically for a command like you have described, it would be a
bind pub
command. However, by the way the procedure that you did post is written, a bind pub cannot be used directly. So, without seeing the whole script, it is guess work. You might want to post the complete script. If it is too difficult to post here, then use:
http://paste.tclhelp.net/
and post the link.

You might also like to read :
http://suninet.the-demon.de/041.htm
and use:
http://docs.eggheads.org/mainDocs/tcl-commands.html
for reference. You can find all the binds described here.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
j
juggle
Voice
Posts: 15
Joined: Sat Sep 01, 2018 1:04 am

Re: A little help needed

Post by juggle »

Thank you for the reply... i somehow fiexed the problem.. thank you so much again...
Post Reply