Gamepad Extender (v1.1, 2/20/2015)

We confirmed that it's only a problem if you don't have DirectX installed. Which a majority of people (especially gamers) do. Easy fix!
Ahaha, yeah that's it. Been kind of a flake lately, so sorry I didn't get around to responding sooner.

DirectX is required for RPG Maker to function normally, and built into every Windows version since Vista, so I didn't think to include it as a requirement. If somehow, you don't have DirectX installed, please install it before trying to run API calls to DirectX, or the above error will result.
Ahaha, yeah that's it. Been kind of a flake lately, so sorry I didn't get around to responding sooner.

DirectX is required for RPG Maker to function normally, and built into every Windows version since Vista, so I didn't think to include it as a requirement. If somehow, you don't have DirectX installed, please install it before trying to run API calls to DirectX, or the above error will result.
I assume there is no simple way to check for it or even throw out an error indicating the user does not have dx?
Starting to have these issues on a Fresh install of Windows 8 fully updated:

rJlqfdU.png


Seems like I will need a older directX installed for it to work. Is there no way to prevent it from crashing if its not on the system? I would have to release 2 versions or something as it seems a lot of people will end up with the same issue.

EDIT: I found you can edit the source and Windows 7? For Sure Windows 8 Comes with a xinput1_4. Is there a way to load 1_3 and or 1_4 Without a error. Like if 1_3 does not work try 1_4?

That would be amazing.

Thanks!

EDIT 2: I also am having a issue tried on 2 Windows 8 Machines With 360 controller of me just walking downwards none stop. I can use the analog to fight back but yeah it just keeps going down on load.

Also could someone give me a slight event script example of the force feedback. I don't know much on the scripting tried to call it but keep crashing. Clearly don't know how to call the event right.
Replace lines 350 and 351 with these two lines to fix compatibility on fresh installs of Windows:

@set_state = Win32API.new("XINPUT9_1_0", "XInputSetState", "IP", "V") @get_state = Win32API.new("XINPUT9_1_0", "XInputGetState", "IP", "L")XInput 1.4 is exclusive to Windows 8, so using it instead of 1.3 is a no. Pretty much any game install ever requires installing the full DirectX package as well, so it's really only a compatibility issue if you skip installing DirectX and go straight to playtesting. The current version has no real issues with Xinput 9.1.0, but I reserve the right to add features later.

Not sure about your movement issue, though it sounds like a problem with calibration. You might want to look at it in the control panel. Is MOVE_WITH_ANALOG enabled or disabled?
 
As for your last question, I had planned on releasing a separate addon module for more advanced vibration effects, but pretty much nobody ever asked about it (or this script) for a really long time and it got left behind. For reference, a proper vibration call looks like this:

WolfPad.vibrate(0.5, 0.5, 60, 0)That runs both motors on controller 1 at half power for 60 frames (one second). The time sensitivity is not that great, though (blame Microsoft). Also be sure that enable_vibration is set to true in PadConfig, or nothing will happen.
Thanks a ton. The 9_1_0 Seems to work on both setups. I hope it also works fine on other systems though I only have Windows 8 to test now.

I enabled_vibration and I added the script as an event and click on it and crashed with this error:

oapkYYX.png


If I'm doing it wrong I'm really sorry this like my third day really getting into this.

Here was the event screenshot:

Spoiler
0K3CBHC.png
That's weird, actually. I tested that just now to be sure about the context the "Script" command runs in, and it worked just fine. The only way an error like that would show up is if, somehow, it didn't get registered as a module in the global scope. You did follow the in-editor instructions and install the WolfPad module in it's own page in the Materials section, right? Because if you did that it should have no trouble at all running commands like that.
Yeah I think I'm doing it right. My little downwards bug is back anyways 🙁 Analog just keeps going down and down on both PC's IDK what I did to fix it before.

Spoiler
FntkKyv.png
Mr Lone Wolf you have a Pm, thank you for your time mate ^-^
Yeah I think I'm doing it right. My little downwards bug is back anyways 🙁 Analog just keeps going down and down on both PC's IDK what I did to fix it before.
Have you read the other posts in this thread? You may need to adjust the deadzone variable in the configuration. I admit I did most of my testing for this on a more precise controller than the stock 360 pads, but I didn't realize there was that much of a difference. Clearly an auto-calibration function is in order.

As for the script command issue, I have tested that exact line, in an event Script call, with the version of the script posted here, and it works just fine for me. When in doubt, recopy the script from this thread into a fresh project and try running that command again. If it works, begin copying your other scripts over one at a time until you see the error again. If you don't, and get all your scripts copied over, close the project and copy its Data/Scripts.rvdata2 file to your original project, and that will get rid of any forgotten edits in the default script package causing the error.
It's all working now. No the deadzone part I was not thinking about that.. I put mine to 0.25 now.. Might be high but should be more then enough prevent that and still feels good. For the vibrate feature it works. I had this script before that disabled scripts and it seems to be conflicting before. So everything works just perfect. I gotta still learn to move a few buttons around like sprint to x and maybe A for action just because or at least maybe that is just me is use to hitting A as my main action. Might try also bind start as menu or at least another start menu there as well.

Thanks for all your help!
Any pointers or idea on how one could rebind the controller keys from inside the game? I got some players who would really want that feature since they don't agree with my controls. Thank you for being such an awesome scripter!
Any pointers or idea on how one could rebind the controller keys from inside the game? I got some players who would really want that feature since they don't agree with my controls. Thank you for being such an awesome scripter!
Better yet how do we change the default keys? Also check F2 might change the bindings it might not.
f2 is not very end user friendly. I'm using another script to allow users to rebind default keys. However that script is not aware of this script. And so whenever a controller is plugged in,  this script will do whatever it wants with the controller. Which is cool and all, that is what it should do. 

