I would store the keys and times as two ds_lists.
Create an object and call it keyLogger (or whatever). In the create event, create two lists:
keyCodes = ds_list_create();
keyTimes = ds_list_create();
frame = 0;
Then, in the step event, you can log the keys and advance time.
if(keyboard_check_pressed(vk_anykey))
{
ds_list_add(keyCodes, keyboard_key);
ds_list_add(keyTimes, frame);
}
frame += 1;
You can then draw all the keys in the draw event.
var i, s;
for(i = 0; i < ds_list_size(keyCodes); i += 1)
{
s = "At frame ";
s += string(ds_list_find_value(keyTimes, i));
s += " you pressed key ";
s += chr(ds_list_find_value(keyCodes, i));
s += " (Code: ";
s += string(ds_list_find_value(keyCodes, i));
s += ")."
draw_text(4, 4+i*20, s);
}
All you need to do is put this object in any room that you want to log keys in.
It should give an output that looks like this:
At frame 159 you pressed key F (Code: 14).
At frame 232 you pressed key 7 (Code: 95).