• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Keyboard_string and menu

E

egor chernyshev

Guest
Gamemaker 1 question : I have a menu in the game and my controls are ord("W") to go up and ord("S") to go down .
But in the next room I have field for player to enter their name , this field is entered through keyboard_string but when I navigate through menu , letters wwww and sss are in the field and it is very annoying to delete them every time , I want keyboard_string to only be registred in the room.
Thank you in advance


Code:
global.txt="";
global.txt = keyboard_string;

var move = 0;
move -= max(keyboard_check_pressed(vk_up),0 );
move+= max(keyboard_check_pressed(vk_down),0 );
 

chamaeleon

Member
Gamemaker 1 question : I have a menu in the game and my controls are ord("W") to go up and ord("S") to go down .
But in the next room I have field for player to enter their name , this field is entered through keyboard_string but when I navigate through menu , letters wwww and sss are in the field and it is very annoying to delete them every time , I want keyboard_string to only be registred in the room.
Thank you in advance

Code:
global.txt="";[/B]
[B]global.txt = keyboard_string;

var move = 0;
move -= max(keyboard_check_pressed(vk_up),0 );
move+= max(keyboard_check_pressed(vk_down),0 );
Just do the following in any suitable event (create, room start, whatever) upon entering the next room or when displaying the menu. The keyboard_string is writable as well, so you can clear it whenever is convenient.
Code:
keyboard_string = "";
 
Top