$ischanmode

Platform:  mIRC
Published  Dec 25, 2007
Updated  Dec 25, 2007
Returns $true or $false depending on if a channel mode is set. See documentation below. Ability to use wildcards and to match multiple modes at a time. Very simplified code. /*
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
•• $ischanmode by sunburst
•• ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
•• Simple snippet I made of use for in my script; thought other people might find this to be helpful.
•• This snippet will check if a mode is set in a channel.
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
•• Syntax: $ischanmode(#channel,<mode string>)
•• ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
•• Example: $ischanmode(#mIRC,n) returns $true if the mode n is set
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
•• Note: Uses $wildtok so you CAN use wildcards:
•• Ex: $ischanmode(#mIRC,*n*t*) would return $true if the mode set matched *n*t*
•• Otherwise, it will just format the inputed string as *<mode string>*
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
*/

alias ischanmode {
if ( !$2 ) || ( $me !ison $1 ) || ( $regex($2,/(\d+)/) ) {
echo -ac info * $!ischanmode: insufficient parameters
halt
}
var %w = $iif($regex($2,/[\*]/gx),$2,$+(*,$2,*))
if ( $wildtok($chan($1).mode,%w,1,32) ) {
return $true
}
else { return $false }
}

Comments

Sign in to comment.
dashh   -  Feb 21, 2009
-> $poscs($chan($1).mode,$2)

more chars ?

U can use $numtok 32 in $2($2-) to search a string like -> #room n t l
and pos target whit gettok.

$str(lastid,$numtok($2-))

done xD but nice work with regex.
 Respond  
Thorarin   -  Feb 20, 2009
The snippet works alright after fixing some of the whitespace that tends to mess up mIRC scripts.. there's just one thing: you should be using $wildtokcs instead of $wildtok. A channel flag "c" is different than "C" for example.
 Respond  
sunburst   -  Dec 25, 2007
Ah, I knew this would come up. That would work, but this is better because it supports wildcards. If the modes were +ist, $ischanmode(#,it) would not work. However, $ischanmode(#,i*t) would work. Just makes it easier to return matches.
 Respond  
Lindrian   -  Dec 25, 2007

Code

 

That\'d do I think.
 Respond  
sunburst   -  Dec 25, 2007
Yes I know it is simple, but, as stated in the documentation, I found it very useful and thought I\'d share it with others. Thanks for your rating though!
 Respond  
Rebellious   -  Dec 25, 2007
.. Very simple =(
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.