• Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Writing strings in-game

NNNIKKI

Member
In my game, I want to be able to write strings via keyboard input in-game. I tried to do this.
In the object that is the textbox, I have 3 events:
-Left Pressed event:
global.textselect = id;

-Step event
if (global.textselect != id) || (string_length(global.title) > 14) exit;
if (keyboard_check_pressed(ord("Q"))) string_insert("Q",global.title,string_length(global.title));

-Draw event
draw_self();
draw_set_color(c_black);
draw_set_font(font2);
draw_text(x-96,y-16,global.title);

This is what is in the initializing event (room creation code in the initialize room)
global.title = "";
global.textselect = noone;

For some reason, nothing is happening. Why?
 

NNNIKKI

Member
Nvm. I just realized that I need to write:
global.title = insert_string(blablabla);
I hope that this helps somebody!
 
Top