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

m (Parameters: Link access levels)
 
(3 intermediate revisions by one other user not shown)
Line 15: Line 15:
  
 
== 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 [[custom windows - mIRC|custom window]] where this event should listen. Can be '''@''' for all windows.
+
<span style="display: inline-block; width: 105px;">'''<@>'''</span>The {{mIRC|Custom Windows}} where this event should listen. Can be '''@''' for all windows.
  
 
<span style="display: inline-block; width: 105px;">'''<codepoint>'''</span>The specific characters' codepoints to listen for. Can specify multiple codepoints, such as:
 
<span style="display: inline-block; width: 105px;">'''<codepoint>'''</span>The specific characters' codepoints to listen for. Can specify multiple codepoints, such as:
Line 46: Line 46:
  
 
== See Also ==
 
== See Also ==
* [[custom windows - mIRC|Custom Windows]]
 
 
* {{mIRC|on keydown}}
 
* {{mIRC|on keydown}}
* [[on keyup - mIRC|ON KEYUP]]
+
* {{mIRC|on keyup}}
 
* {{mIRC|$keyval}}
 
* {{mIRC|$keyval}}
 
* {{mIRC|$keychar}}
 
* {{mIRC|$keychar}}
Line 54: Line 53:
 
{{mIRC on event list}}
 
{{mIRC on event list}}
  
[[Category:mIRC on events|keydown]]
+
[[Category:mIRC on events|char]]

Latest revision as of 06:34, 6 February 2024

The ON Char event is triggered when a character results from pressing one or more inside of a custom @window.

See the note about the on keydown event, pressing control + o should result in two keypress being reported from on keydown, and control + o generates the character with code point 15, on char will trigger for that character.

This event fills the following identifiers:

$keyvalThe unicode codepoint of the character resulting from keypresses
$keycharThe actual character resulting from keypresses
$keyrptIf the key is being held down/repeating

Synopsis[edit]

ON <level>:char:<@>:<codepoint,...,codepointN>:<commands>

Parameters[edit]

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

<@>The Custom Windows where this event should listen. Can be @ for all windows.

<codepoint>The specific characters' codepoints to listen for. Can specify multiple codepoints, such as:

ON *:char:@myWindow:38,42,55,78:echo -a $keyval

Example[edit]

Create an alias that launches a custom, picture window which listens for resulting character from keypresses and displays the character and if it is repeating:

alias keyDownTest {
  window -p $+ $iif($window(@myWindow),ra) @myWindow 550 300 250 105
}
ON *:char:@myWindow:*: {
  clear @myWindow
  drawtext @myWindow 1 3 3 Codepoint value: $iif($keyval,$v1,NA)
  drawtext @myWindow 1 3 25 Character: $iif($keychar,$v1,NA)
  drawtext @myWindow 1 3 47 Repeating: $keyrpt
}

The following command can now be typed into any mIRC command prompt:

/keyDownTest

Below is an image reflecting what this example will look like:

This screenshot shows an example of the ON KEYDOWN event custom example.


Compatibility[edit]

Added: mIRC v7.62
Added on: 29 Jul 2020
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also[edit]