It is currently Mon Feb 17, 2020 11:47 am



Reply to topic  [ 5 posts ] 
 GlovePIE script to FreePIE 
Author Message
One Eyed Hopeful

Joined: Tue Mar 12, 2019 12:52 pm
Posts: 2
Reply with quote
Hi

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

Code:
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.


Tue Mar 12, 2019 12:56 pm
Profile
One Eyed Hopeful

Joined: Thu Oct 03, 2013 7:10 am
Posts: 47
Reply with quote
the difficulty here is to do a double down an up for the same key so : and its python...

Code:
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



Sat Mar 16, 2019 5:58 am
Profile
One Eyed Hopeful

Joined: Tue Mar 12, 2019 12:52 pm
Posts: 2
Reply with quote
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.



Mon Mar 18, 2019 4:23 pm
Profile
One Eyed Hopeful

Joined: Thu Oct 03, 2013 7:10 am
Posts: 47
Reply with quote
if you want more taps, you just indicate the number of expected taps in variable nbr_tap!

Code:
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


Wed Mar 20, 2019 9:14 am
Profile
One Eyed Hopeful

Joined: Tue Jul 02, 2019 11:07 am
Posts: 1
Reply with quote
Some years ago i did the following script for glovepie, it is possible to obtain it with freepie and vjoy?
Code:

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
 


Tue Jul 02, 2019 11:16 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.