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

(Created page with "{{mirc title|On Char - Events}} The '''ON Char''' event is triggered when a character results from pressing one or more inside of a custom @window....")
 
Line 5: Line 5:
  
 
This event fills the following identifiers:
 
This event fills the following identifiers:
<div style="background-color: rgba(0,0,0,.03); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 35px; margin-right: 10px; width: 70px;">'''{{mIRC|$keyval}}'''</span>The [[unicode character|unicode character]] value of the character resulting from keypresses</div>
+
<div style="background-color: rgba(0,0,0,.03); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 35px; margin-right: 10px; width: 70px;">'''{{mIRC|$keyval}}'''</span>The unicode codepoint of the character resulting from keypresses</div>
  
 
<div style="background-color: rgba(0,0,0,.03); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 35px; margin-right: 10px; width: 70px;">'''{{mIRC|$keychar}}'''</span>The actual character resulting from keypresses</div>
 
<div style="background-color: rgba(0,0,0,.03); display: block;"><span style="border-right: 1px dashed rgba(0,0,0,.15); display: inline-block; margin-left: 35px; margin-right: 10px; width: 70px;">'''{{mIRC|$keychar}}'''</span>The actual character resulting from keypresses</div>

Revision as of 19:59, 22 January 2022

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

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

Parameters

<level>The level for the event to trigger.

<@>The custom window 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

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

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