Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # THIS SCRIPT SHOULD BE USED WITH FREEPIE
- # http://andersmalmgren.github.io/FreePIE/
- #--------------------------------------------------------------------------------------
- # CONTROLLER-CONFIG:
- #--------------------------------------------------------------------------------------
- # Unfortunately, when plugging Xbox/Playstation/Wii Guitar Hero Controllers into your
- # PC, chances are, that they don't really behave as they should.
- # To make it work with this script, some configuring needed.
- # The default config is for a GH X-plorer
- # (the one they sold for Xbox/PC with Guitar Hero [4] World Tour)
- # with no other controller plugged in.
- # So if you got one of those you're in luck.
- #
- # Let's go: Assuming you successfully installed the controller
- # (3rd party software may be needed), you need to get an overview.
- # Type "joy.cpl" in the Windows search bar and press enter to open your game controller
- # control panel.
- # If you have multiple controllers, you need to count down the list from the top
- # (1,2,3..) and use the number the GH controller is placed at in
- # "JoystickNumber = X"
- #
- # Go into the "properties", press your controller buttons and note which number is
- # flashing for each fret button.
- # If you're unlucky, from green to orange, this wont be 1,2,3,4,5 but 2,4,5,3,1 etc.
- # Enter the exact consecutive green to orange numbering you oberserved in
- # "Button1_Green = X" to "Button5_Orange = Z"
- #
- # At last we need to configure the strum bar.
- # Technically this is implemented as a "POV-hat". If it's not on your Controller
- # (and some axis is used instead) unfortunatelly you need to rewrite the
- # "joystick[x].pov[y] parts of the script and adept it for an axis but you can use
- # the same principle.
- #
- # The script needs the default (not pressed) value of the POV-hat to differenciate it
- # from the non-default value when it's pressed.
- # Start the script and observe the "Watch" tab.
- # Write the value you get when not pressing the bar into "DefaultBarValue = X".
- #
- # That's it! You configured your GH controller for this script!
- #------------------------------------------------------------------------------------
- JoystickNumber = 1
- Button1_Green = 1
- Button2_Red = 2
- Button3_Yellow = 4
- Button4_Blue = 3
- Button5_Orange = 5
- DefaultBarValue = -1
- # !!!script code starts from here!!!
- #---------------
- # POV-Diagnostics
- #---------------
- diagnostics.watch(joystick[0].pov[0])
- if starting:
- #------------------------------------------------
- # config-value-transformation
- #------------------------------------------------
- j = JoystickNumber - 1
- b1 = Button1_Green - 1
- b2 = Button2_Red - 1
- b3 = Button3_Yellow - 1
- b4 = Button4_Blue - 1
- b5 = Button5_Orange -1
- p = DefaultBarValue
- #-------------------------------------------------
- # declare some cycle-persisting variables at start:
- #-------------------------------------------------
- BarIsPressed = 0
- ButtonIsPressed=[0,0,0,0,0]
- LastHOPOButton = 5
- # If LastHOPOButton equals 5, no button has been pressed in a HOPO-mode Session
- #----------------------------------------------------------------------
- # check for not pressed, pressed and recently pressed stuff
- #----------------------------------------------------------------------
- #check for not pressed buttons
- if joystick[j].getDown(b1) == 0:
- ButtonIsPressed[0] = 0
- if joystick[j].getDown(b2) == 0:
- ButtonIsPressed[1] = 0
- if joystick[j].getDown(b3) == 0:
- ButtonIsPressed[2] = 0
- if joystick[j].getDown(b4) == 0:
- ButtonIsPressed[3] = 0
- if joystick[j].getDown(b5) == 0:
- ButtonIsPressed[4] = 0
- #ButtonJustDown variable
- ButtonJustDown=[0,0,0,0,0]
- #check for currently pressed and possibly just pressed buttons
- if joystick[j].getDown(b1):
- if ButtonIsPressed[0] == 0:
- ButtonJustDown[0] = 1
- ButtonIsPressed[0] = 1
- if joystick[j].getDown(b2):
- if ButtonIsPressed[1] == 0:
- ButtonJustDown[1] = 1
- ButtonIsPressed[1] = 1
- if joystick[j].getDown(b3):
- if ButtonIsPressed[2] == 0:
- ButtonJustDown[2] = 1
- ButtonIsPressed[2] = 1
- if joystick[j].getDown(b4):
- if ButtonIsPressed[3] == 0:
- ButtonJustDown[3] = 1
- ButtonIsPressed[3] = 1
- if joystick[j].getDown(b5):
- if ButtonIsPressed[4] == 0:
- ButtonJustDown[4] = 1
- ButtonIsPressed[4] = 1
- # check for not pressed strum bar and reset HOPO Session if true
- if joystick[j].pov[0] == p:
- BarIsPressed = 0
- LastHOPOButton = 5
- #----------------------------------------------------------------------------------
- # HOPO-mode: If the strum bar is pressed, check if a hammered button is different to
- # the last one and, if true, do the thing
- # No repeated same button Hammer-Ons allowed in this script, because of TRVENESS
- # (unless you press 1-5 Number Keys :-D)!
- #----------------------------------------------------------------------------------
- elif ButtonJustDown[4] and LastHOPOButton != 4:
- keyboard.setPressed(Key.D5)
- LastHOPOButton = 4
- elif ButtonJustDown[3] and LastHOPOButton != 3:
- keyboard.setPressed(Key.D4)
- LastHOPOButton = 3
- elif ButtonJustDown[2] and LastHOPOButton != 2:
- keyboard.setPressed(Key.D3)
- LastHOPOButton = 2
- elif ButtonJustDown[1] and LastHOPOButton != 1:
- keyboard.setPressed(Key.D2)
- LastHOPOButton = 1
- elif ButtonJustDown[0] and LastHOPOButton != 0:
- keyboard.setPressed(Key.D1)
- LastHOPOButton = 0
- #-------------------------------------------
- # button handover in case of actual strumming
- #-------------------------------------------
- if BarIsPressed == 0 and joystick[j].pov[0] != p:
- BarIsPressed = 1
- if ButtonIsPressed[4]:
- keyboard.setPressed(Key.D5)
- elif ButtonIsPressed[3]:
- keyboard.setPressed(Key.D4)
- elif ButtonIsPressed[2]:
- keyboard.setPressed(Key.D3)
- elif ButtonIsPressed[1]:
- keyboard.setPressed(Key.D2)
- elif ButtonIsPressed[0]:
- keyboard.setPressed(Key.D1)
Advertisement
Add Comment
Please, Sign In to add comment