mIRC Home    About    Download    Register    News    Help

Print Thread
#74899 11/03/04 11:10 PM
B
bunar
bunar
B
tell me why this validator wont work????

it always report me: +stn: No such Channel


on me:*:JOIN:#channel:{ /.timer 1 4 /fmd }

alias fmd {
set %fmodes $chan(#).mode
if (+stn isincs %fmodes) { halt }
else /cmode +stn
}

where /cmode is in aliases as:
/cmode /mode $chan $1-

#74900 12/03/04 12:28 AM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
It's because the /cmode alias uses $chan, but since it's being called from a timer rather than directly in the event $chan is $null. To get it to work correctly from the timer you'll have to pass the channel as a parameter.

#74901 12/03/04 12:35 AM
B
bunar
bunar
B
ehm i dont understand, what part of the code should be corrected ?

#74902 12/03/04 12:41 AM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
Code:
on me:*:JOIN:#channel:{ /.timer 1 4 /fmd [color:red]$chan[/color] }

alias fmd {
set %fmodes $chan([color:red]$$1[/color]).mode
if (+stn isincs %fmodes) { halt }
else /cmode [color:red]$1[/color] +stn
}

alias cmode /mode [color:red]$$1 $2-[/color]


Of course the /cmode alias is now the same as regular /mode, so you might want to just use /mode instead.

#74903 12/03/04 01:02 AM
B
bunar
bunar
B
and now it again on join sets modes no matter if they are set or not...

smirk

#74904 12/03/04 02:55 AM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
Your /if condition is flawed because it will only return true if the modes return with the exact sustring +stn. Instead use this:
Code:
on me:*:JOIN:#channel:{ /.timer 1 4 /fmd $chan }

alias fmd {
set %fmodes $chan($$1).mode
if (!$count($removecs(%fmodes,S,N,T),s,n,t)) cmode $1 +stn
}

alias cmode /mode $$1 $2-

#74905 12/03/04 07:29 AM
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
You can also wait for the numeric 324 (channel modes)
  • raw 324:& #channel *: if $regex($3,/[snt]/g) < 3 { mode $2 +snt }
I use $regex() to avoid counting upper-case channel modes which may have different meaning to the server. starbucks' method will work too laugh

Next time you open a thread, please give it a meaningful subject to make it easy for people who search the board to find a relevant result.

#74906 12/03/04 01:33 PM
B
bunar
bunar
B
thanx both, it works great now !

Last edited by bunar; 12/03/04 01:37 PM.

Link Copied to Clipboard