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.

help please flags

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Sedition
Voice
Posts: 17
Joined: Wed Dec 14, 2011 10:04 pm
Location: Bolivia, Beni, Trinidad / DALnet

help please flags

Post by Sedition »

this tcl lacks something so that he says (you have no privileges)

the tcl talks each other that denege the order why the common user has no privileges
and the bot makes it know like message in the channel

Code: Select all

bind pub o|o !control control
bind pub o|o .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0}

 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1." 
}
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
S
Sedition
Voice
Posts: 17
Joined: Wed Dec 14, 2011 10:04 pm
Location: Bolivia, Beni, Trinidad / DALnet

Re: help please flags

Post by Sedition »

the correct thing would be

Code: Select all

#### tcl ####
set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
   putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
 }
 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1." 
}
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You should switch from putquick to puthelp cos if multiple members issue the same command the bot will flood itself off.

What's the point on having the onchan there? Also, instead of using return 0 you could use the if ... else ... like:

Code: Select all

if {condition} {
	# true
} else {
	# false
}
Once the game is over, the king and the pawn go back in the same box.
S
Sedition
Voice
Posts: 17
Joined: Wed Dec 14, 2011 10:04 pm
Location: Bolivia, Beni, Trinidad / DALnet

Post by Sedition »

ok thanks caesar
a question and putserv it is well or not to be used and not to fill of flood

Code: Select all

set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
   puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
 }
 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}
is correct caesar ?
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Apart from changing from putquick to puthelp according to my recommendation, I still see the onchan and that you didn't use the if .. else .. syntax. :)

Anyway, just to be on the safe side I've added user's throttle proc to limit the non registered users from flooding the bot to one command every 5 seconds, or how many you wish.

Code: Select all

set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick uhost hand chan text} {
	global flagaccess
	if {![matchattr $hand $flagaccess $chan]} {
		if {![throttled $chan 5]} {
			puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)"
		}
	} else {
		puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
	}
}

# user's throttled
proc throttled {id seconds} {
	global throttle
	if {[info exists throttle($id)]&&$throttle($id)>[clock sec]} {
		set id 1
	} {
		set throttle($id) [expr {[clock sec]+$seconds}]
		set id 0
	}
}

bind time - ?0* throttledCleanup

proc throttledCleanup args {
	global throttle
	set now [clock sec]
	foreach {id time} [array get throttle] {
		if {$time<=$now} {unset throttle($id)}
	}
}
Once the game is over, the king and the pawn go back in the same box.
S
Sedition
Voice
Posts: 17
Joined: Wed Dec 14, 2011 10:04 pm
Location: Bolivia, Beni, Trinidad / DALnet

Post by Sedition »

very quite thank you..
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Post Reply