FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
309
First Language
English
Primarily Uses
FyxInput
FenixFyreX
What? Another input module?
Yep, another, but not a normal one, by far. This one has features unknown to the RPG Maker community, until now.

Alright, what's the bells and whistles then?
The features follow below:
  • Key input processing: press?, trigger?, release?, and repeat?
  • You can disable RPG Maker keys, like F1, F12, Alt + Enter, etc. Best. Thing. Ever. :p
  • Mouse support! Not for the actual game, in windows, but its there to be built from!
  • It's faster and more efficient. The OS does a lot of the leverage-ing.
  • Much more! Check the spoiler:
  • Ability to manually check key states if you want.
  • It's written in C. *** See below for details.
  • The keys disabled still get passed to the engine, so you can use them for whatever!
  • You can disable keys in-game too, using an add on.
  • Simulate keystrokes, and mouse buttons, but not to the system; just to the game. Safety first.
  • Key-To-Text processing. Currently, just English. I plan on adding Keyboard mapping (region specific characters, etc).
  • Game instance specific. Does not get confused when another instance of the game is open. *** See below for details.
Queries from the Features List
What does "Written in C" mean?
For those who don't know, C is the language Ruby is written in (Ruby is the language RGSS is written in). Using a system Wanabe from github wrote (and I fixed up), I've recreated loading C extensions into Ruby!

...game instance specific?
When most scripts are written for RPG Maker that use any API calls that would otherwise be process specific, they don't map the results to the specific process they are running in; if multiple copies of the same game are open, chances are one of the game's new script won't work, cause it got some other instance's id.
Technical Description:
FindWindow(), a Win32API method found in user32.dll, finds a window by it's class and caption. For any RM game, that would be "RGSS Player", and the ini file's Title variable, respectively. However, when multiple instances get opened, things go awry. To fix this, I let the OS step through the windows until it reaches the game's process id, and it selects the first window from that, aka. the game window. This pretty much fool proofs finding the handle to the game window. For programmers who use this system, just use RPG::HWND to get the game's window handle.

Where's the goods?
Okay, okay. Enough wasting your time with talk and text. Here's the link:
DEMO LINK

The demo shows off most of the things useful from this script. Many peoples' pet pieve of the F1 / F12 keys is now dead. Can't stress how nice that is to say :B

How do I use this right?
Well, for starters, you'll find a dll in the main folder of the game called 'mscvrt-ruby191.dll'. This is LoadSo, or the majority of it. LoadSo allows C extensions to be loaded into RGSS again, so that's necessary.
Furthermore, there is a file called 'fyxinput.so' alongside this dll. That is needed.
Finally, just make sure the LoadSo script and FyxInput script, and any addons from the demo are installed. That means all of this:
  • msvcrt-ruby191.dll
  • fyxinput.so
  • Two or more scripts from the demo.
are necessary for this to work properly.

What if I have suggestions? Any future plans for this?
By all means, let me know! I want to further this project and make it super-efficient, which means I'm definitely not done yet, so ask and ye might receive.
Here are some ideas for the future:
  • Region-Based KeyToText
  • Raise efficiency even more. This system was just created, now it must be optimized!
  • AddOns! I want to write mouse compatibility for RGSS' windows, etc, but that will come in time.
  • GamePad support. Not sure to what level.
Terms Of Use
This script is free to use non-commercially. You'll have to contact me should you wish to use it in your commercial game.

Addons
Fyx Per-Scene Key Disable
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,273
Reaction score
2,335
First Language
Binary
Primarily Uses
RMMV
Dude, I've been playing around with this since you messaged me.  This is absolutely awesome. A REAL way to remove the F Key bindings, legitimately, without having to do mad crazy **** that barely works. Love it.

Cant wait to see what else you add onto this. :)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,079
First Language
English
This is great, because when someone complains that their game crashed due to my script because they pressed F12, I can just say "well then disable F12..."
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,273
Reaction score
2,335
First Language
Binary
Primarily Uses
RMMV
Imo we should never have had an F12 except for quick launch / playtest (maybe not even for that) - especially with how flawed it is - and seemingly has been for the past few makers.

One would think the devs just remove it from the engine :p

Again. Thanks to you Fenix :)
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
14,759
Reaction score
14,633
First Language
Filipino
Primarily Uses
VNM
I was wondering, how would one change the Alt+Enter function to work differently instead?
 

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
309
First Language
English
Primarily Uses
If you'd like to disable Alt + Enter, simply set the config option to true in the script. As for making Alt + Enter do something else, simply place this code somewhere in a per-frame update method after this script (or event, or wherever, I assume you have a little scripting knowledge):

