Dr_Nomz
Member
I tried using get_string_async to return a variable but it wouldn't work, it would just throw an error about a map not existing even though the manual says that's how it works.
And my code looked something like this:
Basically what I want is for it to take the player's input (a number) and return that value, making the local value of "page" equal to whatever the string was. Also could I make it ONLY accept numbers? That would be great. Especially if I could only have it accept numbers to a certain point, so it doesn't go over or under the page limit.
Code:
msg = get_string_async("What's your name?","Anon");
The above will show a message requesting that the user input a string and press "Okay". The function id is stored in the variable "msg" and will be used in the asynchronous Dialogs event as shown below:
var i_d = ds_map_find_value(async_load, "id");
if i_d == msg
{
if ds_map_find_value(async_load, "status")
{
if ds_map_find_value(async_load, "result") != ""
{
global.Name = ds_map_find_value(async_load, "result");
}
}
}
Code:
if(point_in_rectangle(mouse_x,mouse_y,xx+50,yy+50,xx+200,yy+200)){
draw_set_color(rectangle_color);
draw_rectangle(xx+50,yy+50,xx+200,yy+200,false);
if(mouse_check_button_pressed(mb_left)){
msg = get_string_async("Enter page number.","1");
var i_d = ds_map_find_value(async_load, "id");
if i_d == msg{
if ds_map_find_value(async_load, "status"){
if ds_map_find_value(async_load, "result") != "" {
page = ds_map_find_value(async_load, "result");
}
}
}
}
}