GlovePIE script to FreePIE

Official forum for open source FreePIE discussion and development.
Post Reply
Davvid
One Eyed Hopeful
Posts: 2
Joined: Tue Mar 12, 2019 12:52 pm

GlovePIE script to FreePIE

Post by Davvid »

Hi

I can't figure out how to translate a GlovePIE script to FreePIE:

Code: Select all

Key.C = Joystick.Button8;
Key.V = Joystick.Button7;
if Pressed(Joystick.Button3) then {
     Press(Key.V);
     wait 5ms;
     Release(Key.V);
     wait 5ms;
     Press(Key.V);
     wait 5ms;
     Release(Key.V);
     //press Key.C;
   } else if Released(Joystick.Button3) then {
     Press(Key.C);
     wait 5ms;
     Release(Key.C);
     wait 5ms;
     Press(Key.C);
     wait 5ms;
     Release(Key.C);
     }
end if;
Basically I need to do some single keypresses while holding down a joystick button and then after releasing that button I need to do another set of single keypresses.

Is it possible to achieve it in FreePIE ?
TIA.
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: GlovePIE script to FreePIE

Post by FrenchyKiel »

the difficulty here is to do a double down an up for the same key so : and its python...

Code: Select all

if starting:
	#if your jostick is number 0, 
	# or you could give the name of stick
	# j = joystick["name of stick"]
	j = joystick[0]
	press_again = Key.Stop

keyboard.setKey(Key.C, j.getDown(8))
keyboard.setKey(Key.V, j.getDown(7))

if press_again != Key.Stop and keyboard.getUp(press_again):
	keyboard.setPressed(press_again)
	press_again = Key.Stop
	
if j.getPressed(3):
	keyboard.setPressed(Key.V)
	press_again= Key.V

if j.getReleased(3):
	keyboard.setPressed(Key.C)
	press_again= Key.C

Davvid
One Eyed Hopeful
Posts: 2
Joined: Tue Mar 12, 2019 12:52 pm

Re: GlovePIE script to FreePIE

Post by Davvid »

Hi,
Thanks, it works! I know nothing about Python unfortunately but GlovePIE stopped working in my game and I needed something to replace it.

I know you said it's difficult to do a double tap but would it be possible to adapt your script for triple or even quadruple tap of the same keyboard key? Or is it out of question ? Thanks for your time.

Edit@down:
Thanks again, perfect.
Last edited by Davvid on Sun Aug 25, 2019 1:22 pm, edited 1 time in total.
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: GlovePIE script to FreePIE

Post by FrenchyKiel »

if you want more taps, you just indicate the number of expected taps in variable nbr_tap!

Code: Select all

if starting:
	#if your jostick is number 0,
	# or you could give the name of stick
	# j = joystick["name of stick"]
	j = joystick[0]
	press_again = Key.Stop
	nbr_tap = 4
	tap = 0

keyboard.setKey(Key.C, j.getDown(8))
keyboard.setKey(Key.V, j.getDown(7))

if press_again != Key.Stop and keyboard.getUp(press_again):
	keyboard.setPressed(press_again)
	if tap > 1:
		tap = tap - 1
	else:
		tap = 0;
		press_again = Key.Stop
   
if tap == 0 and j.getPressed(3):
	tap = nbr_tap
	press_again= Key.V
	
if tap == 0 and j.getReleased(3):
	tap = nbr_tap
	press_again= Key.C
jonray
One Eyed Hopeful
Posts: 1
Joined: Tue Jul 02, 2019 11:07 am

Re: GlovePIE script to FreePIE

Post by jonray »

Some years ago i did the following script for glovepie, it is possible to obtain it with freepie and vjoy?

Code: Select all


if (starting) then
  var.modep1    = 0
  Wiimote1.Led1 = 1
  Wiimote1.Led2 = 0
  Wiimote1.Led3 = 0
  Wiimote1.Led4 = 0
endif

// Mode swap function when pressing Home button.

if (Wiimote1.Home) then
  if (var.modep1 == 0) then
    var.modep1    = 1
    Wiimote1.Led1 = 0
    Wiimote1.Led2 = 1
   elseif (var.modep1 == 1) then
    var.modep1    = 0
    Wiimote1.Led1 = 1
    Wiimote1.Led2 = 0
   endif
  wait 300ms
endif

// NunChuck Controls

  //-- Mode 1 - Nunchuck disabled (move with wiimote tilt and pitch)
  //-- Arwing
if (var.modep1 == 0) then
    ppjoy1.Analog0 = smooth(removeunits(maprange(wiimote.SmoothPitch, -80, 80, -1, 1)))
    ppjoy1.Analog1 = smooth(removeunits(-maprange(wiimote.SmoothRoll, -80, 80, -1, 1)))
    
    PPJoy1.Digital0 = Wiimote.A  // U-Turn
    PPJoy1.Digital1 = Wiimote.B
    ppjoy1.Digital2 = Wiimote.Plus // start
    ppjoy1.Digital3 = Wiimote.Minus
    ppjoy1.Digital4 = Wiimote.1  // Bomb
    ppjoy1.Digital5 = Wiimote.2  // Shoot
    ppjoy1.Digital6 = Wiimote.home  // Change mode

    ppjoy1.Digital7 = Wiimote1.Up
    PPJoy1.Digital8 = Wiimote1.Left    // Brake
    PPJoy1.Digital9 = Wiimote1.Right   // Boost
    ppjoy1.Digital10 = Wiimote1.Down   // Loop
    ppjoy1.Digital11 = space // button 12 added to use later

  //-- Mode 2 - Nunchuck Analog Inputs
elseif (var.modep1 == 1) then
    PPJoy1.Analog0 = Wiimote1.Nunchuk.JoyX * (1 + 0.45 * abs(Wiimote1.Nunchuk.JoyY))
    PPJoy1.Analog1 = -Wiimote1.Nunchuk.JoyY * (1 + 0.45 * abs(Wiimote1.Nunchuk.JoyX))

    PPJoy1.Digital7 = Wiimote1.Nunchuk.ZButton  // Roll
    PPJoy1.Digital8  = Wiimote1.Nunchuk.CButton  // Aim
    PPJoy1.Digital5 = Wiimote.A  // Shoot
    ppjoy1.Digital3 = Wiimote.Minus // Get in or get out wehicle
    PPJoy1.Digital9 = Wiimote.B   // Jump / Hover
    ppjoy1.Digital4 = Wiimote1.1  // Boost
    PPJoy1.Digital0 = Wiimote1.Right // change weapon+
    PPJoy1.Digital11 = Wiimote1.Left // change weapon-
    ppjoy1.Digital2 = Wiimote.Plus   //start button
endif
  
Post Reply

Return to “FreePIE”