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] Simple Input-Functions

Author
Message
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 19th Jun 2007 16:15
I was bored again and wrote some quite small and simple functions for user-text-inputs. It's more flexible than the dbp input-command, but also a bit more complex.. but I think it isn't complicated.

Functions:
-inp_Start *No parameters* [Has to be called before the other functions can be used]
-inp_New *No parameters* [Clears the input-string and resets other important variables]
-inp_Update *No parameters* [Must be called to update the inputs]
-inp_Done(*No parameters*) = bool [Returns '1', if returnkey is pressed, and wasn't pressed before]
-inp_SetInput strText [Changes the input to strText, and updates variables]
-inp_SetInputToString *No parameters* [Strings with all supported ascii-characters can be written]
-inp_SetInputToInteger *No parameters* [Only numbers from 0 to 9 can be written]
-inp_GetInput$(*No parameters*) = str [Returns the input-string]
-inp_GetLen(*No parameters*) = int [Returns the length of the input-string]
-inp_GetEntry$(*No parameters*) = chr [Returns the actual windows-entry-character]
-inp_StrToInt(strText) = str [Unimportant for you, deletes all not-numbers from a string]

Code with 2 examples:



Functions only:



It's a bit buggy in some parts, e.g. pasting the clipboard, or controlling the maximum string-length, but I think, it could maybe help a few people (I think it's still often asked, how to do something while the input-command is active..).

As always: use it, change it, destroy it, call it stupid names (but maybe don't post them here..), whatever. Have fun and thanks.

Visit the DBPro - Speed up your game-Thread. http://forum.thegamecreators.com/?m=forum_view&t=88661&b=1

Login to post a reply

Server time is: 2024-11-22 18:49:46
Your offset time is: 2024-11-22 18:49:46