http://agiwiki.sierrahelp.com//index.php?title=Get.num&feed=atom&action=historyGet.num - Revision history2024-03-28T15:45:35ZRevision history for this page on the wikiMediaWiki 1.35.9http://agiwiki.sierrahelp.com//index.php?title=Get.num&diff=12141&oldid=prevAndrew Korson: Created page with "The '''get.num''' command prompts the player to enter a number. == Syntax == get.num(msg mPROMPT, var vB);<br /> get.num("prompt", var..."2019-04-02T02:00:07Z<p>Created page with "The '''get.num''' command prompts the player to enter a number. == Syntax == get.num(<a href="/index.php/Message" title="Message">msg</a> mPROMPT, <a href="/index.php/Variable" title="Variable">var</a> vB);<br /> get.num("prompt", <a href="/index.php/Variable" title="Variable">var</a>..."</p>
<p><b>New page</b></p><div>The '''get.num''' command prompts the player to enter a number.<br />
<br />
== Syntax ==<br />
<br />
get.num([[message|msg]] mPROMPT, [[variable|var]] vB);<br /><br />
get.num("prompt", [[variable|var]] vB);<br />
<br />
== Remarks ==<br />
<br />
Unlike the '''[[get.string]]''' command which allows customizing the input location, the '''get.num''' function uses the [[input line]], substituting the [[message]] '''mPROMPT''' as the [[input prompt]] and using the existing [[cursor]] character. Input is limited to three characters. <br />
<br />
When the player presses the ENTER key, the input is converted to an integer value. Leading spaces are ignored. Characters are processed until the first non-numeric character is found. For example, "1a2" will be converted to 1. If a value greater than 255 is entered, only the lower eight bits of the number are used (i.e. vB = inputval MOD 256).<br />
<br />
If the player presses the ESC key, vB is set to 0.<br />
<br />
When running on a system using the Hercules Graphics Card (HGC), the '''get.num''' command uses an input box similar to the normal [[HGC input box]]. The '''[[open.dialogue]]''' command will cause the '''get.num''' command to operate the same as on other systems, as described above.<br />
<br />
== Possible Errors ==<br />
<br />
If input is currently disabled (by using the '''[[prevent.input]]''' command, '''get.num''' will still use the input line and get a number, but the input line will not be cleared from the screen afterward. The text will stay displayed on the input line until input is re-enabled (using the '''[[accept.input]]''' command) or the screen is redrawn by encountering a '''[[new.room]]''' command or '''[[graphics]]''' command.<br />
<br />
== Example ==<br />
<br />
<div class="CodeBlockHeader">Code:</div><br />
<syntaxhighlight lang="agi"><br />
'''get.num("Enter your age: ", v99);'''<br />
</syntaxhighlight><br />
<br />
== Technical Information ==<br />
<br />
{| border="1" cellpadding="2"<br />
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''<br />
| width="175" | Available in all AGI versions.<br />
|-<br />
| style="background-color: #efefef" | '''Byte-Code Value:'''<br />
| 118 (0x76 hex)<br />
|}<br />
<br />
== See Also ==<br />
<br />
'''[[get.string]]'''<br /><br />
'''[[close.dialogue]]'''<br /><br />
'''[[open.dialogue]]'''<br /><br />
[[Category:Commands]]<br /></div>Andrew Korson