# Input number

The `input_number` command allows the player to input a number into a field.\
`input_number` 命令允许玩家在字段中输入一个数字。

It works the same way as [`input_text`](https://choicescriptdev.fandom.com/wiki/Input_text), with two major differences:\
其工作方式与 [`input_text`](https://choicescriptdev.fandom.com/wiki/Input_text) 相同，但有两大区别：

* the player is only allowed to input numeric characters when writing the command,\
  玩家只能输入数字字符，并且在编写命令时，
* it's not enough to specify a variable; you have to specify a minimum and maximum number so that the player can't write a number smaller than the minimum one or higher than the maximum one you specify\
  仅指定变量是不够的；你必须指定一个最小值和最大值，这样玩家就无法输入小于你指定的最小值或大于最大值的数字

## Usage

In order to use this command, you must [`create`](https://choicescriptdev.fandom.com/wiki/Create) a variable in [`startup.txt`](https://choicescriptdev.fandom.com/wiki/Startup.txt) (or create a [`temp`](https://choicescriptdev.fandom.com/wiki/Temp) (temporary) variable in the [`scene`](https://choicescriptdev.fandom.com/wiki/Scenes) file) to be modified by the player's input.\
为了使用此命令，你必须在 startup.txt 中 \*创建一个变量（或在场景文件中创建一个 \*temp（临时）变量），以便由玩家的输入来修改。

```
*temp coins 0

How many gold coins do you have?

*input_number coins 50 100
```

In this example, the player may input a certain number of "coins", which modifies the "coin" variable. The game will only allow the player to input a number between 50 and 100.\
在这个例子中，玩家可以输入一定数量的“硬币”，这会修改“硬币”变量。游戏将只允许玩家输入一个介于50到100之间的数字。

## Known input\_number Bug

Note that there is a known `input_number` related game-stopping bug when playing a ChoiceScript game using Microsoft's *Internet Explorer*. It does not occur in any other browsers, and there is no known workaround.\
请注意，在使用微软的Internet Explorer玩ChoiceScript游戏时，存在一个已知的`input_number`相关的游戏停止错误。该错误在任何其他浏览器中都不会发生，并且目前没有已知的解决方法。（王洛木：真的还有人在用 IE 浏览器么……）


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://raster.gitbook.io/zh-hans_choicescript-guide/input-number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
