mazapan
|
|
Posted on: January 12, 2014, 06:46:58 pm |
|
|
Joined: Oct 2012
Posts: 15
|
Hi. Pretty new to Enigma here, sorry if this is a dumb question. Today I wanted to test my Game Pad in Enigma. I wrote a simple script, but i cannot use any of the joystick functions. I got the error: Building for mode (0) Cleaning up from previous executions - Cleared parsed objects - Cleared room entries - Cleared shared locals list - Cleared event info Loading shared locals from extensions list Location in memory of structure: 0a510370 Copying resources: Copying sprite names [1] Copying sound names [1] Copying background names Copying path names Copying script names [1] Copying shader names Copying font names [1] Copying timeline names [kidding, these are totally not implemented ] Copying object names [1] Copying room names [1] SYNTAX CHECKING AND PRIMARY PARSING: 1 Scripts: Syntax error in script `test_pad' Unknown function or script `joystick_direction'
What can i do to solve this? Thank you very much.
|
|
|
Logged
|
|
|
|
Goombert
|
|
Reply #1 Posted on: January 12, 2014, 07:19:34 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Looks like you are on Windows, go to Build->Settings and under the extensions tab enable DirectInput extension. XInput is for Xbox 360 gamepads.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|
FroggestSpirit
|
|
Reply #4 Posted on: March 27, 2014, 12:33:02 pm |
|
|
Joined: Mar 2013
Posts: 79
|
There is no longer a direct input extension. I believe i remember you mentioning something like this, but i forgot. I use usb controllers (pretty much ps2 to usb and gamecube to usb converters) so i dont think that xinput is for me
|
|
|
Logged
|
This isn't easy to say, but…
|
|
|
Goombert
|
|
Reply #5 Posted on: March 27, 2014, 12:34:37 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
There is no DirectInput because I wrote the Joystick functions to use RawInput, so they don't require an extension. DirectInput is deprecated just adds bloat and is shit. Joystick functions are now always enabled on Windows.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
FroggestSpirit
|
|
Reply #6 Posted on: March 29, 2014, 12:06:36 am |
|
|
Joined: Mar 2013
Posts: 79
|
I got it to detect and read my joystick by seeing if joystick 0 exists, and if it does, to load it. However, that is run once. On each step, I have it see if it exists still, and if so, it reads xposition, yposition, some buttons, etc. Buttons work fine, however, stuff like the x/y position for an analog stick is not working correctly. It appears to give values like 127 a lot...
|
|
|
Logged
|
This isn't easy to say, but…
|
|
|
Goombert
|
|
Reply #7 Posted on: March 29, 2014, 12:54:49 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I can check the API for you on that, just give me the specific function, I am probably dividing by something wrong.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
FroggestSpirit
|
|
Reply #8 Posted on: March 29, 2014, 10:47:17 am |
|
|
Joined: Mar 2013
Posts: 79
|
Here's what I have running every step: joyX=0; joyY=0; joyR=0; joyU=0; if(joystick_exists(0)){ joyX=(joystick_xpos(0)); joyY=(joystick_ypos(0)); joyR=(joystick_rpos(0)); joyU=(joystick_zpos(0)); }
It for the most part returns 127 for each, but if i move an analog stick strait up, or to the side, it sometimes changes all 4 values
Edit: On another note, do we have functions for rumble?
|
|
« Last Edit: March 29, 2014, 12:13:14 pm by FroggestSpirit »
|
Logged
|
This isn't easy to say, but…
|
|
|
Goombert
|
|
Reply #9 Posted on: March 29, 2014, 05:48:57 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I don't think Windows has any RawInput functions for rumble packs, however I know XInput does. That said, get on IRC later and I will debug the joystick return values with you, I can't do it myself as I do not have a joystick/controller.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
FroggestSpirit
|
|
Reply #10 Posted on: April 01, 2014, 07:17:36 am |
|
|
Joined: Mar 2013
Posts: 79
|
The Joystick X and Y axis is mostly working, however, I found it messing up with what appears to maybe be a parser error. If I put an if statement after it checks for the axis, it seems to glitch up and not work (I had an if statement to check for a joypad button press, when i removed this, axis's worked again). This also applied for an if statement for doing a custom deadzone code
|
|
|
Logged
|
This isn't easy to say, but…
|
|
|
Goombert
|
|
Reply #11 Posted on: April 01, 2014, 11:05:25 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
You still haven't even let me properly fix the axis code so that I can commit it to the repository, you stormed off with a version of the code you *thought* worked, but may in fact not work with other joysticks because as I said it wasn't calibrating properly. If you would get on IRC and test the code for me, it would be much easier to fix these bugs as I do not have a game controller. Edit: We have properly fixed the joystick calibration and committed the code. The commit is in the following pull request and will appear in the next stable release of ENIGMA. https://github.com/enigma-dev/enigma-dev/pull/683This is the specific commit. https://github.com/RobertBColton/enigma-dev/commit/b7a9a4b7f6bc20b3c2a0a4d6d00844f29a341af3
|
|
« Last Edit: April 01, 2014, 10:24:53 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|