Jump to content


Photo

Event_perform


  • Please log in to reply
4 replies to this topic

#1 Baby_Yoda

Baby_Yoda

    GMC Member

  • New Member
  • 273 posts

Posted 21 July 2008 - 04:04 PM

Hi
I'm using "event_perform"
event_perform(ev_keyboard,ev_keypress#)
So now I need it to press digit 2 (not keypad), but how do I do that ?
I have to change the # into something, but I don't know what
Please help ^^
Thanks -_-
  • 0

#2 th3_cr3at0r

th3_cr3at0r

    GMC Member

  • New Member
  • 38 posts

Posted 21 July 2008 - 04:08 PM

don't ya just put in like 2?
  • 0

#3 Mnementh

Mnementh

    15151

  • Retired Staff
  • 6263 posts
  • Version:GM:Studio

Posted 21 July 2008 - 04:09 PM

For the digit keys use for example ord('5') to get the <5> key.


  • 0

#4 Baby_Yoda

Baby_Yoda

    GMC Member

  • New Member
  • 273 posts

Posted 21 July 2008 - 04:23 PM

For the digit keys use for example ord('5') to get the <5> key.

Thanks ^^

Now next question.
This code only seems to work for the objects in my game itself...
I kinda need it also to work for other programs. So that windows actually thinks that button is being pressed. Is this possible ? If so, what code should I use ?

Greets
  • 0

#5 GStick

GStick

    All Secrets Exposed

  • GMC Member
  • 1633 posts
  • Version:GM:Studio

Posted 21 July 2008 - 04:31 PM

The following routines can be used to manipulate the keyboard state:


keyboard_get_numlock() Returns whether the numlock is set.
keyboard_set_numlock(on) Sets (true) or unsets (false) the numlock.
keyboard_key_press(key) Simulates a press of the key with the indicated keycode.
keyboard_key_release(key) Simulates a release of the key with the indicated keycode.


It would probably be best to always simulate in a press, hold, release manner, just as the keyboard always has to do to get to release. If that makes sense.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users