Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Holding down a Key?
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Holding down a Key?

Started by Dralel, March 03, 2009, 10:56:34 PM

0 Members and 1 Guest are viewing this topic.

Dralel

Hello

How do I make it so that you got to hold down a key to do a certain action?
Like hold the SHIFT key, then press UP to look up, or press RIGHT to look right.

Help please.
Thanks!
==-+-==ACTIVE PROJECT==-+-==
          Kingdom of Warfare I

slashphoenix

Don't know if this works, but have the SHIFT key set a variable to 7, then run a loop and use conditional branches to constantly check if that variable is 7. Then, within the branch, have more key inputs for up, down, whatever.


Dralel

Quote from: slashphoenix on March 03, 2009, 11:35:11 PM
Don't know if this works, but have the SHIFT key set a variable to 7, then run a loop and use conditional branches to constantly check if that variable is 7. Then, within the branch, have more key inputs for up, down, whatever.



Sorry, tried that.

Thanks for replying though! XD
==-+-==ACTIVE PROJECT==-+-==
          Kingdom of Warfare I

madriel222

You'll have to tweak this to meet your needs, but this is the gist of it.


:Loop
     :Variable Operation: Set [BUTTON PRESS] to 0
     :Wait 0.1 Seconds
     :Key Input to [BUTTON PRESS]
     :Branch if Var [BUTTON PRESS] is 1 or more
          :Branch if Switch [PAUSE] is OFF
               :Switch Operation [PAUSE] ON
               :Variable Operation: Set [BUTTON PRESS] to 0
               :Wait 0.1 Seconds
               :Key Input to [BUTTON PRESS]
           :End
           :Jump to Label 1
     :End
     :Key Input to [BUTTON PRESS]
     :Switch Operation [PAUSE] ON
     :Label 1
REST OF YOUR CODE


The wait times above are completely arbitrary, but generally make the system run smoother.  Now, all this little script does is check if a button is held down.  It'll take work on your part to integrate into your system.  You want to check for another button being pressed?  That's going to take more Key Input Processing, but make sure that you're sending the information to a variable other than the one you used here.

Hope that helps, good luck ^_^