<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://chronocrash.com/openbor/wiki/index.php?action=history&amp;feed=atom&amp;title=Key_Scripts</id>
	<title>Key Scripts - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://chronocrash.com/openbor/wiki/index.php?action=history&amp;feed=atom&amp;title=Key_Scripts"/>
	<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=Key_Scripts&amp;action=history"/>
	<updated>2026-08-28T23:44:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://chronocrash.com/openbor/wiki/index.php?title=Key_Scripts&amp;diff=983&amp;oldid=prev</id>
		<title>Dcurrent at 18:04, 20 August 2026</title>
		<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=Key_Scripts&amp;diff=983&amp;oldid=prev"/>
		<updated>2026-08-20T18:04:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:04, 20 August 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l318&quot;&gt;Line 318:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 318:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Thinkscript]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Thinkscript]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Updateentityscript]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Updateentityscript]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Openbor]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dcurrent</name></author>
	</entry>
	<entry>
		<id>https://chronocrash.com/openbor/wiki/index.php?title=Key_Scripts&amp;diff=982&amp;oldid=prev</id>
		<title>Dcurrent: Created page with &quot;Category:Model Category:Script  &#039;&#039;&#039;keyscript&#039;&#039;&#039; is a model and level command for executing script in response to player input. OpenBOR also provides fixed global key-script files and an InputAll preprocessing hook. Together, these form a layered input system that can observe, supplement, redirect, or replace native control behavior.  Key scripts are not limited to activating attacks. They may control menus, open defensive windows, manage charged actions, change m...&quot;</title>
		<link rel="alternate" type="text/html" href="https://chronocrash.com/openbor/wiki/index.php?title=Key_Scripts&amp;diff=982&amp;oldid=prev"/>
		<updated>2026-08-20T17:56:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/openbor/wiki/index.php/Category:Model&quot; title=&quot;Category:Model&quot;&gt;Category:Model&lt;/a&gt; &lt;a href=&quot;/openbor/wiki/index.php/Category:Script&quot; title=&quot;Category:Script&quot;&gt;Category:Script&lt;/a&gt;  &amp;#039;&amp;#039;&amp;#039;keyscript&amp;#039;&amp;#039;&amp;#039; is a model and level command for executing script in response to player input. OpenBOR also provides fixed global key-script files and an InputAll preprocessing hook. Together, these form a layered input system that can observe, supplement, redirect, or replace native control behavior.  Key scripts are not limited to activating attacks. They may control menus, open defensive windows, manage charged actions, change m...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Model]]&lt;br /&gt;
