From WikiChip
Difference between revisions of "mirc/on events/on join"
< mirc‎ | on events

m (Bot: adding missing title)
m
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{mirc title|On Join - Events}}
 
{{mirc title|On Join - Events}}
 
The '''ON JOIN''' event triggers when the mIRC client, or a remote user, joins a channel.
 
The '''ON JOIN''' event triggers when the mIRC client, or a remote user, joins a channel.
 +
 +
'''Note''': When you join a channel yourself, $nick($chan,0) is always 1 inside the ON JOIN event because mIRC has to send /names to get the nickname; if you want to undertake some processing once the channel user list is complete, then use the RAW 366 event which indicates the end of the user list. Similarly, if you're an operator on the channel, you won't have been opped at the point that the ON JOIN event runs, so if you need to use your op capabilities inside the event script then you should use the ON OP event instead.
  
 
== Synopsis ==
 
== Synopsis ==
Line 6: Line 8:
  
 
== Parameters ==
 
== Parameters ==
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The level for the event to trigger.
+
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The corresponding {{mIRC|access levels}} for the event to trigger.
  
<span style="display: inline-block; width: 105px;">'''<#,[,#]>'''</span>The text that to be matched. Can also be a [[wildcard]].
+
<span style="display: inline-block; width: 105px;">'''<#,[,#]>'''</span>The text that to be matched. Can also be a {{mirc|wildcard}}.
  
 
<div style="background-color: rgba(0,0,0,.06); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 105px; margin-right: 25px; width: 60px;">'''[,#]'''</span>Specific channel names</div>
 
<div style="background-color: rgba(0,0,0,.06); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 105px; margin-right: 25px; width: 60px;">'''[,#]'''</span>Specific channel names</div>
Line 15: Line 17:
  
 
== Examples ==
 
== Examples ==
Once the local mIRC client has joined a channel, echo to the channel window the total users inside of the channel:
 
<source lang="mIRC">ON ME:*:JOIN:#:echo # Total Users: $nick(#,0)</source>
 
  
The above example makes use of the [[on me - mIRC|ON ME]] event, which triggers only when the local mIRC client triggers the event, not remote users.
+
The following example makes use of the [[on me - mIRC|ON ME]] event, which triggers only when the local mIRC client triggers the event, not remote users.
 +
<source lang="mIRC">ON ME:*:JOIN:#testing: { msg $chan Hello $chan - Today is $day and time is $time }</source>
  
When a user joins, send them a greeting:
+
The following example works for everyone else who joins but except your self.
 +
<source lang="mIRC">ON !*:JOIN:#mychan: { msg $chan Hey $nick $+ ! Welcome in our channel. }</source>
 +
 
 +
Who ever joins, send them a greeting:
 
<source lang="mIRC">ON *:JOIN:#:msg # Welcome to # $+ , $nick $+ !</source>
 
<source lang="mIRC">ON *:JOIN:#:msg # Welcome to # $+ , $nick $+ !</source>
 +
 +
Override the join event to print a custom text and then tell mIRC to ignore it's own text.
 +
<source lang="mIRC">
 +
on ^*:JOIN:*:{
 +
  echo -tcbf join $chan * $nick ( $+ $fulladdress $+ ) join $chan
 +
  halt
 +
}
 +
</source>
  
 
== Compatibility ==
 
== Compatibility ==
{{mIRC compatibility|2.1a}}
+
{{mIRC compatibility|4.5}}
  
 
== See Also ==
 
== See Also ==

Latest revision as of 07:03, 6 February 2024

The ON JOIN event triggers when the mIRC client, or a remote user, joins a channel.

Note: When you join a channel yourself, $nick($chan,0) is always 1 inside the ON JOIN event because mIRC has to send /names to get the nickname; if you want to undertake some processing once the channel user list is complete, then use the RAW 366 event which indicates the end of the user list. Similarly, if you're an operator on the channel, you won't have been opped at the point that the ON JOIN event runs, so if you need to use your op capabilities inside the event script then you should use the ON OP event instead.

Synopsis[edit]

ON <level>:JOIN:<#[,#]>:<commands>

Parameters[edit]

<level>The corresponding access levels for the event to trigger.

<#,[,#]>The text that to be matched. Can also be a wildcard.

[,#]Specific channel names

<commands>The commands to be performed when the event listener's criteria is met.

Examples[edit]

The following example makes use of the ON ME event, which triggers only when the local mIRC client triggers the event, not remote users.

ON ME:*:JOIN:#testing: { msg $chan Hello $chan - Today is $day and time is $time }

The following example works for everyone else who joins but except your self.

ON !*:JOIN:#mychan: { msg $chan Hey $nick $+ ! Welcome in our channel. }

Who ever joins, send them a greeting:

ON *:JOIN:#:msg # Welcome to # $+ , $nick $+ !

Override the join event to print a custom text and then tell mIRC to ignore it's own text.

on ^*:JOIN:*:{
  echo -tcbf join $chan * $nick ( $+ $fulladdress $+ ) join $chan
  halt
}

Compatibility[edit]

Added: mIRC v4.5
Added on: 30 Jun 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also[edit]