Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Text input while still processing your loop.

Author
Message
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 1st May 2008 21:13 Edited at: 1st May 2008 21:18
I've been working on this for a little while perfecting it here and there. It's not the greatest, but it should fill the need for those that need to do other things while waiting for user input.

I created this because my network routine must continue to communicate with the server or the server times out the connection and drops the client. This allows me to accept input from the player and still keep communicating with the server.

You first call the Init subroutine to clear the variables. Then set your own parameters for where you want the input to be on screen, what you want the prompt to be, and whether or not this is a password entry field.



I also put a line in to check the ascii code of the input character so you can limit what the user can enter. Right now it's set to only allow the space, numbers, and upper and lower case letters.

Enjoy.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd May 2008 10:32 Edited at: 2nd May 2008 10:33
There's another method of getting input in a loop using the commands entry$() and clear entry buffer().

This way, you can also allow continuous pressing on one key (like pressing 3seconds on a would give aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa), which would be handy when using the backspace.



It's just the most basic form of input. There's no such thing as max characters added, or displaying *s though it shouldn't be too hard for someone on your sill level.

Greets,
Sven B

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 2nd May 2008 19:20
I actually started this with entry$(1) but it didn't have the control that I was looking for.

With this I can still allow the keys to repeat with just a small change, but didn't want that at the moment.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 3rd May 2008 15:59
Okay nevermind me then.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.

Login to post a reply

Server time is: 2024-11-25 02:43:18
Your offset time is: 2024-11-25 02:43:18