Difference between revisions of "$comchan"
From Scriptwiki
m (typo) |
m (wiki link incorrect) |
||
Line 33: | Line 33: | ||
== Note == | == Note == | ||
− | You should note when using $comchan within the [[on nick event | + | You should note when using $comchan within the [[On_nick|on nick event]] the IAL has already updated so you must use [[$newnick]] not [[$nick]]. |
Here is an example: | Here is an example: | ||
; Trigger when someone changes their nick. | ; Trigger when someone changes their nick. |
Revision as of 10:40, 9 September 2006
Returns the names of channels which both you and nick are on.
$comchan(nick,N)
$comchan can have the following properties:
Property | Meaning |
op | returns $true if you're an op on the channel |
help | returns $true if you have help on the channel |
voice | returns $true if you have voice on the channel |
Example
This example will return all comchans you have with someone:
; begin a new alias, we want to have something like $comchans(<nick>). alias comchans { var %i = 1, %comchans ; begin to loop through all comchans while (%i <= $comchan($1, 0)) { ; set %comchans to all common channels, seperated by space (ascii 32) %comchans = $addtok(%comchans, $comchan($1,%i),32) ; increase looping-variable inc %i } ; return %comchans return %comchans }
Note
You should note when using $comchan within the on nick event the IAL has already updated so you must use $newnick not $nick. Here is an example:
; Trigger when someone changes their nick. on ^*:nick: { ; Set %i to the total amount of common channels you and the person changing their nick have in common. var %i = $comchan($newnick,0) while (%i) { ; echo with the color of a nick change to the %i'th common channel the message reguarding the nick change. echo $color(nick) -t $comchan($newnick,%i) * $nick changed their nickname to $newnick ; Decrease the value of %i so we don't message the same channel twice. dec %i } ; halt the mIRC default action for this event. (must use the ^ prefix with the event for this to work.) haltdef }
See Also
To get all the channels you are in, look at $chan.