News: The Storyline Service! Get your inspiration and support here!

Pages: [1] 2  All
  Print  
Author Topic: [XP][VX] Key Simulator  (Read 3784 times)
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1840


Stopped using RMXP (until furthur notice).


View Profile WWW
« on: December 11, 2008, 07:55:28 PM »

Key Simulator
Authors: Fantasist
Version: 0.1
Type: Low-level Functionality Addon
Key Term: Game Utility

Introduction

This script can simulate the pressing of the keyboard and mouse keys. You can use this, for example, to switch to fullscreen by simulating the ALT and ENTER keys.

Features

  • Simulates the most common keyboard and mouse keys.
  • More of a development tool than a script.

Screenshots

n/a

Demo

Place this piece of code just below this script and you're game goes fullscreen on start. If you still want a demo, I'll put it up, but remember, respect my laziness Angel
(click to show/hide)

Script

Place it in the very first slot. If you don't like that, you can paste this virtually anywhere before main.
(click to show/hide)

Instructions

This script can simulate most of the common keyboard and mouse presses. You can simulate three things:
"key down" (press), "key up" (release) and "trigger key" (press and release). The syntaxes respectively are:
Code:
VK.down(VIRTUAL_KEY)
VK.up(VIRTUAL_KEY)
VK.trigger(VIRTUAL_KEY)
where VIRTUAL_KEY is the constant representing the required key.
For the exact name of the constant, check the script.
Number keys work a little different. For the number n, VIRTUAL_KEY is:
Code:
NUM[n]
So 2, 6 and 0 are "NUM[2]", "NUM[6]", "NUM[0]" respectively.
Note that this is only the case with the number keys above the letter keys. Numpad keys have individual constants. So the constant for Numpad 4 is NUMPAD4

Example: Simulating "Alt + Enter"

     Scroll down to find the constants for alt and enter keys. They are ALT
   and ENTER respectively. Now, we need to simulate "alt down", "enter down",
   "enter up", "alt up". The following code does that:
Code:
VK.down(VK::ALT) # ALT down
VK.down(VK::ENTER) # ENTER down
VK.up(VK::ENTER) # ENTER up
VK.up(VK::ALT) # ALT up

Compatibility

Should be compatible with almost everything. Might not be compatible with similar scripts.

Credits and Thanks

Credits: Fantasist for making this.
Thanks: Memor-X for requesting this.

Author's Notes

If you have any questions, suggestions or comments, you can find me (Fantasist) at:

    - www.chaos-project.com
    - www.quantumcore.forumotion.com

Enjoy ^_^
« Last Edit: February 12, 2010, 02:22:55 PM by Fantasist » Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Arceus
Epiq
Moderator
Astral Trancist
*

Level: 88
Offline Offline

Gender: Male
Posts: 1559


I am lying.


View Profile
« Reply #1 on: December 11, 2008, 11:30:09 PM »

this seems like a useful little script.  I think I'll download it. Happy
Logged

DeathLock
Ethereal Devastator
****

Level: 52
Offline Offline

Gender: Male
Posts: 573



View Profile
« Reply #2 on: December 11, 2008, 11:54:42 PM »

I wanted something like this, and you've made it a reality. Thanks. ^_^
Logged

Arceus
Epiq
Moderator
Astral Trancist
*

Level: 88
Offline Offline

Gender: Male
Posts: 1559


I am lying.


View Profile
« Reply #3 on: December 12, 2008, 12:57:43 AM »

Awesome for status effects for Blizz-ABS Laugh

Can make so much better effects for confuse and berserk.
Logged

Kagutsuchi
Remexos Team Member
Celestial Dreamer
***

Level: 9
Offline Offline

Gender: Male
Posts: 282


The God of Fire


View Profile
« Reply #4 on: December 12, 2008, 09:14:32 AM »

Looks really nice ^^ I think I will put it to good use =D
Logged



Quote
“Lift not the seal of Atlas lest ye wish to not have the world destroyed seven times over”
(click to show/hide)
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #5 on: December 12, 2008, 12:14:45 PM »

Lol, I was going to make that for Blizz-ABS. Well, you could extend this to work with Blizz-ABS so I wouldn't have to make a separate one. xD
Logged



(click to show/hide)
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1840


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #6 on: December 12, 2008, 01:43:36 PM »