[[Category:Script]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;keyscript&amp;#039;&amp;#039;&amp;#039; is a model and level command for executing script in response to player input. OpenBOR also provides fixed global key-script files and an InputAll preprocessing hook. Together, these form a layered input system that can observe, supplement, redirect, or replace native control behavior.&lt;br /&gt;
&lt;br /&gt;
Key scripts are not limited to activating attacks. They may control menus, open defensive windows, manage charged actions, change movement, coordinate multiplayer input, implement contextual controls, or support entirely custom command systems.&lt;br /&gt;
&lt;br /&gt;
== Input States ==&lt;br /&gt;
&lt;br /&gt;
OpenBOR maintains several input masks for each player. Each is an integer whose bits identify applicable controls.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
! State&lt;br /&gt;
! Player property&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Held&lt;br /&gt;
| &amp;lt;code&amp;gt;keys&amp;lt;/code&amp;gt;&lt;br /&gt;
| Controls currently held by the player.&lt;br /&gt;
|-&lt;br /&gt;
| Pressed&lt;br /&gt;
| &amp;lt;code&amp;gt;newkeys&amp;lt;/code&amp;gt;&lt;br /&gt;
| Controls newly pressed during the current input refresh.&lt;br /&gt;
|-&lt;br /&gt;
| Released&lt;br /&gt;
| &amp;lt;code&amp;gt;releasekeys&amp;lt;/code&amp;gt;&lt;br /&gt;
| Controls newly released during the current input refresh.&lt;br /&gt;
|-&lt;br /&gt;
| Play&lt;br /&gt;
| &amp;lt;code&amp;gt;playkeys&amp;lt;/code&amp;gt;&lt;br /&gt;
| Pressed controls awaiting native gameplay handling. Native actions consume bits from this mask as they use them.&lt;br /&gt;
|-&lt;br /&gt;
| Disabled&lt;br /&gt;
| &amp;lt;code&amp;gt;disablekeys&amp;lt;/code&amp;gt;&lt;br /&gt;
| Controls masked from the player&amp;#039;s detected input.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See [[Controls#Key Control Constants|Key Control Constants]] for the corresponding bit-mask constants.&lt;br /&gt;
&lt;br /&gt;
== Processing Order ==&lt;br /&gt;
&lt;br /&gt;
OpenBOR provides five script layers before native gameplay responds to input. The applicable layers execute in this order for each player:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Order&lt;br /&gt;
! Layer&lt;br /&gt;
! Scope&lt;br /&gt;
! Event data&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| &amp;lt;code&amp;gt;data/scripts/inputall.c&amp;lt;/code&amp;gt;&lt;br /&gt;
| All player input, before command history and ordinary key scripts&lt;br /&gt;
| &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Level &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt;&lt;br /&gt;
| Current level&lt;br /&gt;
| &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Model &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt;&lt;br /&gt;
| Entity currently controlled by the player&lt;br /&gt;
| &amp;lt;code&amp;gt;self&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| &amp;lt;code&amp;gt;data/scripts/key1.c&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;key4.c&amp;lt;/code&amp;gt;&lt;br /&gt;
| Corresponding player slot&lt;br /&gt;
| None&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| &amp;lt;code&amp;gt;data/scripts/keyall.c&amp;lt;/code&amp;gt;&lt;br /&gt;
| All applicable players&lt;br /&gt;
| &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Native gameplay input handling follows the script layers during entity update. Earlier scripts may change the player input masks before later scripts inspect them. Return values do not stop subsequent layers.&lt;br /&gt;
&lt;br /&gt;
Global update scripts execute after InputAll but before the ordinary key-script chain. Logical entity updates occur after the key-script chain.&lt;br /&gt;
&lt;br /&gt;
== InputAll ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;data/scripts/inputall.c&amp;lt;/code&amp;gt; is an automatic global script. No model or level command is required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int player = getlocalvar(&amp;quot;player&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Inspect or transform incoming player input here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
InputAll executes during input refresh after OpenBOR reads physical controls into the player&amp;#039;s input masks. It runs before OpenBOR records the command-input event and before any ordinary keyscript. Changes to &amp;lt;code&amp;gt;keys&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;newkeys&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;releasekeys&amp;lt;/code&amp;gt; can therefore alter what later command matching and key scripts observe.&lt;br /&gt;
&lt;br /&gt;
InputAll is also suitable for updating &amp;lt;code&amp;gt;playkeys&amp;lt;/code&amp;gt; when transformed input should affect native actions. For example, exchanging left and right only in &amp;lt;code&amp;gt;newkeys&amp;lt;/code&amp;gt; would change the recorded press but leave the original native action in &amp;lt;code&amp;gt;playkeys&amp;lt;/code&amp;gt; unless that mask is changed as well.&lt;br /&gt;
&lt;br /&gt;
Unlike ordinary key scripts, InputAll is not suppressed by the game&amp;#039;s paused state. This makes it suitable for custom pause interfaces and other input processing that must continue while gameplay is stopped.&lt;br /&gt;
&lt;br /&gt;
== Level Keyscript ==&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt; to a level definition and provide the path to the script file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
keyscript data/scripts/level_key.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The level keyscript executes for applicable input from each player while that level is active. It receives the zero-indexed player slot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int player = getlocalvar(&amp;quot;player&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Handle level-specific input here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Level key scripts are useful for stage mechanics, shared interfaces, scripted sequences, environmental interactions, or control rules that should apply only in a particular level.&lt;br /&gt;
&lt;br /&gt;
Current syntax provides one level &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt;, not a numbered &amp;lt;code&amp;gt;keyscript#&amp;lt;/code&amp;gt; command. The &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt; variable identifies which player&amp;#039;s input triggered the event.&lt;br /&gt;
&lt;br /&gt;
== Model Keyscript ==&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt; to a model definition and provide the path to the script file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
keyscript data/scripts/model_key.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model keyscript executes only when an entity spawned from that model is currently assigned to a player slot. Adding the command to an ordinary AI-controlled entity does not make the script poll input. If control of that entity is assigned to a player, its model keyscript becomes applicable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    void self = getlocalvar(&amp;quot;self&amp;quot;);&lt;br /&gt;
    int player = getlocalvar(&amp;quot;player&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Handle model-specific input here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The command is named &amp;lt;code&amp;gt;keyscript&amp;lt;/code&amp;gt;. References to &amp;#039;&amp;#039;entitykeyscript&amp;#039;&amp;#039; describe an internal engine label and should not be used in model text.&lt;br /&gt;
&lt;br /&gt;
Model key scripts are ideal for character-specific controls because &amp;lt;code&amp;gt;self&amp;lt;/code&amp;gt; already identifies the controlled entity. Different models may use the same physical input for entirely different actions without adding model-selection logic to a global script.&lt;br /&gt;
&lt;br /&gt;
== Player Key Scripts ==&lt;br /&gt;
&lt;br /&gt;
The following optional global files correspond directly to player slots:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;data/scripts/key1.c&amp;lt;/code&amp;gt; - Player 1.&lt;br /&gt;
* &amp;lt;code&amp;gt;data/scripts/key2.c&amp;lt;/code&amp;gt; - Player 2.&lt;br /&gt;
* &amp;lt;code&amp;gt;data/scripts/key3.c&amp;lt;/code&amp;gt; - Player 3.&lt;br /&gt;
* &amp;lt;code&amp;gt;data/scripts/key4.c&amp;lt;/code&amp;gt; - Player 4.&lt;br /&gt;
&lt;br /&gt;
OpenBOR loads these files automatically when present. They receive no automatic event variables because the filename already determines the player slot. Scripts that share common functions may pass their known zero-indexed slot explicitly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int player = 0; // key1.c is Player 1.&lt;br /&gt;
&lt;br /&gt;
    // Handle Player 1 input here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player key scripts are useful when behavior belongs to a controller slot rather than the current model or level.&lt;br /&gt;
&lt;br /&gt;
== Keyall ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;data/scripts/keyall.c&amp;lt;/code&amp;gt; is an automatic global script that executes for each applicable player after the level, model, and player-slot key scripts. OpenBOR supplies the zero-indexed player slot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int player = getlocalvar(&amp;quot;player&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Handle project-wide player input here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keyall is suited to project-wide shortcuts, shared interfaces, diagnostics, achievements, or common behaviors that should not be duplicated across models and levels.&lt;br /&gt;
&lt;br /&gt;
Level and model key scripts require an active level. Player-slot and Keyall scripts may also execute on applicable non-level engine screens. Ordinary key scripts do not execute while the game is paused.&lt;br /&gt;
&lt;br /&gt;
== Trigger Conditions ==&lt;br /&gt;
&lt;br /&gt;
By default, the ordinary key-script chain executes when a player newly presses or releases at least one control. Pressing and later releasing one control therefore causes two separate event calls.&lt;br /&gt;
&lt;br /&gt;
Multiple controls changing during the same input refresh do not cause separate calls. Each applicable script executes once for that player and may inspect every relevant input bit during the call.&lt;br /&gt;
&lt;br /&gt;
The ordinary chain executes only while the game is not paused. Level and model layers also require an active level, and the model layer requires a current player entity.&lt;br /&gt;
&lt;br /&gt;
=== Held-Key Repetition ===&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;keyscriptrate&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;data/scripts/script.txt&amp;lt;/code&amp;gt; when the scripts should also execute while any control remains held:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
keyscriptrate 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the setting&amp;#039;s name, its value does not specify a numeric interval. Zero disables held-key repetition, while any nonzero value enables it. Once enabled, the ordinary key-script chain executes during outer updates while the player continues holding a control.&lt;br /&gt;
&lt;br /&gt;
Creators do not need held-key repetition merely to inspect held controls. Any execution caused by a press or release may query the current held mask. Enable &amp;lt;code&amp;gt;keyscriptrate&amp;lt;/code&amp;gt; when continuous execution is itself required.&lt;br /&gt;
&lt;br /&gt;
== Inspecting Controls ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;playerkeys()&amp;lt;/code&amp;gt; provides a convenient way to test individual controls. It accepts a player slot, an input-state selector, and one or more control names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
int result = playerkeys(player, state, control, ...);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! State&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;&lt;br /&gt;
| Control is currently held.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;&lt;br /&gt;
| Control was newly pressed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;&lt;br /&gt;
| Control was newly released.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Supported control names are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;attack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;attack2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;attack3&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;attack4&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;jump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;special&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;esc&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;moveleft&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;moveright&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;moveup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;movedown&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;screenshot&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;anybutton&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;anybutton&amp;lt;/code&amp;gt; represents Jump, Special, or any Attack control. It does not include movement, Start, Screenshot, or Escape.&lt;br /&gt;
&lt;br /&gt;
When more than one control is supplied, &amp;lt;code&amp;gt;playerkeys()&amp;lt;/code&amp;gt; returns true only when all requested controls match the selected state. This makes chord checks concise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    void self = getlocalvar(&amp;quot;self&amp;quot;);&lt;br /&gt;
    int player = getlocalvar(&amp;quot;player&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Newly pressed Attack 4.&lt;br /&gt;
    if (playerkeys(player, 1, &amp;quot;attack4&amp;quot;))&lt;br /&gt;
    {&lt;br /&gt;
        setentityvar(self, &amp;quot;stance_change&amp;quot;, 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Up and Attack pressed together.&lt;br /&gt;
    if (playerkeys(player, 1, &amp;quot;moveup&amp;quot;, &amp;quot;attack&amp;quot;))&lt;br /&gt;
    {&lt;br /&gt;
        setentityvar(self, &amp;quot;command_uppercut&amp;quot;, 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Special was released.&lt;br /&gt;
    if (playerkeys(player, 2, &amp;quot;special&amp;quot;))&lt;br /&gt;
    {&lt;br /&gt;
        setentityvar(self, &amp;quot;release_charge&amp;quot;, 1);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Consuming Input ==&lt;br /&gt;
&lt;br /&gt;
Key-script return values are ignored. Returning &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, or another value does not consume input, prevent later scripts, or suppress native behavior.&lt;br /&gt;
&lt;br /&gt;
To prevent a native action, remove the corresponding bit from the player&amp;#039;s &amp;lt;code&amp;gt;playkeys&amp;lt;/code&amp;gt; mask. Preserve unrelated bits so other controls remain available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
void consume_attack4(int player)&lt;br /&gt;
{&lt;br /&gt;
    int attack4 = openborconstant(&amp;quot;FLAG_ATTACK4&amp;quot;);&lt;br /&gt;
    int play_keys = getplayerproperty(player, &amp;quot;playkeys&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    changeplayerproperty(&lt;br /&gt;
        player,&lt;br /&gt;
        &amp;quot;playkeys&amp;quot;,&lt;br /&gt;
        play_keys &amp;amp; ~attack4&lt;br /&gt;
    );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clearing &amp;lt;code&amp;gt;playkeys&amp;lt;/code&amp;gt; suppresses pending native gameplay use, but does not erase the press from &amp;lt;code&amp;gt;newkeys&amp;lt;/code&amp;gt;, the held state from &amp;lt;code&amp;gt;keys&amp;lt;/code&amp;gt;, or a recorded command-input event. InputAll is the appropriate layer when the input itself must be transformed before command history is constructed.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;disablekeys&amp;lt;/code&amp;gt; when a control should remain unavailable across future input refreshes. Clear the applicable current masks as well if the already-detected input must be cancelled immediately.&lt;br /&gt;
&lt;br /&gt;
== Examples and Uses ==&lt;br /&gt;
&lt;br /&gt;
Quick applications include:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Character-specific controls&amp;#039;&amp;#039;&amp;#039; - Give different playable models distinct command layouts or contextual actions.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Parry windows&amp;#039;&amp;#039;&amp;#039; - Open a brief defensive state when the player presses a designated direction or guard control.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Charge actions&amp;#039;&amp;#039;&amp;#039; - Begin charging on a press, monitor the held state, and release the action when the control is released.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Input transformation&amp;#039;&amp;#039;&amp;#039; - Reverse directions, exchange buttons, create accessibility mappings, or synthesize multi-button shortcuts with InputAll.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Stage interaction&amp;#039;&amp;#039;&amp;#039; - Operate switches, vehicles, dialogue, or other level-specific systems from the level keyscript.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Shared interfaces&amp;#039;&amp;#039;&amp;#039; - Implement project-wide menus, move lists, debug controls, or shortcuts through Keyall.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Multiplayer coordination&amp;#039;&amp;#039;&amp;#039; - Inspect the supplied player slot and arbitrate shared interfaces without allowing one player&amp;#039;s input to interfere with another.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Input chords&amp;#039;&amp;#039;&amp;#039; - Detect simultaneous directions and buttons for throws, dodges, command attacks, or shortcuts.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Controls]]&lt;br /&gt;
* [[Player Property]]&lt;br /&gt;
* [[Controls#Command Input Sequence|Command Input Sequence]]&lt;br /&gt;
* [[Script Overview]]&lt;br /&gt;
* [[Animationscript]]&lt;br /&gt;
* [[Thinkscript]]&lt;br /&gt;
* [[Updateentityscript]]&lt;/div&gt;</summary>
		<author><name>Dcurrent</name></author>
	</entry>
</feed>