I already have the default keys binded to the functions I want. This will look different for you but my configuration is: 
 

Code:
  def self.attackR1    WolfPad.plugged_in? ? :R1 : :SHIFT  end  def self.skillbuttonR2    WolfPad.plugged_in? ? :R2 : :Z  end  def self.triangle    WolfPad.plugged_in? ? :Y : :Y  end  def self.jumpSquare    WolfPad.plugged_in? ? :X : :X  end  def self.changeleader    WolfPad.plugged_in? ? :R3 : :R  end  def self.activateevent    WolfPad.plugged_in? ? :A : :C  end
f2 is not very end user friendly. I'm using another script to allow users to rebind default keys. However that script is not aware of this script. And so whenever a controller is plugged in,  this script will do whatever it wants with the controller. Which is cool and all, that is what it should do. 

I already have the default keys binded to the functions I want. This will look different for you but my configuration is: 

def self.attackR1 WolfPad.plugged_in? ? :R1 : :SHIFT end def self.skillbuttonR2 WolfPad.plugged_in? ? :R2 : :Z end def self.triangle WolfPad.plugged_in? ? :Y : :Y end def self.jumpSquare WolfPad.plugged_in? ? :X : :X end def self.changeleader WolfPad.plugged_in? ? :R3 : :R end def self.activateevent WolfPad.plugged_in? ? :A : :C end
Thanks this will help me a lot. Do you ever notice issues sometimes the gamepad / keyboard can't be used at the same time. It seems to sort of kill KB Support not always but at times. It might get annoying for people who always have a gamepad plugged in. I might add a notice or something to the game haha.
Edited for more efficient version.

No.. didn't notice.

Also, if you want to rebind, you can do this as an example code:  

def self.attackR1 wolf = $game_variables[72].to_sym WolfPad.plugged_in? ? wolf : :SHIFTendAnd then make an event (you might need one to set the default as well so the game has something to go on). Make a "Show choices" block. And then you can use this in a script box:

$game_variables[72] = :R1The "R1" can be any of the symbols you can find under the @Keys of the main script. Game variables are whatever variable you choose to transfer these changes into the script itself.

Here are the symbols for your convenience: 

:UP => 15, #d-pad up 😀OWN => 14, #d-pad left :LEFT => 13, #d-pad down :RIGHT => 12, #d-pad right :A => 3, #lower face button :B => 2, #right face button :X => 1, #left face button :Y => 0, #upper face button :L1 => 7, #upper left trigger :R1 => 6, #upper right trigger :START => 11, :SELECT => 10, :L3 => 9, #left thubstick button :R3 => 8, #right thubstick button :L2 => 16, #lower left trigger (press only) :R2 => 17, #lower right trigger (press only)Hope this will help someone. It was an fairly easy modification. Alas, so nice to be able to rebind things ^-^
I have a problem with the script: i can't use the gamepad and the keyboard at the same time, its very annoying :/
I have a problem with the script: i can't use the gamepad and the keyboard at the same time, its very annoying :/
Yup, I have this issue too. Really annoying 🙁 It's the only reason I can't use it for others.
I have a problem with the script: i can't use the gamepad and the keyboard at the same time, its very annoying :/
That's by design, to minimize the number of small edits required, and also because hybrid control schemes are stupid. Changing that behavior is actually really simple, and just a matter of looking at the bottom of the script page at the modified Input module.

My question though, is what are you trying to do with the pad and keyboard at the same time? Are you trying to use both for one player's input, or check the keyboard separate from the gamepad? The edits required are completely different, and both will require a bunch of small edits (not my problem) to the main script package.
That's by design, to minimize the number of small edits required, and also because hybrid control schemes are stupid. Changing that behavior is actually really simple, and just a matter of looking at the bottom of the script page at the modified Input module.

My question though, is what are you trying to do with the pad and keyboard at the same time? Are you trying to use both for one player's input, or check the keyboard separate from the gamepad? The edits required are completely different, and both will require a bunch of small edits (not my problem) to the main script package.
Thanks for your reply!, The problem here is when you have a gamepad connected, you should to disconnect it if you want to play with the keyboard; the script assumes that you always want to play with the gamepad, and disable the keyboard. The advantage of the default gamepad configuration, is that you can choose between the keyboard and the gamepad in any moment. As you can see, its not a big problem, but can be annoying for some.
Thanks for your reply!, The problem here is when you have a gamepad connected, you should to disconnect it if you want to play with the keyboard; the script assumes that you always want to play with the gamepad, and disable the keyboard. The advantage of the default gamepad configuration, is that you can choose between the keyboard and the gamepad in any moment. As you can see, its not a big problem, but can be annoying for some.
That's... not how it's set up to work, actually. So long as you're making your input calls through Input and not WolfPad, as soon as you unplug the gamepad, plugged_in? will start returning false and return keyboard/default gamepad values instead. How have you been scripting your input checks?

EDIT: misread that. That is the default and intended behavior, and changing it requires writing an extra configuration module. I may make one, or I may not. This script was meant only to be a backend for experience scripters, after all.

Original thread: https://forums.rpgmakerweb.com/threads/gamepad-extender-v1-1-2-20-2015.1284/