Difference between revisions of "Prevent.input"

From AGI Wiki
Jump to navigationJump to search
(Created page with "The '''prevent.input''' command hides the input prompt and prevents the player from entering input. <code>prevent.input();</code> After a call to <code>prevent.input</code>,...")
 
 
Line 1: Line 1:
The '''prevent.input''' command hides the input prompt and prevents the player from entering input.
+
The '''prevent.input''' command hides the input prompt and prevents the player from entering keyboard input on the input line.
  
<code>prevent.input();</code>
+
== Syntax ==
  
After a call to <code>prevent.input</code>, any text that the player enters is ignored. Note that this command has no effect on [[Controller|controllers]]. To show the input prompt again and allow user input, use the [[accept.input]] command.
+
prevent.input();
  
&nbsp;
+
== Remarks ==
  
&nbsp;
+
If there is any text on the [[input line]], it remains there even when the input line gets hidden. Even though the input line is hidden, key presses will still be converted to [[controllers]], and [[reserved variable]] [[v19 (pressed key code)]] is still updated every time a key is pressed.
== Parameter ==
+
Use the '''[[accept.input]]''' command to restore the input prompt.
  
This command does not take any parameters.
+
== Possible Errors ==
  
&nbsp;
+
None.
== Possible errors ==
 
  
None known.
 
 
&nbsp;
 
 
== Example ==
 
== Example ==
 
The following code will prevent the user from entering any input while [[ego]] is moving across the screen. Note that re-enabling user input after the <code>[[move.obj]]</code> command is complete is not shown here.
 
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="agi">
 
<syntaxhighlight lang="agi">
if (said("walk"))
+
prevent.input();
{
+
[ input prompt is hidden, and player cannot enter text input
  prevent.input();
+
...
  move.obj(ego, 100, 120, 1, f200);
+
accept.input();
}
+
[ input prompt is restored/redisplayed, including any text
 +
[ that was on it when it was hidden
 
</syntaxhighlight>
 
</syntaxhighlight>
  
&nbsp;
+
== Technical Information ==
== See Also ==
 
 
 
* [[accept.input]]
 
* [[move.obj]]
 
* [[said]]
 
  
&nbsp;
+
{| border="1" cellpadding="2"
== Sources ==
+
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''
 +
| width="175" | Available in all AGI versions.
 +
|-
 +
| style="background-color: #efefef" | '''Byte-Code Value:'''
 +
| 119 (0x77 hex)
 +
|}
  
Some of the text in the article is taken from the AGI Studio help file.
+
== See Also ==
 
 
&nbsp;
 
  
[[Category:Logic Commands]]
+
[[System Commands]]<br />
[[Category:System Commands]]
+
'''[[accept.input]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 20:03, 17 April 2019

The prevent.input command hides the input prompt and prevents the player from entering keyboard input on the input line.

Syntax

prevent.input();

Remarks

If there is any text on the input line, it remains there even when the input line gets hidden. Even though the input line is hidden, key presses will still be converted to controllers, and reserved variable v19 (pressed key code) is still updated every time a key is pressed. Use the accept.input command to restore the input prompt.

Possible Errors

None.

Example

Code:
prevent.input();
[ input prompt is hidden, and player cannot enter text input 
...
accept.input();
[ input prompt is restored/redisplayed, including any text
[ that was on it when it was hidden

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 119 (0x77 hex)

See Also

System Commands
accept.input