var name = "";var key;while(!(IsKeyPressed { render scene with the name flipscreen() key = GetKey(); // waits for a key if(key == KEY_ENTER) break; // finished if(key == KEY_BACKSPACE) // remove last character unless name.length == 0 else name += GetKeyString(key,IsKeyPressed(KEY_SHIFT))}And the end of the loop you have a name in the name variable. Roughly.
var Finish = false;var name = "";/////// Do your rendering of the name entry screen// flipscreen(); ///// // Process all key events // while(AreKeysLeft()){ var key = GetKey(); if(key == KEY_ENTER){ Finish = true; break; } if(key == KEY_BACKSPACE) name = name.substring(0, name.length-1); //This function is extremely forgiving. else name += GetKeyString(key,IsKeyPressed(KEY_SHIFT)); }}
font.drawText(lolX, lolY, name+((Math.floor(GetTime()/2000)%2)?"|":""));
I swear you guys are the best. It worked! Goodness me think of the game mechanics involving this!!!
function Input() { while(AreKeysLeft()) { var key = GetKey(); if (key == KEY_ENTER) show_menu(); if (key == KEY_ESCAPE) Exit(); }}