Author Topic: [XP][VX] Key Simulator  (Read 23869 times)

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
[XP][VX] Key Simulator
« 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 O:)
(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: [Select]
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: [Select]
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: [Select]
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 »
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4506
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: [XP][VX] Key Simulator
« Reply #1 on: December 12, 2008, 12:30:09 AM »
this seems like a useful little script.  I think I'll download it. :)

Offline DeathLock

  • Astral Trancist
  • *****
  • Posts: 586
  • LV: 53
  • Gender: Male
    • View Profile
Re: [XP][VX] Key Simulator
« Reply #2 on: December 12, 2008, 12:54:42 AM »
I wanted something like this, and you've made it a reality. Thanks. ^_^


Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4506
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: [XP][VX] Key Simulator
« Reply #3 on: December 12, 2008, 01:57:43 AM »
Awesome for status effects for Blizz-ABS :haha:

Can make so much better effects for confuse and berserk.

Offline Kagutsuchi

  • Ethereal Devastator
  • ****
  • Posts: 468
  • LV: 2
  • Gender: Male
  • The God of .. eating souls?
    • View Profile
    • University Hosted Web Page - In Norwegian
Re: [XP][VX] Key Simulator
« Reply #4 on: December 12, 2008, 10:14:32 AM »
Looks really nice ^^ I think I will put it to good use =D

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP][VX] Key Simulator
« Reply #6 on: December 12, 2008, 02:43:36 PM »
Ah, glad you guys like it :)

@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?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP][VX] Key Simulator
« 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.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Memor-X

  • Ethereal Devastator
  • ****
  • Posts: 428
  • LV: 8
  • Gender: Male
  • "The Otherworld Awaits you"
    • View Profile
    • MHO Ultra Mega
Re: [XP][VX] Key Simulator
« 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)

Trish: hay Angela, you should take the role, you always wanted to be an actress
Angela: yeh but what about you
Trish: i'll become one too
Angela: what? but about you being a Doll Turner
Trish: first, i'm 500 years old in a 19 year old body, i deserve a rank higher than other tuners, like Miester or something, second, i want to help you since you mean a lot to me
Angela: *imagine kissing scene between them and blushes* thank you
Trish: why are you going red? you should know i can only fix Dolls, not humans

Offline Tazero

  • Blows jobs for custom titles
  • Chaos User
  • ******
  • Posts: 1179
  • LV: -45
  • Gender: Male
  • Asleep but flying high
    • View Profile
Re: [XP][VX] Key Simulator
« Reply #11 on: December 15, 2008, 02:16:01 AM »
i probaly won't use this but yaaaaaaay nun the less :)
Power up


If you were a fish...

Offline Memor-X

  • Ethereal Devastator
  • ****
  • Posts: 428
  • LV: 8
  • Gender: Male
  • "The Otherworld Awaits you"
    • View Profile
    • MHO Ultra Mega
Re: [XP][VX] Key Simulator
« 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: [Select]
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: [Select]
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: [Select]
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

Trish: hay Angela, you should take the role, you always wanted to be an actress
Angela: yeh but what about you
Trish: i'll become one too
Angela: what? but about you being a Doll Turner
Trish: first, i'm 500 years old in a 19 year old body, i deserve a rank higher than other tuners, like Miester or something, second, i want to help you since you mean a lot to me
Angela: *imagine kissing scene between them and blushes* thank you
Trish: why are you going red? you should know i can only fix Dolls, not humans

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP][VX] Key Simulator
« 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.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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 »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Memor-X

  • Ethereal Devastator
  • ****
  • Posts: 428
  • LV: 8
  • Gender: Male
  • "The Otherworld Awaits you"
    • View Profile
    • MHO Ultra Mega
Re: [XP][VX] Key Simulator
« 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

Trish: hay Angela, you should take the role, you always wanted to be an actress
Angela: yeh but what about you
Trish: i'll become one too
Angela: what? but about you being a Doll Turner
Trish: first, i'm 500 years old in a 19 year old body, i deserve a rank higher than other tuners, like Miester or something, second, i want to help you since you mean a lot to me
Angela: *imagine kissing scene between them and blushes* thank you
Trish: why are you going red? you should know i can only fix Dolls, not humans

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19916
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] Key Simulator
« 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
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP][VX] Key Simulator
« Reply #18 on: January 07, 2009, 04:18:46 PM »
o.o I will.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Hadeki

  • Awakened Visionist
  • **
  • Posts: 59
  • LV: 10
  • Gender: Male
    • View Profile
    • MistyDraco
Re: [XP][VX] Key Simulator
« 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.)