Ah, glad you guys like it Happy

@Bliz: What's there to extend exactly? Wait a second! I could integrate this with your input module so that VK.trigger(Input::Attack) instead of using the exact key constant. Do I have time or did you plan to do this before the contest?
Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #7 on: December 13, 2008, 08:19:58 PM »

Nah, I didn't plan it before the contest. v2.2 will be out later today. It will probably stay v2.2x for a while.
Logged



(click to show/hide)
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1840


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #8 on: December 13, 2008, 08:24:22 PM »

Good, cause I still need to figure out how to decide the commas and semicolon stuff ("OEM" keys) and do some more research.
Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #9 on: December 13, 2008, 08:37:55 PM »

Actually a Blizz-ABS key force input should be like "@triggered.push(Input::Key['XXX']); @pressed.push(Input::Key['XXX'])..." in Input, you get the idea.
Logged



(click to show/hide)
Memor-X
Reborn Member
**

Level: 5
Offline Offline

Gender: Male
Posts: 162


"An otherworld awaits you."


View Profile WWW
« Reply #10 on: December 14, 2008, 11:22:04 PM »

ha, ha, one of the main reasons why i requested this script was for Blizz-ABS to show how to use allies and to make advance attacks (like a sword dash slash, like what Agile does in Megaman X2)
Logged


Yochiru: yay, contest, contest
Ikkaku: i take it the winnder is the one who can kill the most Nanous
Yumichira: looks like it
Troy: like hell, the winnder is the one who STOPS STANDING AROUND WATCHING AND HELPS US KICK XANA'S ASS
Kenpachi: oh shut your bitching, we hear you
Troy: like hell you can, you haven't released your Zanbaruto's, you haven't even used Xende 0, the only thing your doing with waisting your Knightmare's Energy Fillers
Kenpachi: and like i said, shut your bitching
Troy: great, i'm doomed
Swimmer Tazero
Remexos Team Member
Ethereal Devastator
****

Level: -53
Offline Offline

Gender: Male
Posts: 931


Withing your soul lies the answer...


View Profile WWW
« Reply #11 on: December 15, 2008, 01:16:01 AM »

i probaly won't use this but yaaaaaaay nun the less Happy
Power up
Logged

It's the way I see the world.
Memor-X
Reborn Member
**

Level: 5
Offline Offline

Gender: Male
Posts: 162


"An otherworld awaits you."


View Profile WWW
« Reply #12 on: January 03, 2009, 01:02:22 AM »

i don't know if the SDK and/or Blizz-ABS is causing this problem but when i use the trigger call script for the arrow keys and Esc key something strange happens

the first test i did
Code:
Call script: VK.trigger(DOWN)
Wait: 8 frames
Call script: VK.trigger(LEFT)
Wait: 8 frames
Call script: VK.trigger(RIGHT)
Wait: 8 frames
Call script: VK.trigger(UP)
Wait: 8 frames
the character doesn't move but the game does the waiting

the second test
Code:
Call script: VK.trigger(DOWN)
Wait: 8 frames
Call script: VK.trigger(LEFT)
Wait: 8 frames
Call script: VK.trigger(RIGHT)
Wait: 8 frames
Call script: VK.trigger(UP)
Wait: 8 frames
Call script: VK.trigger(ESCAPE)
same as before, character doesn't move and the game wait but after the waiting it opens up the menu (because i'm using Blizz-ABS, the sub-menu opens)

the third test
Code:
Call script: VK.trigger(DOWN)
Wait: 8 frames
Call script: VK.trigger(LEFT)
Wait: 8 frames
Call script: VK.trigger(RIGHT)
Wait: 8 frames
Call script: VK.trigger(UP)
Wait: 8 frames
Call script: VK.trigger(ESCAPE)
Wait: 8 frames
Call script: VK.trigger(DOWN)
this time, it does nothing, doesn't even open up the menu, but it does the waiting fine
Logged


Yochiru: yay, contest, contest
Ikkaku: i take it the winnder is the one who can kill the most Nanous
Yumichira: looks like it
Troy: like hell, the winnder is the one who STOPS STANDING AROUND WATCHING AND HELPS US KICK XANA'S ASS
Kenpachi: oh shut your bitching, we hear you
Troy: like hell you can, you haven't released your Zanbaruto's, you haven't even used Xende 0, the only thing your doing with waisting your Knightmare's Energy Fillers
Kenpachi: and like i said, shut your bitching
Troy: great, i'm doomed
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #13 on: January 03, 2009, 01:27:47 PM »

