(Game Maker 6.1, 7)

get_integer - get a number from the user using a pop-up window


num get_integer ( str, def )

  • num = returned integer
  • str = message displayed, as string
  • def = default number

When get_integer, is executed, a message box pops up with an input field, asking for a number. str is the message that the message box will display, and def is the default number shown in the field, ready to be changed. If there is no change to the input field, or nothing is entered, get_integer() will return the default number.


Example of Use

age = get_integer("How old are you?",5);

In this example, get_integer() is used to ask the user his/her age.

Calculator Example

An example of a calculator using get_integer()

integer1 = get_integer("What is the first number?",0);
integer2 = get_integer("What is the second number?",0);
integer1 += integer2
show_message("The sum is: "+string(integer1))

Useful Info

  • Most players find the pop-up window created by get_integer() to be extremely annoying.

Related Pages

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.