Code:
if Input.press_any?(VKeys::LALT, VKeys::RALT) && Input.trigger?(VKeys::ENTER)  # Here is where you'd put whatever you want to happen. Note that this has to be put in  # somewhere that will get executed every frame, such as Graphics::update method.  # Perhaps, Graphics.resize_screen(screen_width, screen_height) or something.end
I have another script coming tonight or tomorrow, FyxFullscreen. It will allow per-monitor fullscreen toggling in combination with this script.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,696
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Awesome. Gonna take a look at this. :)
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,273
Reaction score
2,335
First Language
Binary
Primarily Uses
RMMV
Gotta say bro, been looking over this and all the code since I seen it and I have come to the following conclusion...

You are a much better coder than I. :/

Also, this script has made about 3 months worth of script writing and benchmarking and optimization on my own input script completely obsolete. 
Yet I couldn't be happier. :D

Finally having the F12 gone - and being able to rebind it to do some other crap is epic. Coupled with the fact I can have a legitimate reset if I wanted, using whatever key - to which I could easily add a server disconnection method into (for my online crap).... EPIC !! :D

Wondering...

Is it possible to be able to detect all game closes using the methods in your .so ? Would you be willing to add that? (just a small bit of code to call some method whenever the game is closed. Something like below:

module WhenResetting  def self.resetting    # /* Left blank for me/others to insert their own ruby code # that is ran prior to the game closing. */  endendThat would be awesome :D
 
Last edited by a moderator:

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
309
First Language
English
Primarily Uses
I'm no better than anyone else and I make my fair share of mistakes. Thanks for the compliments though :)


I will be posting my updates / new version of LoadSo extension project soon; yes, what you ask about is possible, but I wouldn't recommend it. I'll PM you more about it.
 
Last edited by a moderator:

Sophism

Veteran
Veteran
Joined
Aug 1, 2014
Messages
36
Reaction score
6
First Language
English
Primarily Uses
Hey Fenix. I've been using this script for a while now, and finally decided to replace the input script I was running before with yours.

Now, I'm sure that I'm doing something incredibly stupid, but just in case I'm not, I've run into a weird little issue and I'm wondering if it's something about the script. (Or I'm just dense and screwed up something else somewhere.)

So here's the scenario:

I have chairs that I've been trying to make work like actual seats. If the player steps on a chair facing down, their character turns down and then can either step out of the seat downwards, left or right, but can't turn or move up. When the player steps out of the chair, they can freely move around again.

Previously, I had two regions set up. One for the chair facing down, and one for the tiles neighboring the seat. And they worked like this:



But I really disliked how the player would hitch up for a second whenever they stepped into region 60 as the game tried to remove the Direction Fix tag. This got extremely noticeable if their character was say walking in front of a bench, thus triggering the effect twice.

So I decided to disable the up key through your script instead, and making it so it got enabled again once the player character steps out of the chair. It worked well, but then they couldn't navigate the menu properly, so I had to implement a workaround for that as well. Now, the event looks like this:



This method created a new problem though. Whenever the player holds the Up key for more than a millisecond while stepping into region 56, it locks their character in a Turn Up, Turn Right, Turn Down loop, and the only way to break out of it is opening the menu and pressing Up twice there. I tried to simulate input to prevent this from happening, but it's either not working or I used the wrong script string:

Input.set_keystate(VKeys::UP, Input::KEY_NONE)

Setting the keystate to Input::KEY_UP didn't do anything either. Am I doing something wrong, or did I stumble into an actual quirky bug?
 
Last edited by a moderator:

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
309
First Language
English
Primarily Uses
Don't use Input.disable for this usecase. Input.disable is used to tell the internals of RPG Maker that a key is not being pressed, but my system will still reveal the key being pressed to the game code, like the script database and events. Instead, replace them with Input.set_keystate(VKeys::UP, Input::KEY_NONE); this should emulate what you want.

The disable method is to reroute key input from the internals of RPG Maker, to disable keys like F1, F12, and such. It doesn't actually disable the key to the engine itself, like so:

Code:
# This is how it normally worksWindows Input -------> RPG Maker ------> Input module# After FyxInput is installed and you use Input.disable it's like so:Windows Input ------> My Code ---|   RPG Maker  |-----> Input module                                 ----------------
Does that help? I may need more context (such as if your event is parallel process, action button, etc; or perhaps a demo that i can rectify and then post the fix). Does that sould alright?
 

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
309
First Language
English
Primarily Uses
I think I see the problem now. The event isn't trapping the key fast enough. Here's an addon that lets you disable keys per scene.


Fyx Key Disabler v1.0 - Pastebin


Check out this demo to see how it works (you only need 1 region on the chair bit, and a switch, for all chairs):


Seat Tavern - Revamp
 

Sophism

Veteran
Veteran
Joined
Aug 1, 2014
Messages
36
Reaction score
6
First Language
English
Primarily Uses
Oh God, that worked perfectly Fenix! And the scene-specific functionality will also allow the creation of some interesting mini games too!

You're a scholar and a gentleman. Thanks a million!  :)
 

some1one

Villager
Member
Joined
May 20, 2015
Messages
11
Reaction score
0
First Language
English
Primarily Uses
This is great! I'm more interested in the LoadSo though. I really want to be able to use any extension I want. I was wondering if you had source code anywhere for the LoadSo project? All I could find was the original from wanabe.
 

dax

Veteran
Veteran
Joined
Jul 17, 2015
Messages
46
Reaction score
4
Primarily Uses
I think I see the problem now. The event isn't trapping the key fast enough. Here's an addon that lets you disable keys per scene.

Fyx Key Disabler v1.0 - Pastebin

Check out this demo to see how it works (you only need 1 region on the chair bit, and a switch, for all chairs):

Seat Tavern - Revamp
Hello!

I tried your script too for "sitting" and it's awesome!

I'm experiencing a weird conflict if it's not too much might I kindly ask you to take a quick glance? I tried despite my ruby knowledge being average but I just can't grasp what on earth what's the conflict.

Basically, what happens is that when this script is also in the list, after my char "sits", the Up key stops working - just on the map, not on menus.

http://pastebin.com/UKA0n75g

this is the other script

and I was able to isolate the problem:

it occurs

if

#Switch to denote day or night time

  USE_SWITCH = false

  NIGHT_DAY_SWITCH = 1

  DAY_TIME_START = 6

  NIGHT_TIME_START = 18

 

this switch is set to true

any ideas?

Again, I apologise, I understand that resolving compatibility issue shouldn't be your work but maybe it's something really easy actually
 

WCouillard

Veteran
Veteran
Joined
Nov 24, 2013
Messages
42
Reaction score
13
First Language
English
Primarily Uses
This script is incredible. Awesome job.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
809
First Language
Hungarian
Primarily Uses
RMVXA
@dax


My wild guess would be that you use the same switch for the disable UP input event and for that in-game time script.


Change the switch IDs in the script configurations to something different.
 
  • Like
Reactions: dax

dax

Veteran
Veteran
Joined
Jul 17, 2015
Messages
46
Reaction score
4
Primarily Uses
Don't know if it's just me or I missed something, but with this script, Conditional branches which use Button press don't work anymore.

Am I doing something wrong?

Or is it because of this part:

# There are several new ways to check input, and here they are:              #
#                                                                              #
#   release?(key) # Not compatible with symbols :)C, etc)                      #
#     - This checks whether or not the key has been released. Each key release #
#       has a cooldown of a few frames that needs to be taken into account.    #
#                                                                              #
#   keystate(key) # Not compatible with symbols :)C, etc)                      #
#     - This returns the state of the key, one of the following:               #
#       Input::KEY_NONE      # key is completely inactive.                     #
#       Input::KEY_DOWN      # key was literally just pressed.                 #
#       Input::KEY_TRIGGER   # key is confirmed as pressed, thus triggered     #
#       Input::KEY_THRESHOLD # key is transitioning from trigger to repeat     #
#       Input::KEY_UP        # key has been released                           #
#       Input::KEY_HOLD      # key is being held down (repeat) 

if so, if someone is kind enough to provide me the script substitute, I'd appreciate. I don't really understand.
 
Last edited by a moderator:

Wilczek

Veteran
Veteran
Joined
Oct 8, 2012
Messages
31
Reaction score
15
First Language
Polish
Primarily Uses
Does anyone have a contact with FenixFyreX? I tried reaching him by email and PM nearly 2 months ago, but none of them did the trick.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

work in progres c:
Every RPG and MMO should let you transmog\glamour your gear so you can look the way you want.
So, to clear up things, this section is to speak about personal life stuff and such? or maybe upload game content?
excerpt from my game FW: WHAT?! You want me to shear sheep? I had servants, who had servants, that had servants that did peasants work. Vincent: Do you see any of your servants here? FW: Well... no. Of course not. Vincent: Then get to work.
The dumbest mechanic I just encountered today : boss recovers 10% HP when a party member is KO-ed, who thinks this is a great idea again...?

Forum statistics

Threads
97,760
Messages
946,777
Members
128,971
Latest member
omgtank93
Top