UWP get_string dosnt work under windows 10 universal platform

Z

ZeeSvk

Guest
I have a problem

I want the players to be able to give there name. So I made a name button and there I set a time when you hold your mouse button over it for 5 seconds it prompts you to give your name.

Now this works in Windows Native and Android (I cant test Mac, Linux and IOS).

But it dosnt work under Windows 10 Universal on x86 (PC) and ARM (Phone),
all I get is an empty field, and no type interface.

Is there a way to fix this, or at the very least set it so if there is nothing, it sets the default string?
Thanks in advance.

Code:
if (Time == 180)
{
    while(1)
    {
        global.txt_P1Name = get_string("Enter Player Name:", "Player 1");
     
        if (string_length(global.txt_P1Name) <= 25)
        {
            break;
        }
        else
        {
            show_message("Name entered is too long!");
        }          
    }
    Time = 0;
    scr_save_settings();
}
 
T

The5thElement

Guest
That seems to be an issue you should report to the creators of GM:S.

However instead of using the get_string function I suggest using the keyboard_string variable to collect user input. It requires some
work and a gui for a textbox to display the user input. This method in my opinion makes a game cleaner than having a windows dialog
popping up. As this can make a fullscreen game return to windowed mode.

I can create a sample object for you if you'd like but in the mean time check out the keyboard constants and functions in the help
document.
 
Last edited by a moderator:
Z

ZeeSvk

Guest
I have created the example textbox object. You can download it and see how it works.
Download
I looked at your code and it inspired me :) Thank you

Create:
Code:
NameEntery = false;
Cursor = "";
InputLength = 22;
MinLength = 3;
Step:
Code:
if (NameEntery == true)
{
    Cursor = "|";
    if(string_length(keyboard_string) < InputLength)
    {
        global.txt_P1Name = string_copy(keyboard_string, 1, InputLength);
    }
   
    if (keyboard_check_pressed(vk_enter))
    or (device_mouse_check_button_pressed(0, MouseLeft))
    {
        if(string_length(keyboard_string) < MinLength)
        {
            global.txt_P1Name = "Player 1";
        }
       
        NameEntery = false;
        scr_save_settings();
    }
}
else
{
Cursor = "";
}
Draw:
Code:
if (NameEntery == true)
{
    draw_set_colour(c_black);
    draw_set_alpha(0.5);
    draw_rectangle(0, 0, room_width, room_height, 0);
    draw_set_alpha(1.0);
   
    draw_set_colour(c_white);
    draw_text(x, y, global.txt_P1Name + Cursor);
}
this works on Windows native and Windows 10 Universal
still need to test it on Windows 10 Phone and Android but it allready looks a lot nicer. thank you.

Still fine tuning it :)
 
Top