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.

Autovoice with opcheck & timer

Old posts that have not been replied to for several years.
Locked
User avatar
Tristam
Voice
Posts: 17
Joined: Sun Sep 21, 2003 11:28 am
Location: Finland

Autovoice with opcheck & timer

Post by Tristam »

Ok I know this is probably stupid.. I've been thinking for hours now but I still dont get it, so I might as well try here :wink: Dont bother posting "RTMF", believe me, I've tried it, maybe I'm just too stupid, so help a noob!

Ok, I want to autovoice everyone joining the channel, but when people that have auto-op with L (on QuakeNet) join the channel, L gives them op first, so voicing is not necessary anymore and just results more spam.

So I want it to chech if the user already has op from L, but it has to be timed a little after then joining, because.. you know :P

Code: Select all

proc join!rock {nick host hand chan} {
	if {$chan != "#rock.sas"} { } else {
		if {![isop $nick $chan]} { pushmode $chan +v $nick } else { } } }
As amazing as it seems, this does work, now all I need is the timer.

Code: Select all

proc join!rock {nick host hand chan} {
	if {$chan != "#rock.sas"} { } else {
		utimer 5 "if {![isop $nick $chan]}" { pushmode $chan +v $nick } else { } } }
so I get "Tcl error [join!rock]: wrong # args: should be "utimer seconds command"" with this.. I so confused with all the {'s and }'s all over the place, generally, how to use timer with the command being "if"?
Tristam - tristam@iki.fi
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

I guess you want variable substitution before the code is passed to 'utimer'...
You'll have to escape every special char that you don't want to take effect at this point and also escape the values stored in the variables (using 'list') because the code will be evaluated once more when the timer runs the code.

Code: Select all

utimer 5 "if \{!\[[list isop $nick $chan]\]\} \{[list pushmode $chan +v $nick]\}"
...what a mess :P
I'd use a proc to do the if/pushmode and just pass the nick+channel name to that proc. eg:

Code: Select all

proc modeifneeded {nick chan} {if {![isop $nick $chan]} {pushmode $chan +v $nick}}

utimer 5 [list modeifneeded $nick $chan]
Have you ever read "The Manual"?
User avatar
Tristam
Voice
Posts: 17
Joined: Sun Sep 21, 2003 11:28 am
Location: Finland

Post by Tristam »

user wrote: I'd use a proc to do the if/pushmode and just pass the nick+channel name to that proc. eg:

Code: Select all

proc modeifneeded {nick chan} {if {![isop $nick $chan]} {pushmode $chan +v $nick}}

utimer 5 [list modeifneeded $nick $chan]
Thanks a lot! That was the first way I tried to do it.. but I didnt know how to give information from a proc to another.. now it works! thanks! ;)
Tristam - tristam@iki.fi
Locked