Log In  

Cart #phoneinput-0 | 2022-10-29 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

(v00 10-28-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type: load #phoneinput

Hello there !

To try out the code above, use the arrow keys to navigate, the 🅾️ key to select a character and the ❎ key to erase it. For a real challenge try typing out, "NEIGHBOR" as quickly as you can.

Since it may be a-while for Pico-8 to have its own onboard keyboard to let you type in your name for games and stuff, I was thinking of the marvel of a touch-tone telephone and how you can type in a name for instance for speed-dial.

Well it's pretty nifty what it does. On my own real phone for instance:

You can see the digits yet you can also see some smaller letters. For instance if you wanted to type out, "DIRK" for Dirk The Daring, then on this keypad you would press: 3 444 777 55

I liked how simple this was so I made my own. Above it functions just the same way except instead of blending the digits with the letters I gave the digits their own row above and the zero is just after the Z seen just above the CR key.

It's also interesting in that if you want to repeat a letter. Let's say the T in BATTER, then you would select the T and then not press anything. After a short pause it will be typed then you can type it in again.

If you don't want to wait for the key to be typed, pressing any arrow key to go to the next selection automatically makes your choice character the one to choose and adds it without delay to your message string.

In this you can rapidly enter text and even digits for your input. And I did not set a length. You can have the input as long as you like, it will intelligently scroll it for you.

Unlike other Pico-8 functions, however, this one will FREEZE your main code (except playing music which continues) while only my function works - and continues to do so until you select the text you want. Then your program will resume as normal with the results of the function.

This makes it a lot easier to call and not have to worry about the rest of your code running alongside it.

It also records the screen contents so you don't need to redraw after calling it and at no cost to either programming memory or extended.

I like this function and will be using it for future projects with a possible change to adding keys that they may be accessed much the same way where you press one key 2- 3- or 4- times in a row to get the extra keys attached you need.

I can add sound too if you want. Little clicks and stuff when you navigate and select. Those are some minor details, though.

For now this function works great as is. It is 414-tokens or 918-typed characters at 14-lines of code. You can copy/paste it in your own code and you don't need to press CTRL+P first either. It just uses normal text characters.

function phoneinput(t)

If this helps you in your code, please let me know !

P#119801 2022-10-29 00:18 ( Edited 2022-12-07 17:09)

neighbor% speedruns?

P#119806 2022-10-29 02:33

Hi @copperTones:

Ahh - no I probably don't need speedruns for that. I mean, knock yourself out if you want. :)

I just chose "Neighbor" as a word to test because it uses the full flux of the system.

Where you type a letter, jump to another letter, press the same button multiple times, wait out to type a different or same letter from the same button and get 2- or more letters.

It sounds like a bit much but it's really quite simple once you get the knack.

P#119807 2022-10-29 02:38 ( Edited 2022-10-29 03:12)
1

Funnily enough, this actually helped me understand how the letters on number pads work.

P#119874 2022-10-30 20:07

GRIN Well there ya go, @RicketyHalo. Glad to help. And yep back in the day before cellphones, you could still enter people's names on home phones this way.

P#119881 2022-10-30 21:38

I always wondered why T9 input is never an option when dealing with devices without a touch screen. It's so much faster than using a virtual keyboard with a D-pad, even without the prediction part for words that phones used. Great implementation!

P#124453 2023-01-17 06:05

Thank you, @IsaacHeron. It's an easy way to enter text for now.

Truly a pull-down keyboard, @zep, perhaps enabled with extcmd("pulldownkeyboard") and extcmd("pullupkeyboard") would not be remiss.

It could cover vertically pixels 64-127 while leaving vertical pixels 0-63 untouched, and also include a button to swap locations on the screen.

P#124517 2023-01-18 18:08

[Please log in to post a comment]