It's probably Blizz-ABS if you disabled RMXP's default controls. I'm actually not sure if this can work with Blizz-ABS without modification.
Logged



(click to show/hide)
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1840


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #14 on: January 03, 2009, 03:33:15 PM »

I'm guessing the character doesn't move because the DOWN constant in this script is the down arrow key on the keyboard, not the Blizz-ABS down key. Try using VK.trigger(W), VK.trigger(A), VK.trigger(S), VK.trigger(D) instead.

Yeah, this still needs some work.
Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #15 on: January 03, 2009, 04:07:14 PM »

VK.trigger(Input::Key['W']), VK.trigger(Input::Key['A']), etc. Try that.
« Last Edit: January 03, 2009, 04:08:24 PM by Blizzard » Logged



(click to show/hide)
Memor-X
Reborn Member
**

Level: 5
Offline Offline

Gender: Male
Posts: 162


"An otherworld awaits you."


View Profile WWW
« Reply #16 on: January 06, 2009, 07:43:33 AM »

i should have mentioned this but i don't have RMXP's default controls disabled and i chnage the controls in Blizz-ABS so the arrow keys move the character, not W A S D, so the key should be working, what i find strange is in the tests i did, ESCAPE worked the first time but not the second when i used DOWN
Logged


Yochiru: yay, contest, contest
Ikkaku: i take it the winnder is the one who can kill the most Nanous
Yumichira: looks like it
Troy: like hell, the winnder is the one who STOPS STANDING AROUND WATCHING AND HELPS US KICK XANA'S ASS
Kenpachi: oh shut your bitching, we hear you
Troy: like hell you can, you haven't released your Zanbaruto's, you haven't even used Xende 0, the only thing your doing with waisting your Knightmare's Energy Fillers
Kenpachi: and like i said, shut your bitching
Troy: great, i'm doomed
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 349
Offline Offline

Gender: Male
Posts: 9550


South Park's Chinpokomon are more awesome.


View Profile WWW
« Reply #17 on: January 06, 2009, 03:28:20 PM »

Then it could be something wrong with the key simulator. Maybe FTS should test it with Blizz-ABS. xD
Logged



(click to show/hide)
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1840


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #18 on: January 07, 2009, 03:18:46 PM »

o.o I will.
Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Hadeki
Basic Member
*

Level: 10
Offline Offline

Gender: Male
Posts: 57



View Profile WWW
« Reply #19 on: January 21, 2009, 02:53:17 AM »

I must be really stupid or something because I can't figure this script out. I'd like a certain sound effect to play when a certain key is pressed. Do I make a condition branch with the script "VK.trigger(VK::NUM[1])"? Because that didn't work and I'm not sure what else to try.
(However, I really like this script by the way.)
Logged
Pages: [1] 2  All
  Print  
 
Jump to:  


*
*
Shoutbox
Latest Shouts
View All
Today at 05:48:49 AM Professor Ryexander Elm - lol
Today at 05:29:59 AM Flower Lady WhiteRose - Of course, so do the not so great ones.
Today at 05:26:47 AM Flower Lady WhiteRose - Fantastic. Every great journey begins with a single step.
Today at 05:25:43 AM Professor Ryexander Elm - it dose mean that we will have a functioning windowing system though
Today at 05:25:21 AM Professor Ryexander Elm - well sorta
Today at 05:22:30 AM Flower Lady WhiteRose - *golf clap* Great job! Once you get these windows finished, we should be able to create at least a semi-functional build of the game, right?
Today at 05:21:17 AM Elite Four Aqua - COol
Today at 04:49:42 AM Professor Ryexander Elm - Remexos members check the window thread scroll bars are working!
Today at 04:46:16 AM Professor Ryexander Elm - why are you suddenly ofline in MSN G_G!
Today at 04:23:08 AM Trainer Branden - Zy, you got proof? Besides the fact I sucked upon yours? Sarcasm

View All


RPG RPG Revolution ZVC Studios Time Stop Gamez HGW Development Evermoon Designs Sandbox Game Maker Loveless Entertainment