1

I am trying to ask the user for a name to put into my highscore table.

I do not want to use get_string_async because then it adds a the name and score before the user has even given a name, however get_string does not work because it is deprecated.

name = get_string("Game Over. What is your name?","Player");
highscore_add(name,score);
global.highscore == 1; //tells draw event to draw highscore table.

Is there an alternative to get_string that waits for input before continuing through the code?

Jojo197
  • 15
  • 5
  • I thought I would have made use of the KeyUp event, but I don't think that works well for every single key. – Steven Nov 02 '18 at 13:54
  • Don't user `get_string` or `get_string_async`, it's for debug only. Go to Marketplace and get any free GUI or textbox (text input) and use it. – Dmi7ry Nov 02 '18 at 16:59
  • I am a sub account as part of my school, and I can't buy assets. – Jojo197 Nov 03 '18 at 00:30
  • The Key event idea could work. I could use a KeyDown any, then add that key to a string. Then add the string to the highscore table when the user presses Enter. The only thing is i'm not sure if there is a way to find the string value of the key that is pressed. Edit: I can use keyboard_string to do this. – Jojo197 Nov 03 '18 at 00:43

1 Answers1

1

If you want the player to type in their own name, try setting something up where, when you first start typing it does

you can put this into a script, and say:

name = scr_get_name();


//Inside of "scr_get_name()"
keyboard_string = 0;
if(player_typing){
    if(keyboard_check_pressed(vk_enter)){
        name = keyboard_string;
        return(name);
    }
}
King Duck
  • 106
  • 2
  • 9