• 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_key_press() works for some programs but not lackeyccg

D

dengar

Guest
short story- im trying to use keyboard_key_press() to input commands to lackeyccg but nothing happens. it works perfect for notepad and google and everything else ive tested but not for lackeyccg.

to test it I have keyboard_key_press() on an alarm so it just repeats itself, ive also tried using keyboard_key_release() with it and it behaves the same.

long story- I have an arduino with an rfid reader connected to gamemaker through an extension with a rfid tag in a card sleeve. scan the card, arduino sends the tag id to gamemaker which I want to type the command "/spawn cardname" in lackey to play that card. everything works sofar except the part between gamemaker and lackey.

is there something about keyboard_key_press()? or is there an extension thatd do it better, im open to any suggestions, ive spent the last few days googling everything I can about this and I cant come up with anything.

im using gm studio 1.4
 

FrostyCat

Redemption Seeker
keyboard_key_press() and keyboard_key_release() only simulate the keystroke within the GM runner, they don't send out real ones like AutoHotkey does.

Redacted: Actually they do send keystrokes on GMS 2.2.5.
 
Last edited:
D

dengar

Guest
keyboard_key_press() and keyboard_key_release() only simulate the keystroke within the GM runner, they don't send out real ones like AutoHotkey does.
if that's true then why does it work in notepad and google search engine?
I know your an experienced coder with years of experience so heres the code, run it and then open notepad. unless they removed it for you gamemaker studio2 boys. which would be a shame.
GML:
///create event
alarm[0]=200;

///alarm[0] event
keyboard_key_press(ord('P'));
alarm[0]=30;
I searched the manual for your suggestion of "AutoHotkey" but I don't see it, is it an extension? do you have a link?
 

FrostyCat

Redemption Seeker
So the keystrokes actually do make it across programs. Neat.

AutoHotkey is a separate program designed explicitly for tasks like what you described. If your goal is to just automate another program, GM is probably not the right tool for it.

Also, have you checked whether the input focus is on the right field when you noticed it isn't going through to the target program? Or did the GM side lose focus or get paused?
 
D

dengar

Guest
Also, have you checked whether the input focus is on the right field when you noticed it isn't going through to the target program? Or did the GM side lose focus or get paused?
I thought about that also, but I do it the same way I did with notepad and I even put a show_message("key press"); just to make sure it didn't pause or anything. and everything seems to be working correct, just the letters don't popup like they do in notepad and other programs.

and asfor gamemaker not being the right program for this, your probably right but most of my experience is with gamemaker and I haven't found anything that gamemaker cant do with the right extension so I don't wanna give up on it.
 
Top