Jump to content


Photo

Key board check direct released


  • Please log in to reply
3 replies to this topic

#1 master123

master123

    GMC Member

  • GMC Member
  • 57 posts
  • Version:GM8

Posted 02 July 2012 - 04:37 AM

Is there a way to use the "keyboard_check_direct();" to check if a key is released

I am making something that records a voice while a key is pressed and stops when the key is released.

It works using game maker's in built commands to check pressed and released but I want to do this outside of gm.......
  • 0

#2 ZyklonMiraj

ZyklonMiraj

    GMC Member

  • GMC Member
  • 160 posts
  • Version:Unknown

Posted 02 July 2012 - 04:48 AM

ok do this
if press=1
{
if keyboard_check_direct(ord('A')
.
.
.
}

if !keyboard_check_direct(ord('A') and ....//code 1(for down explanation)
{
a=1
}
else
a=0
you have to intialize a,and this will not work if multiple keys are pressed at once,also,if your needed keys are A,B,C,D
you have to wirite them all in code 1.so if A,B C are the required keys,do this
if !keyboard_check_direct(ord('A') and !keyboard_check_direct(ord('B') and !keyboard_check_direct(ord('C'))
for some reason,i feel you are making a keylogger.

Edited by ZyklonMiraj, 02 July 2012 - 04:50 AM.

  • 0

#3 master123

master123

    GMC Member

  • GMC Member
  • 57 posts
  • Version:GM8

Posted 02 July 2012 - 06:10 AM

ok do this

if press=1
{
if keyboard_check_direct(ord('A')
.
.
.
}

if !keyboard_check_direct(ord('A') and ....//code 1(for down explanation)
{
a=1
}
else
a=0
you have to intialize a,and this will not work if multiple keys are pressed at once,also,if your needed keys are A,B,C,D
you have to wirite them all in code 1.so if A,B C are the required keys,do this
if !keyboard_check_direct(ord('A') and !keyboard_check_direct(ord('B') and !keyboard_check_direct(ord('C'))
for some reason,i feel you are making a keylogger.


Thanks, but where do you put the code for pressed and released to be executed?

Also will this code work when a key is being hold and released?
  • 0

#4 ZyklonMiraj

ZyklonMiraj

    GMC Member

  • GMC Member
  • 160 posts
  • Version:Unknown

Posted 02 July 2012 - 09:10 AM

Step Event of any object.This code will only work with one key pressed at a time,if multiple keys are pressed,it will only read one.

Edited by ZyklonMiraj, 02 July 2012 - 09:11 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users