Hi all,
This is my first time script I post hope you might find it useful. I use this for my game project because DBPro entry()$ command only works for string letters which is good, but no option to keyboard typing only numbers.
Please realised that I do not have Caps Lock and NumLock checking if they are active or not, which means that assuming Caps Lock always off and NumLock always on.
Also I did not use entry$() command either.
I tested on DBPro 1.68.
This code needs "Bmp Font Tutorial" Script to run.
Functions I've got so far:
---------------------------------------------------------------
create_input_textbox(index, pos_x, pos_y, input_type, max_text)
Description: To create a new input_textbox, index can also be negative value too...)
index = input_textbox_number
pos_x = X position of input_textbox
pos_y = Y position of input_textbox
input_type = (0 = letter and numbers input, 1 = only numbers)
max_text = number of characters in the textbox
--------------------------------------------------------------
remove_input_text(index)
Description: To remove input_textbox
-------------------------------------------------------------
active_input_textbox(index)
Description: choose input_textbox index to active, so other input_textbox are not active when typing letters
--------------------------------------------------------------
input_textbox_exist(index)
Description: find that if input_textbox of that index exists
Return: 1 or 0
--------------------------------------------------------------
get_input_textbox(index)
Description: Get the strings results in the input_textbox
Return: current strings in input_textbox
--------------------------------------------------------------
update_input_textbox()
Description: update state of the input_textbox, put it on top of 'sync'
Of course if you think you can make the code much cleaner and much concise, you are welcome to post your snippet here because i am not a superior coder after all and this will benefit for everyone.
Update 18/08/2008:
---------------------------
- I have fixed the code that cause of error array index out of bound
- I make code much cleaner thanks to WindowsKiller.
- Now the input_textbox has maximum number of letters in the textbox
- I modified the "BMP Font Tutorial" script that set the spacebar to display "Size / 8" instead of "Size", set both sprite and images index start at 5500 instead of 255, and set the sprites priority to 99
- Lastly I have upload examples.
http://lianjoon.tripod.com