Getting Numpad in case of keyboard for mobile game

Hi there to all of Tumult users,
i´m just preparing a game for mobile devices and
would like to start an input with numeric keypad instead of
regular keyboard.
Player A is typing a specific number to get to an specific scene and from there so on…
This all works fine, but i like to show a Numbpad on the beginning instead of full keyboard.
Anyone there with an idea?
I will attache my project to show what´s working
i.e. first input is: 123456 then hit the green button


Achim (2.3 MB)

Here’s how to set that up:

Hi Daniel,
getting a number pad to show up isn´t the problem for me, but giving the input field an ID what works
for listening and directing to the correct scene, this is, what i´m looking for.
See attached pics…this works with regular keyboard…

The textarea code looks bad; notice there are two opening tags with the second looking like a property?

Regardless, in the link above the method to bring up the numeric keyboard on iOS is to use an <input> tag with a type of number and/or a pattern restricting it. Here’s a stack overflow answer with a simple version of the field.

Hi Jonathan,
yeah you´re right…bad hack, however (but works;-))
I have 15 different scenes which will be shown up by putting
in the right number(s)
i.e. 123456 is scene 1, 234567 is scene 2 and so on.
The script i´m using now (textarea) is listening to textarea input and directing to the
correct scene.
The only problem is to show up a numpad instead of a regular keypad.
So i guess there must be a numpad ID instead of “var inputText = document.getElementById(‘myTextarea’).value”;
unfortunately the app is running on android devices;-(
Getting the NumPad to appear ist not the problem, but
giving it a unique ID for the “check” script is, what i´m looking for

Cheers to all of you

I did some brief searching online, and it looks like there are some methods but they have caveats. I didn’t see a definitive answer listing everything, but if you search on google for something like “android html number pad” you’ll find some amount of answers and hacks to get it to show.

Not sure if this would work. But have you considered using a normal input with type number.

<input type="number" min="1" >

And styling it with css.

1 Like

thank´s to both of you, i will come back later and tell you what i have tried.

Other solution: You could just avoid the keyboard entirely and create an in game “keypad” of your own design. Avoiding clunky input fields…

If you need a starting point for one possible approach check out this older thread from @MarkHunte

If you need something other, probably just start from scratch after being inspired.

1 Like