FreePIE for Magicka and vJoy

Official forum for open source FreePIE discussion and development.
Post Reply
Jantin
One Eyed Hopeful
Posts: 2
Joined: Thu Jan 14, 2016 2:56 am

FreePIE for Magicka and vJoy

Post by Jantin »

That's my first post here, so I'd start with hello to everybody :)

I want to ask about scripting in FreePIE. I see it's in Python (and I know its syntax well enough I think to do the job), but I can't grasp how do I actually map buttons on a physical controller to a virtual (say, a generic pad to vJoy).
My problem is mapping physical inputs to virtual outputs to achieve the effect described in a thread on Steam forums in the game Magicka: http://forums.steampowered.com/forums/s ... ?t=1744091 (first post). The script there is written for GlovePIE and PPJoy and I, in essence, would like to rewrite it for FreePIE and vJoy, as my Magicka doesn't recognise PPJoy virtual controller, but has no problem with vJoy. What is the exact syntax of button1 = button2? How do I know what names do my buttons have? Does Read-only for vJoy in FreePIE mean, that it'll be in essence impossible to do?
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE for Magicka and vJoy

Post by CyberVillain »

Hi and welcome.

You can use the code completion in freepie to get all the names of the properties on the plugins. ctrl+space will bring up the code completion if you do it from a blank script file

ANy way, sometjing like this in FreePIE for the first lines

Code: Select all

//JOYSTICK PARAMETERS

//Left stick
vJoy[0].x = joystick[0].x
vJoy[0].y = joystick[0].y


//Face buttons Back, Start OR Select, Start
vJoy[0].setButton(0, joystick[0].getDown(0))
vJoy[0].setButton(3, joystick[0].getDown(3))
If you need to wait you can do

Code: Select all

import time

time.sleep(0.3)
Although I'm not that fond in blocking the main script thread like that
Jantin
One Eyed Hopeful
Posts: 2
Joined: Thu Jan 14, 2016 2:56 am

Re: FreePIE for Magicka and vJoy

Post by Jantin »

Thank you for the answers. As a newbie to controller programming I just need to ask: When typing

Code: Select all

//Face buttons Back, Start OR Select, Start
vJoy[0].setButton(0, joystick[0].getDown(0))
vJoy[0].setButton(3, joystick[0].getDown(3))
how do you know, that face buttons are numbers 0 and 3 on a joystick? Is a "cheat-sheet" in GlovePIE, which lights numbers when I press buttons, a good reference?
Also when mapping pov hat I assume I use

Code: Select all

# POV hat
vJoy[0].setAnalogPov(0,joystick[0].getDown(<number pov hat has on my joy>))
instead of setButton()?
Although I'm not that fond in blocking the main script thread like that
I'm not sure, but it may be necessary for the game to understand the player is pulling right-then-down, not right-oopsnotthisone-down, which makes a significant difference in Magicka.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FreePIE for Magicka and vJoy

Post by CyberVillain »

Hmm, i think the joystick plugin only exposes the digital pov,

have a look at joystick[0].pov[0] and see what it outputs
Post Reply

Return to “FreePIE”