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

(Parameters)
m (Parameters: Link access levels)
 
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 {{mIRC|Custom Windows}} 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.

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]