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

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

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« on: December 11, 2008, 08: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, 03:22:55 PM by Fantasist » Logged

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

winkio
Epiq
Global Moderator
Lexima Warrior
**

Level: 119
Offline Offline

Gender: Male
Posts: 2050


I am lying.


View Profile
« Reply #1 on: December 12, 2008, 12:30:09 AM »

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

I am currently working on Blizz-ABS, since Blizzard has retired.  If you have any suggestions, post them here: http://forum.chaos-project.com/index.php/topic,6164.msg104939.html#msg104939
DeathLock
Ethereal Devastator
****

Level: 51
Offline Offline

Gender: Male
Posts: 583


View Profile
« Reply #2 on: December 12, 2008, 12:54:42 AM »

I wanted something like this, and you've made it a reality. Thanks. ^_^
Logged
winkio
Epiq
Global Moderator
Lexima Warrior
**

Level: 119
Offline Offline

Gender: Male
Posts: 2050


I am lying.


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

Awesome for status effects for Blizz-ABS Laugh

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

I am currently working on Blizz-ABS, since Blizzard has retired.  If you have any suggestions, post them here: http://forum.chaos-project.com/index.php/topic,6164.msg104939.html#msg104939
Kagutsuchi
Celestial Dreamer
***

Level: 9
Offline Offline

Gender: Male
Posts: 282


The God of Fire


View Profile
« Reply #4 on: December 12, 2008, 10: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)
Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


View Profile WWW
« Reply #5 on: December 12, 2008, 01: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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« Reply #6 on: December 12, 2008, 02: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

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


View Profile WWW
« Reply #7 on: December 13, 2008, 09: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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« Reply #8 on: December 13, 2008, 09: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

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


View Profile WWW
« Reply #9 on: December 13, 2008, 09: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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Memor-X
Reborn Member
**

Level: 6
Offline Offline

Gender: Male
Posts: 183


"An otherworld awaits you."


View Profile WWW
« Reply #10 on: December 15, 2008, 12:22:04 AM »

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
Tazero
Remexos Team Member
Ethereal Devastator
****

Level: -39
Offline Offline

Gender: Male
Posts: 979


Within your soul lies the answer...


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

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

It's alright to tell me what you think, about me.
Memor-X
Reborn Member
**

Level: 6
Offline Offline

Gender: Male
Posts: 183


"An otherworld awaits you."


View Profile WWW
« Reply #12 on: January 03, 2009, 02: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
Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


View Profile WWW
« Reply #13 on: January 03, 2009, 02: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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« Reply #14 on: January 03, 2009, 04: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

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


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

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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Memor-X
Reborn Member
**

Level: 6
Offline Offline

Gender: Male
Posts: 183


"An otherworld awaits you."


View Profile WWW
« Reply #16 on: January 06, 2009, 08: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
Blizzard
Where am I?
Administrator
Has over 9000 posts
***

Level: 395
Offline Offline

Gender: Male
Posts: 11337


OMG! Is that Dolce & Gabbana?!


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

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

I have retired from RMXP! Please do not send me PMs or e-Mails asking for support!

Quote from: Bender
Ahhh, what an awful dream. Ones and zeroes everywhere... and I thought I saw a two.
Quote from: Fry
It was just a dream, Bender. There's no such thing as two.
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


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

o.o I will.
Logged

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Hadeki
Basic Member
*

Level: 10
Offline Offline

Gender: Male
Posts: 59



View Profile WWW
« Reply #19 on: January 21, 2009, 03: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 12:36:40 PM Karltheking4 - [french]hello[/french] == Bon jour!
Today at 12:25:05 PM Silentknight72 - OH GOD! RGSS LANGUAGE!
Today at 12:10:05 PM Blizzard - ['English', 'French', 'Spanish'][rand(3)] :V
Today at 11:55:02 AM Karltheking4 - zomg, random languages!!!
Today at 10:32:16 AM Blizzard - *slaps Aqua and Cait* >8U
Today at 03:19:14 AM Cait Sith - ¿Que?
Today at 03:15:46 AM Aqua - Ca sera amusant, n'est-ce pas?
Today at 02:49:38 AM Karltheking4 - Uhhh.... good luck with that...
September 08, 2010, 11:35:01 PM Lanzer - Leeeeeeeeeeroy Jenkinnnnnnnnssssssss!!!
September 08, 2010, 11:33:02 PM The Niche - Fucking being forced to go on French exchange. 

View All


RPG RPG Revolution HB Games Evermoon Designs Sandbox Game Maker Loveless Entertainment Decisive Games Cait Sith's Domain