GMS 2 GMS2 keyboard_check ord not working (SOLVED)



Hello Everyone,

I'm new to Game Dev and I'm learning code and starting fresh as of yesterday.

I've been following the tutorials online and I'm stuck with the movement of my object.

I've watched the video and entered the code and it does work, however, I don't want traditional arrow keys to move my character.

I want to use WSAD as movement keys and have used the following code:

if (keyboard_check(ord('D')) x = x + 4;

I'm getting this compile error:

Object: obj_player Event: Step at line 1 : invalid token

If anyone can help explain why the code isn't working I'd be very grateful. I've checked online and read posts and found the ord code and just can't put my finger on it #feelinglikeapropernewb

Thanks guys!


GMS2 does not allow to use single-quoted strings for such - change ord('D') to ord("D") and it'll be fine.
Thank you so much for the help. I first off tried your suggestion and it didn't work...then I added 'then' after the keyboard check quotations mark, it worked...then i went back into the code, removed 'then' and it worked fine, as per your suggestion. Maybe it's still a little buggy as in beta :\

Thanks again buddy :)