death_au's All-in-one GH Wii FoF/iX GlovePIE script

Discuss mods and get help with mods ONLY
This topic is 15 years and 4 months old. Instead of replying, please begin a new topic, or search for another related topic that may be more suitable.
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Sat Mar 21, 2009 7:52 pm

I was working on this a while ago in this thread, but I must confess that I mostly stick around this forum section and as such was loosing track of stuff happening in the other thread.

If you have Guitar Hero 3 / World Tour for the Wii, and wish to use your Wii Remote based instruments with Frets on Fire / FoFiX, this is the thread for you. I have written up a GlovePIE script that should allow all Wii instruments (Including the World Tour guitar and drums) to work almost seamlessly with FoFiX (and by extension FoF and other mods as well).
Please note that to use this script, you must have GlovePIE 3.0 or greater [direct link to 3.0 here]

Version 0.81 of my script can be downloaded from here: http://www.mediafire.com/?almnummwywh
or you can copy-paste the following into GlovePIE:

Code: Select all

/*
// FoFiX World Tour multplayer multi-instrument script
// Version 0.81 by Death_au
// (bug fix by kirezar, Maurice10)
//
// Play as player 1 or two on any instrument (GH3/WT)
// Press the minus (-) button on the Wiimote (not the instrument)
// to change player. Check leds to see which wiimote and player
// your instrument is bound to:
//  []   []   []   []
//  1    2    1    2
// Wiimote#  Player#
//
// Change script settings and key bindings just below as you wish.
*/
//do not delete this line:
if(!var.OptionsInit)
/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/                       Script Settings:                         /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//Enable Analog whammy?
//(at least one PPJoy virtual joystick must be installed, with at least 2 axis)
var.Guitar1.AnalogWhammy = false
var.Guitar2.AnalogWhammy = false

//Enable Analog slider bar?
//(at least one PPJoy virtual joystick must be installed, with at least 2 axis)
var.Guitar1.AnalogSlider = false
var.Guitar2.AnalogSlider = false

//Tilt required for star power to activate (set to >100 to disable)
var.Guitar1.MinTilt = 18
var.Guitar2.MinTilt = 18

//Rumble the Wiimote if guitar is tilted for star power
var.Guitar1.StarPowerRumble = true
var.Guitar2.StarPowerRumble = true

//World Tour style drum star power activation
//(hit yellow + orange to activate)
var.Drum1.WTStarpower = false
var.Drum2.WTStarpower = false
//if you hit yellow+orange to activate starpower, they don't register in-game
var.Drum1.WTStarpowerDisableHit = true
var.Drum2.WTStarpowerDisableHit = true

//What pad to map the orange pad to (since it's not used in FoFiX)
//(valid options: "BLUE", "GREEN", "YELLOW", "RED", "BASS", "NONE")
var.Drum1.OrangeMap = "BLUE"
var.Drum2.OrangeMap = "BLUE"

//use the pad information in Exp2 instead of Exp 5
//(the pads will register quicker, reccomended)
var.Drum1.UseVelocityPads = true
var.Drum2.UseVelocityPads = true

//do not edit this line
var.OptionsInit = true
endif
/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/                        Control Mapping                         /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//P1 Guitar
Key.Enter            = var.Guitar1.StrumUp
Key.RightShift       = var.Guitar1.StrumDown
Key.F1               = var.Guitar1.Green
Key.F2               = var.Guitar1.Red
Key.F3               = var.Guitar1.Yellow
Key.F4               = var.Guitar1.Blue
Key.F5               = var.Guitar1.Orange
Key.Left             = var.Guitar1.Left
Key.Right            = var.Guitar1.Right
Key.Up               = var.Guitar1.Up
Key.Down             = var.Guitar1.Down
Key.Escape           = var.Guitar1.Plus //defined as "start" button in FoFiX
Key.PageDown         = var.Guitar1.StarPower
if(var.Guitar1.AnalogWhammy)
ppjoy.Analog0       = var.Guitar1.Whammy
else //Digital Killswitch button:
Key.PageUp          = var.Guitar1.Whammy
endif
if(var.Guitar1.AnalogSlider)
ppjoy.Analog1       = var.Guitar1.SliderA
else //map to solo fret buttons (new in FoFiX)
Key.F6              = var.Guitar1.Slider.Green
Key.F7              = var.Guitar1.Slider.Red
Key.F8              = var.Guitar1.Slider.Yellow
Key.F9              = var.Guitar1.Slider.Blue
Key.F10             = var.Guitar1.Slider.Orange
endif

//P2 Guitar
Key.Delete           = var.Guitar2.StrumUp
Key.Insert           = var.Guitar2.StrumDown
Key.One              = var.Guitar2.Green
Key.Two              = var.Guitar2.Red
Key.Three            = var.Guitar2.Yellow
Key.Four             = var.Guitar2.Blue
Key.Five             = var.Guitar2.Orange
Key.Left             = var.Guitar2.Left
Key.Right            = var.Guitar2.Right
Key.Up               = var.Guitar2.Up
Key.Down             = var.Guitar2.Down
Key.Console          = var.Guitar2.Plus
Key.Home             = var.Guitar2.StarPower //Minus button
if(var.Guitar2.AnalogWhammy)
ppjoy.Analog2       = var.Guitar2.Whammy
else //Digital Killswitch button:
Key.End             = var.Guitar2.Whammy
endif
if(var.Guitar2.AnalogSlider)
ppjoy.Analog3       = var.Guitar2.SliderA
else //map to solo fret buttons (new in FoFiX)
Key.F6              = var.Guitar2.Slider.Green
Key.F7              = var.Guitar2.Slider.Red
Key.F8              = var.Guitar2.Slider.Yellow
Key.F9              = var.Guitar2.Slider.Blue
Key.F10             = var.Guitar2.Slider.Orange
endif

//P1 Drum
Key.Space            = var.Drum1.Bass
Key.A                = var.Drum1.Red
Key.E                = var.Drum1.Yellow
Key.T                = var.Drum1.Blue
//Key.Y                = var.Drum1.Orange  //uncomment to change key binding for orange pad
Key.U                = var.Drum1.Green
Key.Up               = var.Drum1.Up
Key.Down             = var.Drum1.Down
Key.Left             = var.Drum1.Left
Key.Right            = var.Drum1.Right
Key.Escape           = var.Drum1.Plus
Key.PageDown         = var.Drum1.StarPower //minus button

//P2 Drum
Key.L                = var.Drum2.Bass
Key.Z                = var.Drum2.Red
Key.D                = var.Drum2.Yellow
Key.G                = var.Drum2.Blue
//Key.H                = var.Drum2.Orange //uncomment to change key binding for orange pad
Key.J                = var.Drum2.Green
Key.Up               = var.Drum2.Up
Key.Down             = var.Drum2.Down
Key.Left             = var.Drum2.Left
Key.Right            = var.Drum2.Right
Key.Console          = var.Drum2.Plus
Key.End              = var.Drum2.StarPower //Minus button


/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/ DO NOT EDIT THIS SECTION UNLESS YOU KNOW WHAT YOU'RE DOING!!!! /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//Get the number of wiimotes
var.count = Wiimote.Count
if(!var.init)
//initialization code:

//Set initial "player"
var.Wiimote1Player = 1
var.Wiimote2Player = 2
//set the glove pie refresh rate:
PIE.FrameRate = 300Hz

//Detection for expansion controllers
var.Wiimote1Instrument = "NOT RECOGNISED"
var.Wiimote2Instrument = "NOT RECOGNISED"

//end init
var.init = true
endif

//detect if controllers were unplugged
if(!Wiimote1.Expansion)
  var.Wiimote1Instrument = "NO EXPANSION"
endif
if(!Wiimote2.Expansion)
  var.Wiimote2Instrument = "NO EXPANSION"
endif

  if(Wiimote1.Expansion && var.Wiimote1Instrument == "NO EXPANSION")  //Something just got plugged in
    wait 100ms
    if(Wiimote1.HasGuitar)  //A GH3 Guitar
      var.Wiimote1Instrument = "GH3"
    else //Not a GH3 Guitar, try the wakeup code:
      WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
      wait 100ms
      WiimotePoke(1, 0x4A400FB, 0) // Unknown
      wait 100ms
      WiimotePoke(1, 0x4A40040, 0)
      wait 100ms
      WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type
      wait 100ms
     //check for the instrument again
     if(Wiimote1.HasGuitar) //GH4 Instrument found, check for drum/guitar
       if(|(1-((wiimote1.Exp2 & 128) >> 7))| == 1) // Guitar
         var.Wiimote1Instrument = "GH4"
       else //Must be drum
         var.Wiimote1Instrument = "DRUM"
       endif
     else //no gh4 instrument either
       var.Wiimote1Instrument = "NOT RECOGNISED"
     endif
    endif
  endif

if(var.Count > 1) //2 (or more) wiimotes
  //Check Expansion Type
  if(Wiimote2.Expansion && var.Wiimote1Instrument == "NO EXPANSION")  //Something just got plugged in
    wait 100ms
    if(Wiimote2.HasGuitar)  //A GH3 Guitar
      var.Wiimote2Instrument = "GH3"
    else //Not a GH3 Guitar, try the wakeup code:
      WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
      wait 100ms
      WiimotePoke(1, 0x4A400FB, 0) // Unknown
      wait 100ms
      WiimotePoke(1, 0x4A40040, 0)
      wait 100ms
      WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type
      wait 100ms
      //check for the instrument again
      if(Wiimote2.HasGuitar) //GH4 Instrument found, check for drum/guitar
        if(|(1-((Wiimote2.Exp2 & 128) >> 7))| == 1) // Guitar
          var.Wiimote2Instrument = "GH4"
        else //Must be drum
          var.Wiimote2Instrument = "DRUM"
        endif
      else //no gh4 instrument either
        var.Wiimote2Instrument = "NOT RECOGNISED"
      endif
    endif
  endif
endif //2 (or more) wiimotes

debug = "Wiimote1: " + var.Wiimote1Player + "; " + var.Wiimote1Instrument
debug += "; Wiimote2: " + var.Wiimote2Player + "; " + var.Wiimote2Instrument

//Player switching / display code
//swap Wimmote 1/2 players
if(pressed(Wiimote1.Minus) OR pressed(Wiimote1.Plus) OR pressed(Wiimote2.Minus) OR pressed(Wiimote2.Plus))
  if(var.Wiimote1Player == 1)
    var.Wiimote1Player = 2
    var.Wiimote2Player = 1
  else
    var.Wiimote1Player = 1
    var.Wiimote2Player = 2
  endif
endif

//display wiimote1 info
Wiimote1.Led1 = true
Wiimote1.Led2 = false
if(var.Wiimote1Player == 1)
  Wiimote1.Led3 = true
  Wiimote1.Led4 = false
else if(var.Wiimote1Player == 2)
  Wiimote1.Led3 = false
  Wiimote1.Led4 = true
else
  Wiimote1.Led3 = false
  Wiimote1.Led4 = false
endif

//////////////////////////////////////////////////////////////
// Controller mappings:
//////////////////////////////////////////////////////////////
// GH3 Guitar
//////////////////////////////////////////////////////////////
if(var.Wiimote1Instrument == "GH3")
  // Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Guitar1.Left  = (-1.2 < Wiimote1.Guitar.JoyX < -0.5)
    var.Guitar1.Right = ( 0.5 < Wiimote1.Guitar.JoyX <  1.2)
    var.Guitar1.Up    = (-1.2 < Wiimote1.Guitar.JoyY < -0.5)
    var.Guitar1.Down  = ( 0.5 < Wiimote1.Guitar.JoyY <  1.2)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote1.Guitar.Fret1
    var.Guitar1.Red     = Wiimote1.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote1.Guitar.Fret5

    //Strumming
    var.Guitar1.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote1.Guitar.StrumDown   

    //Star Power
    var.Guitar1.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
  //Player 2
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Guitar2.Left  = (-1.2 < Wiimote1.Guitar.JoyX < -0.5)
    var.Guitar2.Right = ( 0.5 < Wiimote1.Guitar.JoyX <  1.2)
    var.Guitar2.Up    = (-1.2 < Wiimote1.Guitar.JoyY < -0.5)
    var.Guitar2.Down  = ( 0.5 < Wiimote1.Guitar.JoyY <  1.2)

    // Fret Buttons
    var.Guitar2.Green   = Wiimote1.Guitar.Fret1
    var.Guitar2.Red     = Wiimote1.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Guitar
//////////////////////////////////////////////////////////////
elseif(var.Wiimote1Instrument == "GH4")
  //Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Guitar1.Left  = (Wiimote1.Exp0 < 25)
    var.Guitar1.Right = (Wiimote1.Exp0 > 40)
    var.Guitar1.Down  = (Wiimote1.Exp1 > 40)
    var.Guitar1.Up    = (Wiimote1.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote1.Guitar.Fret1
    var.Guitar1.Red     = Wiimote1.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar1.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar1.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
    //Slider bar
    if(var.Guitar1.AnalogSlider)
      var.Guitar1.SliderA = (Wiimote1.Exp2 / 15.8) - 1.12
    else
      var.Guitar1.Slider.Green =  (      Wiimote1.Exp2 < 9 )
      var.Guitar1.Slider.Red =    (6  <= Wiimote1.Exp2 < 14)
      var.Guitar1.Slider.Yellow = (11 <= Wiimote1.Exp2 < 14) or (17 <= Wiimote1.Exp2 < 22)
      var.Guitar1.Slider.Blue =   (20 <= Wiimote1.Exp2 < 28)
      var.Guitar1.Slider.Orange = (25 <= Wiimote1.Exp2 <=32)
    endif
   
    /*   
    G    -  04     -       < 6
    GR   -  07     - 6  <= < 9
    R    -  10     - 9  <= < 11                               g - (       < 9 )
    RY   -  12/13  - 11 <= < 14                               r - (6  <=  < 14)
    NONE -  15     - 14 <= < 17                               y - (11 <=  < 14) && (17 <= < 22)
    Y    -  18/19  - 17 <= < 20                               b - (20 <=  < 28)
    YB   -  20/21  - 20 <= < 22                               o - (  >=25)
    B    -  23/24  - 22 <= < 25
    BO   -  26     - 25 <= < 28
    O    -  31     - >=28
    */
   
   
   
 
  //Player 2
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Guitar2.Left  = (Wiimote1.Exp0 < 25)
    var.Guitar2.Right = (Wiimote1.Exp0 > 40)
    var.Guitar2.Down  = (Wiimote1.Exp1 > 40)
    var.Guitar2.Up    = (Wiimote1.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar2.Green   = Wiimote1.Guitar.Fret1
    var.Guitar2.Red     = Wiimote1.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
    //Slider bar
    if(var.Guitar2.AnalogSlider)
      var.Guitar2.SliderA = (Wiimote1.Exp2 / 15.8) - 1.12
    else
      var.Guitar2.Slider.Green =  (      Wiimote1.Exp2 < 9 )
      var.Guitar2.Slider.Red =    (6  <= Wiimote1.Exp2 < 14)
      var.Guitar2.Slider.Yellow = (11 <= Wiimote1.Exp2 < 14) or (17 <= Wiimote1.Exp2 < 22)
      var.Guitar2.Slider.Blue =   (20 <= Wiimote1.Exp2 < 28)
      var.Guitar2.Slider.Orange = (25 <= Wiimote1.Exp2 <=32)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Drums
//////////////////////////////////////////////////////////////
elseif(var.Wiimote1Instrument == "DRUM")
  //Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Drum1.Left  = (Wiimote1.Exp0 < 25)
    var.Drum1.Right = (Wiimote1.Exp0 > 40)
    var.Drum1.Down  = (Wiimote1.Exp1 > 40)
    var.Drum1.Up    = (Wiimote1.Exp1 < 25)

    // Drum pads
    if(var.Drum1.UseVelocityPads)
      var.Drum1.Bass    = (Wiimote1.Exp2=182 or Wiimote1.Exp2=183)
      var.Drum1.Red     = (Wiimote1.Exp2=178 or Wiimote1.Exp2=179)
      var.Drum1.Yellow  = (Wiimote1.Exp2=162 or Wiimote1.Exp2=163)
      var.Drum1.Blue    = (Wiimote1.Exp2=158 or Wiimote1.Exp2=159)
      var.Drum1.Green   = (Wiimote1.Exp2=164 or Wiimote1.Exp2=165)
      var.Drum1.Orange  = (Wiimote1.Exp2=156 or Wiimote1.Exp2=157)
    else
      var.Drum1.Bass    = |(1-((wiimote1.Exp5 & 4)   >> 2))|
      var.Drum1.Red     = |(1-((wiimote1.Exp5 & 64)  >> 6))|
      var.Drum1.Yellow  = |(1-((wiimote1.Exp5 & 32)  >> 5))|
      var.Drum1.Blue    = |(1-((wiimote1.Exp5 & 8)   >> 3))|
      var.Drum1.Green   = |(1-((wiimote1.Exp5 & 16)  >> 4))|
      var.Drum1.Orange  = |(1-((wiimote1.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum1.WTStarpower AND var.Drum1.Yellow AND var.Drum1.Orange)
      var.Drum1.StarPower = true
      if(var.Drum1.WTStarpowerDisableHit)
        var.Drum1.Yellow = false
        var.Drum1.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum1.StarPower = var.Drum1.StarPower OR Wiimote1.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum1.Plus = Wiimote1.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum1.OrangeMap == "GREEN")
      var.Drum1.Green = var.Drum1.Green OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "YELLOW")
      var.Drum1.Yellow = var.Drum1.Yellow OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "RED")
      var.Drum1.Red = var.Drum1.Red OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BLUE")
      var.Drum1.Blue = var.Drum1.Blue OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BASS")
      var.Drum1.Bass = var.Drum1.Bass OR var.Drum1.Orange
    endif

  //Player 2
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Drum2.Left  = (Wiimote1.Exp0 < 25)
    var.Drum2.Right = (Wiimote1.Exp0 > 40)
    var.Drum2.Down  = (Wiimote1.Exp1 > 40)
    var.Drum2.Up    = (Wiimote1.Exp1 < 25)

    // Drum pads
    if(var.Drum2.UseVelocityPads)
      var.Drum2.Bass    = (Wiimote1.Exp2=182 or Wiimote1.Exp2=183)
      var.Drum2.Red     = (Wiimote1.Exp2=178 or Wiimote1.Exp2=179)
      var.Drum2.Yellow  = (Wiimote1.Exp2=162 or Wiimote1.Exp2=163)
      var.Drum2.Blue    = (Wiimote1.Exp2=158 or Wiimote1.Exp2=159)
      var.Drum2.Green   = (Wiimote1.Exp2=164 or Wiimote1.Exp2=165)
      var.Drum2.Orange  = (Wiimote1.Exp2=156 or Wiimote1.Exp2=157)
    else
      var.Drum2.Bass    = |(1-((wiimote1.Exp5 & 4)   >> 2))|
      var.Drum2.Red     = |(1-((wiimote1.Exp5 & 64)  >> 6))|
      var.Drum2.Yellow  = |(1-((wiimote1.Exp5 & 32)  >> 5))|
      var.Drum2.Blue    = |(1-((wiimote1.Exp5 & 8)   >> 3))|
      var.Drum2.Green   = |(1-((wiimote1.Exp5 & 16)  >> 4))|
      var.Drum2.Orange  = |(1-((wiimote1.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum2.WTStarpower AND var.Drum2.Yellow AND var.Drum2.Orange)
      var.Drum2.StarPower = true
      if(var.Drum2.WTStarpowerDisableHit)
        var.Drum2.Yellow = false
        var.Drum2.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum2.StarPower = var.Drum2.StarPower OR Wiimote1.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum2.Plus = Wiimote1.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum2.OrangeMap == "GREEN")
      var.Drum2.Green = var.Drum2.Green OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "YELLOW")
      var.Drum2.Yellow = var.Drum2.Yellow OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "RED")
      var.Drum2.Red = var.Drum2.Red OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BLUE")
      var.Drum2.Blue = var.Drum2.Blue OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BASS")
      var.Drum2.Bass = var.Drum2.Bass OR var.Drum2.Orange
    endif
  endif

//No instrument connected
else
  Wiimote1.Led3 = false
  Wiimote1.Led4 = false
  wait 1000ms
endif


///////////////////////////////////////////////////////////////
if(var.count > 1) // Wiimote 2
///////////////////////////////////////////////////////////////

//display wiimote2 info
Wiimote2.Led1 = true
Wiimote2.Led2 = false
if(var.Wiimote2Player == 1)
  Wiimote2.Led3 = true
  Wiimote2.Led4 = false
else if(var.Wiimote2Player == 2)
  Wiimote2.Led3 = false
  Wiimote2.Led4 = true
else
  Wiimote2.Led3 = false
  Wiimote2.Led4 = false
endif

//////////////////////////////////////////////////////////////
// GH3 Guitar
//////////////////////////////////////////////////////////////
if(var.Wiimote2Instrument == "GH3")
  // Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Guitar1.Left  = (-1.2 < Wiimote2.Guitar.JoyX < -0.5)
    var.Guitar1.Right = ( 0.5 < Wiimote2.Guitar.JoyX <  1.2)
    var.Guitar1.Up    = (-1.2 < Wiimote2.Guitar.JoyY < -0.5)
    var.Guitar1.Down  = ( 0.5 < Wiimote2.Guitar.JoyY <  1.2)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote2.Guitar.Fret1
    var.Guitar1.Red     = Wiimote2.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote2.Guitar.Fret5

    //Strumming
    var.Guitar1.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote2.Guitar.StrumDown   

    //Star Power
    var.Guitar1.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
  //Player 2
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Guitar2.Left  = (-1.2 < Wiimote2.Guitar.JoyX < -0.5)
    var.Guitar2.Right = ( 0.5 < Wiimote2.Guitar.JoyX <  1.2)
    var.Guitar2.Up    = (-1.2 < Wiimote2.Guitar.JoyY < -0.5)
    var.Guitar2.Down  = ( 0.5 < Wiimote2.Guitar.JoyY <  1.2)

    // Fret Buttons
    var.Guitar2.Green   = Wiimote2.Guitar.Fret1
    var.Guitar2.Red     = Wiimote2.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Guitar
//////////////////////////////////////////////////////////////
elseif(var.Wiimote2Instrument == "GH4")
  //Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Guitar1.Left  = (Wiimote2.Exp0 < 25)
    var.Guitar1.Right = (Wiimote2.Exp0 > 40)
    var.Guitar1.Down  = (Wiimote2.Exp1 > 40)
    var.Guitar1.Up    = (Wiimote2.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote2.Guitar.Fret1
    var.Guitar1.Red     = Wiimote2.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar1.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar1.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
    //Slider bar
    if(var.Guitar1.AnalogSlider)
      var.Guitar1.SliderA = (Wiimote2.Exp2 / 15.8) - 1.12
    else
      var.Guitar1.Slider.Green =  (      Wiimote2.Exp2 < 9 )
      var.Guitar1.Slider.Red =    (6  <= Wiimote2.Exp2 < 14)
      var.Guitar1.Slider.Yellow = (11 <= Wiimote2.Exp2 < 14) or (17 <= Wiimote2.Exp2 < 22)
      var.Guitar1.Slider.Blue =   (20 <= Wiimote2.Exp2 < 28)
      var.Guitar1.Slider.Orange = (25 <= Wiimote2.Exp2 <=32)
    endif
 
  //Player 2
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Guitar2.Left  = (Wiimote2.Exp0 < 25)
    var.Guitar2.Right = (Wiimote2.Exp0 > 40)
    var.Guitar2.Down  = (Wiimote2.Exp1 > 40)
    var.Guitar2.Up    = (Wiimote2.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar2.Green   = Wiimote2.Guitar.Fret1
    var.Guitar2.Red     = Wiimote2.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
    //Slider bar
    if(var.Guitar2.AnalogSlider)
      var.Guitar2.SliderA = (Wiimote2.Exp2 / 15.8) - 1.12
    else
      var.Guitar2.Slider.Green =  (      Wiimote2.Exp2 < 9 )
      var.Guitar2.Slider.Red =    (6  <= Wiimote2.Exp2 < 14)
      var.Guitar2.Slider.Yellow = (11 <= Wiimote2.Exp2 < 14) or (17 <= Wiimote2.Exp2 < 22)
      var.Guitar2.Slider.Blue =   (20 <= Wiimote2.Exp2 < 28)
      var.Guitar2.Slider.Orange = (25 <= Wiimote2.Exp2 <=32)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Drums
//////////////////////////////////////////////////////////////
elseif(var.Wiimote2Instrument == "DRUMS")
  //Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Drum1.Left  = (Wiimote2.Exp0 < 25)
    var.Drum1.Right = (Wiimote2.Exp0 > 40)
    var.Drum1.Down  = (Wiimote2.Exp1 > 40)
    var.Drum1.Up    = (Wiimote2.Exp1 < 25)

    // Drum pads
    if(var.Drum1.UseVelocityPads)
      var.Drum1.Bass    = (Wiimote2.Exp2=182 or Wiimote2.Exp2=183)
      var.Drum1.Red     = (Wiimote2.Exp2=178 or Wiimote2.Exp2=179)
      var.Drum1.Yellow  = (Wiimote2.Exp2=162 or Wiimote2.Exp2=163)
      var.Drum1.Blue    = (Wiimote2.Exp2=158 or Wiimote2.Exp2=159)
      var.Drum1.Green   = (Wiimote2.Exp2=164 or Wiimote2.Exp2=165)
      var.Drum1.Orange  = (Wiimote2.Exp2=156 or Wiimote2.Exp2=157)
    else
      var.Drum1.Bass    = |(1-((Wiimote2.Exp5 & 4)   >> 2))|
      var.Drum1.Red     = |(1-((Wiimote2.Exp5 & 64)  >> 6))|
      var.Drum1.Yellow  = |(1-((Wiimote2.Exp5 & 32)  >> 5))|
      var.Drum1.Blue    = |(1-((Wiimote2.Exp5 & 8)   >> 3))|
      var.Drum1.Green   = |(1-((Wiimote2.Exp5 & 16)  >> 4))|
      var.Drum1.Orange  = |(1-((Wiimote2.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum1.WTStarpower AND var.Drum1.Yellow AND var.Drum1.Orange)
      var.Drum1.StarPower = true
      if(var.Drum1.WTStarpowerDisableHit)
        var.Drum1.Yellow = false
        var.Drum1.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum1.StarPower = var.Drum1.StarPower OR Wiimote2.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum1.Plus = Wiimote2.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum1.OrangeMap == "GREEN")
      var.Drum1.Green = var.Drum1.Green OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "YELLOW")
      var.Drum1.Yellow = var.Drum1.Yellow OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "RED")
      var.Drum1.Red = var.Drum1.Red OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BLUE")
      var.Drum1.Blue = var.Drum1.Blue OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BASS")
      var.Drum1.Bass = var.Drum1.Bass OR var.Drum1.Orange
    endif

  //Player 2
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Drum2.Left  = (Wiimote2.Exp0 < 25)
    var.Drum2.Right = (Wiimote2.Exp0 > 40)
    var.Drum2.Down  = (Wiimote2.Exp1 > 40)
    var.Drum2.Up    = (Wiimote2.Exp1 < 25)

    // Drum pads
    if(var.Drum2.UseVelocityPads)
      var.Drum2.Bass    = (Wiimote2.Exp2=182 or Wiimote2.Exp2=183)
      var.Drum2.Red     = (Wiimote2.Exp2=178 or Wiimote2.Exp2=179)
      var.Drum2.Yellow  = (Wiimote2.Exp2=162 or Wiimote2.Exp2=163)
      var.Drum2.Blue    = (Wiimote2.Exp2=158 or Wiimote2.Exp2=159)
      var.Drum2.Green   = (Wiimote2.Exp2=164 or Wiimote2.Exp2=165)
      var.Drum2.Orange  = (Wiimote2.Exp2=156 or Wiimote2.Exp2=157)
    else
      var.Drum2.Bass    = |(1-((Wiimote2.Exp5 & 4)   >> 2))|
      var.Drum2.Red     = |(1-((Wiimote2.Exp5 & 64)  >> 6))|
      var.Drum2.Yellow  = |(1-((Wiimote2.Exp5 & 32)  >> 5))|
      var.Drum2.Blue    = |(1-((Wiimote2.Exp5 & 8)   >> 3))|
      var.Drum2.Green   = |(1-((Wiimote2.Exp5 & 16)  >> 4))|
      var.Drum2.Orange  = |(1-((Wiimote2.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum2.WTStarpower AND var.Drum2.Yellow AND var.Drum2.Orange)
      var.Drum2.StarPower = true
      if(var.Drum2.WTStarpowerDisableHit)
        var.Drum2.Yellow = false
        var.Drum2.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum2.StarPower = var.Drum2.StarPower OR Wiimote2.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum2.Plus = Wiimote2.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum2.OrangeMap == "GREEN")
      var.Drum2.Green = var.Drum2.Green OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "YELLOW")
      var.Drum2.Yellow = var.Drum2.Yellow OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "RED")
      var.Drum2.Red = var.Drum2.Red OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BLUE")
      var.Drum2.Blue = var.Drum2.Blue OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BASS")
      var.Drum2.Bass = var.Drum2.Bass OR var.Drum2.Orange
    endif
  endif

//No instrument connected
else
  Wiimote2.Led3 = false
  Wiimote2.Led4 = false
  wait 1000ms
endif


///////////////////////////////////////////////////////////////
endif // end Wiimote 2
///////////////////////////////////////////////////////////////

//END OF FILE

If you have any problems with this script, post them here.

NEW!
kirezar has provided video instructions on how to use this script to set up your
Drums: http://www.youtube.com/watch?v=7VPtrhYAdtA [script for this tutorial]
Wiitar: http://www.youtube.com/watch?v=avt0080ISls [script for this tutorial]

Also, GlovePIE is only for Windows atm, so apologies for no Linux/Mac support yet. If anyone has gotten their Wii instruments working on other OSs, post some instructions and I might add them to this first post.

Note: There are certain... problems with instrument detection occasionally, and if you find you cannot get this script to work for you, you may consider trying out spikehead777's script here: https://www.fretsonfire.org/forums/viewtopic.php?t=38434
Last edited by death_au on Wed Jul 22, 2009 7:45 pm, edited 7 times in total.
kirezar
Member
Posts: 115
Joined: August 30th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby kirezar » Sun Mar 22, 2009 5:25 pm

I seem to have a little problem, or two

1. My GH:WT guitar isn't recognised
2. I can't play with two players, drums and gh 3 guitar, but can use them separatedly
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Sun Mar 22, 2009 7:07 pm

Hmm... There's some stuff missing from the script I remember writing in... When I get some time I'll see if I can't fix up a few of the bugs. Thanks for letting me know about your problems
kirezar
Member
Posts: 115
Joined: August 30th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby kirezar » Tue Mar 24, 2009 1:56 pm

Found out other two bugs

1. The joystick on the drums is in incorrect way (push up, it will go down, and vice-versa)(I already fixed that, but just to let you know)

2. When I stop running the script on drums, and run again, it says No Expansion, but leds light up
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Tue Mar 24, 2009 4:46 pm

kirezar wrote:Found out other two bugs

1. The joystick on the drums is in incorrect way (push up, it will go down, and vice-versa)(I already fixed that, but just to let you know)

2. When I stop running the script on drums, and run again, it says No Expansion, but leds light up

Yeah these are the main two things I thought I'd already addressed. It frustrating that my changes are gone.
Although it's odd about number 2. Usually it tells me that I have a GH3 guitar plugged in, instead of the drums. A workaround for this is, before you run the script a second time, unplug the drum kit for the Wiimote and plug it back in.
I'm going to have to bite the bullet and rewrite that logic...

Thank you for the bug report. I'd forgotten about the upside down joystick issue.
User avatar
gamexprt1
Member
Posts: 1016
Joined: July 16th, 2007
Location: Washington
Reputation: 0
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby gamexprt1 » Tue Mar 24, 2009 4:56 pm

As a relatively good GlovePIE scripter, I must say this script blows mine out of the water. Yours is so very complex and adaptive; you also use a lot of parentheses to better simplify your statements, and I like that.

But there are a few things that I'd like to mention:
1) The PIE.FrameRate should be your screen refresh rate.
2) You overuse // as comment beginning, when you could also use ' and ` to begin comments which would clean up the script.

But again, this is a most amazing job. You always surprise me Death_au!

Graphic Request Thread: viewtopic.php?f=11&t=24983
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Tue Mar 24, 2009 5:07 pm

gamexprt1 wrote:As a relatively good GlovePIE scripter, I must say this script blows mine out of the water. Yours is so very complex and adaptive; you also use a lot of parentheses to better simplify your statements, and I like that.

But there are a few things that I'd like to mention:
1) The PIE.FrameRate should be your screen refresh rate.
2) You overuse // as comment beginning, when you could also use ' and ` to begin comments which would clean up the script.

But again, this is a most amazing job. You always surprise me Death_au!
The frame rate is high because of the drums. If you use the velocity sensitive drum bits, they appear and disappear really quickly, and 60Hz is not enough to capture them (you miss lots). 100Hz should theoretically be enough to capture them, but it never does. If using drums you can experiment with the framerate a bit to see what works for you, if using guitar, you should probably set it back down to 60Hz.

Oh, and I wasn't aware of the other commenting method. I'm used to C-like programming languages, so I always use // by default :tongue:
User avatar
gamexprt1
Member
Posts: 1016
Joined: July 16th, 2007
Location: Washington
Reputation: 0
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby gamexprt1 » Tue Mar 24, 2009 5:15 pm

death_au wrote:
gamexprt1 wrote:As a relatively good GlovePIE scripter, I must say this script blows mine out of the water. Yours is so very complex and adaptive; you also use a lot of parentheses to better simplify your statements, and I like that.

But there are a few things that I'd like to mention:
1) The PIE.FrameRate should be your screen refresh rate.
2) You overuse // as comment beginning, when you could also use ' and ` to begin comments which would clean up the script.

But again, this is a most amazing job. You always surprise me Death_au!
The frame rate is high because of the drums. If you use the velocity sensitive drum bits, they appear and disappear really quickly, and 60Hz is not enough to capture them (you miss lots). 100Hz should theoretically be enough to capture them, but it never does. If using drums you can experiment with the framerate a bit to see what works for you, if using guitar, you should probably set it back down to 60Hz.

Oh, and I wasn't aware of the other commenting method. I'm used to C-like programming languages, so I always use // by default :tongue:

Oh, I wasn't aware about the drum thing. That's some nice information.

Graphic Request Thread: viewtopic.php?f=11&t=24983
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Tue Mar 24, 2009 5:24 pm

There was a lot of experimentation in the tech support thread. It was a breakthrough to be able to turn the WT instruments ON.
If we're lucky though, the next version of GlovePIE will support it all and my script won't have to be anywhere near as complex as it is.
kirezar
Member
Posts: 115
Joined: August 30th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby kirezar » Fri Apr 10, 2009 2:51 pm

I made it to work with two players

Spoiler:

Code: Select all

/*
// FoFiX World Tour multplayer multi-instrument script
// Version 0.7 by Death_au
//
// Play as player 1 or two on any instrument (GH3/WT)
// Press the minus (-) button on the Wiimote (not the instrument)
// to change player. Check leds to see which wiimote and player
// your instrument is bound to:
//  []   []   []   []
//  1    2    1    2
// Wiimote#  Player#
//
// Change script settings and key bindings just below as you wish.
*/
//do not delete this line:
if(!var.init)
/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/                       Script Settings:                         /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//Enable Analog whammy?
//(at least one PPJoy virtual joystick must be installed, with at least 2 axis)
var.Guitar1.AnalogWhammy = false
var.Guitar2.AnalogWhammy = false

//Tilt required for star power to activate (set to >100 to disable)
var.Guitar1.MinTilt = 18
var.Guitar2.MinTilt = 18

//Rumble the Wiimote if guitar is tilted for star power
var.Guitar1.StarPowerRumble = true
var.Guitar2.StarPowerRumble = true

//World Tour style drum star power activation
//(hit yellow + orange to activate)
var.Drum1.WTStarpower = false
var.Drum2.WTStarpower = false
//if you hit yellow+orange to activate starpower, they don't register in-game
var.Drum1.WTStarpowerDisableHit = true
var.Drum2.WTStarpowerDisableHit = true

//What pad to map the orange pad to (since it's not used in FoFiX)
//(valid options: "BLUE", "GREEN", "YELLOW", "RED", "BASS", "NONE")
var.Drum1.OrangeMap = "BLUE"
var.Drum2.OrangeMap = "BLUE"

//use the pad information in Exp2 instead of Exp 5
//(the pads will register quicker, reccomended)
var.Drum1.UseVelocityPads = true
var.Drum2.UseVelocityPads = true

//do not edit this line
endif
/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/                        Control Mapping                         /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//P1 Guitar
Key.Enter           = var.Guitar1.StrumUp
Key.RightShift       = var.Guitar1.StrumDown
Key.F1             = var.Guitar1.Green
Key.F2               = var.Guitar1.Red
Key.F3               = var.Guitar1.Yellow
Key.F4               = var.Guitar1.Blue
Key.F5               = var.Guitar1.Orange
Key.Left             = var.Guitar1.Left
Key.Right            = var.Guitar1.Right
Key.Up               = var.Guitar1.Up
Key.Down             = var.Guitar1.Down
Key.Escape           = var.Guitar1.Plus
Key.PageDown         = var.Guitar1.StarPower
if(var.Guitar1.AnalogWhammy)
 ppjoy.Analog0       = var.Guitar1.Whammy
else //Digital Killswitch button:
 Key.PageUp          = var.Guitar1.Whammy
endif

//P2 Guitar
Key.Delete           = var.Guitar2.StrumUp
Key.Insert           = var.Guitar2.StrumDown
Key.F8               = var.Guitar2.Green
Key.F9               = var.Guitar2.Red
Key.F10              = var.Guitar2.Yellow
Key.F11              = var.Guitar2.Blue
Key.F12              = var.Guitar2.Orange
Key.Left             = var.Guitar2.Left
Key.Right            = var.Guitar2.Right
Key.Up               = var.Guitar2.Up
Key.Down             = var.Guitar2.Down
Key.F7               = var.Guitar2.Plus
Key.Home             = var.Guitar2.StarPower //Minus button
if(var.Guitar2.AnalogWhammy)
 ppjoy.Analog1       = var.Guitar2.Whammy
else //Digital Killswitch button:
 Key.End             = var.Guitar2.Whammy
endif

//P1 Drum
Key.Space            = var.Drum1.Bass
Key.A                = var.Drum1.Red
Key.E                = var.Drum1.Yellow
Key.T                = var.Drum1.Blue
//Key.Y                = var.Drum1.Orange  //uncomment to change key binding for orange pad
Key.U                = var.Drum1.Green
Key.Up               = var.Drum1.Up
Key.Down             = var.Drum1.Down
Key.Left             = var.Drum1.Left
Key.Right            = var.Drum1.Right
Key.Escape           = var.Drum1.Plus
Key.PageDown         = var.Drum1.StarPower //minus button

//P2 Drum
Key.L                = var.Drum2.Bass
Key.Z                = var.Drum2.Red
Key.D                = var.Drum2.Yellow
Key.G                = var.Drum2.Blue
//Key.H                = var.Drum2.Orange //uncomment to change key binding for orange pad
Key.J                = var.Drum2.Green
Key.Up               = var.Drum2.Up
Key.Down             = var.Drum2.Down
Key.Left             = var.Drum2.Left
Key.Right            = var.Drum2.Right
Key.Escape           = var.Drum2.Plus
Key.End              = var.Drum2.StarPower //Minus button


/*////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
/ DO NOT EDIT THIS SECTION UNLESS YOU KNOW WHAT YOU'RE DOING!!!! /
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////*/

//Get the number of wiimotes
var.count = Wiimote.Count
if(!var.init)
//initialization code:

 //Set initial "player"
 var.Wiimote1Player = 1
 var.Wiimote2Player = 2
 //set the glove pie refresh rate:
 PIE.FrameRate = 300Hz
 //end init
 var.init = true
endif

  if(Wiimote1.Expansion)  //Something plugged in
    if(!var.Wiimote1Init)
      wait 100ms
      if(Wiimote1.HasGuitar)  //A GH3 Guitar
        var.Wiimote1Instrument = "GH3"
      else //Not a GH3 Guitar, try the wakeup code:
        WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
        wait 100ms
        WiimotePoke(1, 0x4A400FB, 0) // Unknown
        wait 100ms
        WiimotePoke(1, 0x4A40040, 0)
        wait 100ms
        WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type
        wait 100ms
       //check for the instrument again
       if(Wiimote1.HasGuitar) //GH4 Instrument found, check for drum/guitar
         if(|(1-((wiimote1.Exp2 & 128) >> 7))| == 1) // Guitar
           var.Wiimote1Instrument = "GH4"
         else //Must be drum
           var.Wiimote1Instrument = "DRUM"
         endif
       else //no gh4 instrument either
         var.Wiimote1Instrument = "NOT RECOGNISED"
       endif
      endif
      var.Wiimote1Init = true;
    endif
  else
    var.Wiimote1Instrument = "NO EXPANSION"
    var.Wiimote1Init = false
  endif


 if(var.Count > 1) //2 (or more) wiimotes
  //Set initial "player"
  var.Wiimote2Player = 2

  //Check Expansion Type
  if(Wiimote2.Expansion)  //Something plugged in
    if(!var.Wiimote2Init)
      wait 100ms
      if(Wiimote2.HasGuitar)  //A GH3 Guitar
        var.Wiimote2Instrument = "GH3"
      else //Not a GH3 Guitar, try the wakeup code:
        WiimotePoke(1, 0x4A400F0, 0x55) // Decrypt
        wait 100ms
        WiimotePoke(1, 0x4A400FB, 0) // Unknown
        wait 100ms
        WiimotePoke(1, 0x4A40040, 0)
        wait 100ms
        WiimoteSend(1, 0x17, 0x04, 0xA4, 0x00, 0xF0, 0, 16) // get type
        wait 100ms
       //check for the instrument again
       if(Wiimote2.HasGuitar) //GH4 Instrument found, check for drum/guitar
         if(|(1-((Wiimote2.Exp2 & 128) >> 7))| == 1) // Guitar
           var.Wiimote2Instrument = "GH4"
         else //Must be drum
           var.Wiimote2Instrument = "DRUM"
         endif
       else //no gh4 instrument either
         var.Wiimote2Instrument = "NOT RECOGNISED"
       endif
      endif
      var.Wiimote2Init = true
    endif
  else
    var.Wiimote2Instrument = "NO EXPANSION"
    var.Wiimote2Init = false
  endif
 endif //2 (or more) wiimotes

debug = "Wiimote1: " + var.Wiimote1Player + "; " + var.Wiimote1Instrument
debug += "; Wiimote2: " + var.Wiimote2Player + "; " + var.Wiimote2Instrument

//Player switching / display code
//swap Wimmote 1/2 players
if(pressed(Wiimote1.Minus) OR pressed(Wiimote1.Plus) OR pressed(Wiimote2.Minus) OR pressed(Wiimote2.Plus))
  if(var.Wiimote1Player == 1)
    var.Wiimote1Player = 2
    var.Wiimote2Player = 1
  else
    var.Wiimote1Player = 1
    var.Wiimote2Player = 2
  endif
endif

//display wiimote1 info
Wiimote1.Led1 = true
Wiimote1.Led2 = false
if(var.Wiimote1Player == 1)
  Wiimote1.Led3 = true
  Wiimote1.Led4 = false
else if(var.Wiimote1Player == 2)
  Wiimote1.Led3 = false
  Wiimote1.Led4 = true
else
  Wiimote1.Led3 = false
  Wiimote1.Led4 = false
endif

//////////////////////////////////////////////////////////////
// Controller mappings:
//////////////////////////////////////////////////////////////
// GH3 Guitar
//////////////////////////////////////////////////////////////
if(var.Wiimote1Instrument == "GH3")
  // Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Guitar1.Left  = (-1.2 < Wiimote1.Guitar.JoyX < -0.5)
    var.Guitar1.Right = ( 0.5 < Wiimote1.Guitar.JoyX <  1.2)
    var.Guitar1.Up    = (-1.2 < Wiimote1.Guitar.JoyY < -0.5)
    var.Guitar1.Down  = ( 0.5 < Wiimote1.Guitar.JoyY <  1.2)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote1.Guitar.Fret1
    var.Guitar1.Red     = Wiimote1.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote1.Guitar.Fret5

    //Strumming
    var.Guitar1.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote1.Guitar.StrumDown   

    //Star Power
    var.Guitar1.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
  //Player 2 
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Guitar2.Left  = (-1.2 < Wiimote1.Guitar.JoyX < -0.5)
    var.Guitar2.Right = ( 0.5 < Wiimote1.Guitar.JoyX <  1.2)
    var.Guitar2.Up    = (-1.2 < Wiimote1.Guitar.JoyY < -0.5)
    var.Guitar2.Down  = ( 0.5 < Wiimote1.Guitar.JoyY <  1.2)

    // Fret Buttons
    var.Guitar2.Green   = Wiimote1.Guitar.Fret1
    var.Guitar2.Red     = Wiimote1.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Guitar
//////////////////////////////////////////////////////////////
elseif(var.Wiimote1Instrument == "GH4")
  //Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Guitar1.Left  = (Wiimote1.Exp0 < 25)
    var.Guitar1.Right = (Wiimote1.Exp0 > 40)
    var.Guitar1.Down  = (Wiimote1.Exp1 > 40)
    var.Guitar1.Up    = (Wiimote1.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote1.Guitar.Fret1
    var.Guitar1.Red     = Wiimote1.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar1.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar1.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
 
  //Player 2
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Guitar2.Left  = (Wiimote1.Exp0 < 25)
    var.Guitar2.Right = (Wiimote1.Exp0 > 40)
    var.Guitar2.Down  = (Wiimote1.Exp1 > 40)
    var.Guitar2.Up    = (Wiimote1.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar2.Green   = Wiimote1.Guitar.Fret1
    var.Guitar2.Red     = Wiimote1.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote1.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote1.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote1.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote1.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote1.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote1.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote1.RawForceZ < 100)
    wiimote1.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote1.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote1.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote1.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
////////////////////////////////////////////////////////////// 
// GH4 (WT) Drums
//////////////////////////////////////////////////////////////
elseif(var.Wiimote1Instrument == "DRUM")
  //Player 1
  if(var.Wiimote1Player == 1)
    // Joystick
    var.Drum1.Left  = (Wiimote1.Exp0 < 25)
    var.Drum1.Right = (Wiimote1.Exp0 > 40)
    var.Drum1.Down  = (Wiimote1.Exp1 < 25)
    var.Drum1.Up    = (Wiimote1.Exp1 > 40)

    // Drum pads
    if(var.Drum1.UseVelocityPads)
      var.Drum1.Bass    = (Wiimote1.Exp2=182 or Wiimote1.Exp2=183)
      var.Drum1.Red     = (Wiimote1.Exp2=178 or Wiimote1.Exp2=179)
      var.Drum1.Yellow  = (Wiimote1.Exp2=162 or Wiimote1.Exp2=163)
      var.Drum1.Blue    = (Wiimote1.Exp2=158 or Wiimote1.Exp2=159)
      var.Drum1.Green   = (Wiimote1.Exp2=164 or Wiimote1.Exp2=165)
      var.Drum1.Orange  = (Wiimote1.Exp2=156 or Wiimote1.Exp2=157)
    else
      var.Drum1.Bass    = |(1-((wiimote1.Exp5 & 4)   >> 2))|
      var.Drum1.Red     = |(1-((wiimote1.Exp5 & 64)  >> 6))|
      var.Drum1.Yellow  = |(1-((wiimote1.Exp5 & 32)  >> 5))|
      var.Drum1.Blue    = |(1-((wiimote1.Exp5 & 8)   >> 3))|
      var.Drum1.Green   = |(1-((wiimote1.Exp5 & 16)  >> 4))|
      var.Drum1.Orange  = |(1-((wiimote1.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum1.WTStarpower AND var.Drum1.Yellow AND var.Drum1.Orange)
      var.Drum1.StarPower = true
      if(var.Drum1.WTStarpowerDisableHit)
        var.Drum1.Yellow = false
        var.Drum1.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum1.StarPower = var.Drum1.StarPower OR Wiimote1.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum1.Plus = Wiimote1.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum1.OrangeMap == "GREEN")
      var.Drum1.Green = var.Drum1.Green OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "YELLOW")
      var.Drum1.Yellow = var.Drum1.Yellow OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "RED")
      var.Drum1.Red = var.Drum1.Red OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BLUE")
      var.Drum1.Blue = var.Drum1.Blue OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BASS")
      var.Drum1.Bass = var.Drum1.Bass OR var.Drum1.Orange
    endif

  //Player 2
  else if(var.Wiimote1Player == 2)
    // Joystick
    var.Drum2.Left  = (Wiimote1.Exp0 < 25)
    var.Drum2.Right = (Wiimote1.Exp0 > 40)
    var.Drum2.Down  = (Wiimote1.Exp1 < 25)
    var.Drum2.Up    = (Wiimote1.Exp1 > 40)

    // Drum pads
    if(var.Drum2.UseVelocityPads)
      var.Drum2.Bass    = (Wiimote1.Exp2=182 or Wiimote1.Exp2=183)
      var.Drum2.Red     = (Wiimote1.Exp2=178 or Wiimote1.Exp2=179)
      var.Drum2.Yellow  = (Wiimote1.Exp2=162 or Wiimote1.Exp2=163)
      var.Drum2.Blue    = (Wiimote1.Exp2=158 or Wiimote1.Exp2=159)
      var.Drum2.Green   = (Wiimote1.Exp2=164 or Wiimote1.Exp2=165)
      var.Drum2.Orange  = (Wiimote1.Exp2=156 or Wiimote1.Exp2=157)
    else
      var.Drum2.Bass    = |(1-((wiimote1.Exp5 & 4)   >> 2))|
      var.Drum2.Red     = |(1-((wiimote1.Exp5 & 64)  >> 6))|
      var.Drum2.Yellow  = |(1-((wiimote1.Exp5 & 32)  >> 5))|
      var.Drum2.Blue    = |(1-((wiimote1.Exp5 & 8)   >> 3))|
      var.Drum2.Green   = |(1-((wiimote1.Exp5 & 16)  >> 4))|
      var.Drum2.Orange  = |(1-((wiimote1.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum2.WTStarpower AND var.Drum2.Yellow AND var.Drum2.Orange)
      var.Drum2.StarPower = true
      if(var.Drum2.WTStarpowerDisableHit)
        var.Drum2.Yellow = false
        var.Drum2.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum2.StarPower = var.Drum2.StarPower OR Wiimote1.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum2.Plus = Wiimote1.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum2.OrangeMap == "GREEN")
      var.Drum2.Green = var.Drum2.Green OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "YELLOW")
      var.Drum2.Yellow = var.Drum2.Yellow OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "RED")
      var.Drum2.Red = var.Drum2.Red OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BLUE")
      var.Drum2.Blue = var.Drum2.Blue OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BASS")
      var.Drum2.Bass = var.Drum2.Bass OR var.Drum2.Orange
    endif
  endif

//No instrument connected 
else
  Wiimote1.Led3 = false
  Wiimote1.Led4 = false
  wait 1000ms
endif


///////////////////////////////////////////////////////////////
if(var.count > 1) // Wiimote 2
///////////////////////////////////////////////////////////////

//display wiimote2 info
Wiimote2.Led1 = true
Wiimote2.Led2 = false
if(var.Wiimote2Player == 1)
  Wiimote2.Led3 = true
  Wiimote2.Led4 = false
else if(var.Wiimote2Player == 2)
  Wiimote2.Led3 = false
  Wiimote2.Led4 = true
else
  Wiimote2.Led3 = false
  Wiimote2.Led4 = false
endif

//////////////////////////////////////////////////////////////
// GH3 Guitar
//////////////////////////////////////////////////////////////
if(var.Wiimote2Instrument == "GH3")
  // Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Guitar1.Left  = (-1.2 < Wiimote2.Guitar.JoyX < -0.5)
    var.Guitar1.Right = ( 0.5 < Wiimote2.Guitar.JoyX <  1.2)
    var.Guitar1.Up    = (-1.2 < Wiimote2.Guitar.JoyY < -0.5)
    var.Guitar1.Down  = ( 0.5 < Wiimote2.Guitar.JoyY <  1.2)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote2.Guitar.Fret1
    var.Guitar1.Red     = Wiimote2.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote2.Guitar.Fret5

    //Strumming
    var.Guitar1.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote2.Guitar.StrumDown   

    //Star Power
    var.Guitar1.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
  //Player 2 
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Guitar2.Left  = (-1.2 < Wiimote2.Guitar.JoyX < -0.5)
    var.Guitar2.Right = ( 0.5 < Wiimote2.Guitar.JoyX <  1.2)
    var.Guitar2.Up    = (-1.2 < Wiimote2.Guitar.JoyY < -0.5)
    var.Guitar2.Down  = ( 0.5 < Wiimote2.Guitar.JoyY <  1.2)

    // Fret Buttons
    var.Guitar2.Green   = Wiimote2.Guitar.Fret1
    var.Guitar2.Red     = Wiimote2.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
//////////////////////////////////////////////////////////////
// GH4 (WT) Guitar
//////////////////////////////////////////////////////////////
elseif(var.Wiimote2Instrument == "GH4")
  //Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Guitar1.Left  = (Wiimote2.Exp0 < 25)
    var.Guitar1.Right = (Wiimote2.Exp0 > 40)
    var.Guitar1.Down  = (Wiimote2.Exp1 > 40)
    var.Guitar1.Up    = (Wiimote2.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar1.Green   = Wiimote2.Guitar.Fret1
    var.Guitar1.Red     = Wiimote2.Guitar.Fret2
    var.Guitar1.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar1.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar1.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar1.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar1.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar1.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar1.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar1.StarPowerRumble AND var.Guitar1.StarPower)
    //Pause/Back
    var.Guitar1.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar1.AnalogWhammy)
      var.Guitar1.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar1.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
 
  //Player 2
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Guitar2.Left  = (Wiimote2.Exp0 < 25)
    var.Guitar2.Right = (Wiimote2.Exp0 > 40)
    var.Guitar2.Down  = (Wiimote2.Exp1 > 40)
    var.Guitar2.Up    = (Wiimote2.Exp1 < 25)
   
    // Fret Buttons
    var.Guitar2.Green   = Wiimote2.Guitar.Fret1
    var.Guitar2.Red     = Wiimote2.Guitar.Fret2
    var.Guitar2.Yellow  = Wiimote2.Guitar.Fret3
    var.Guitar2.Blue    = Wiimote2.Guitar.Fret4
    var.Guitar2.Orange  = Wiimote2.Guitar.Fret5
   
    //Strumming
    var.Guitar2.StrumUp   = Wiimote2.Guitar.StrumUp
    var.Guitar2.StrumDown = Wiimote2.Guitar.StrumDown
   
    //Star Power
    var.Guitar2.StarPower = Wiimote2.Guitar.Minus OR (var.Guitar2.MinTilt < Wiimote2.RawForceZ < 100)
    wiimote2.Rumble       = (var.Guitar2.StarPowerRumble AND var.Guitar2.StarPower)
    //Pause/Back
    var.Guitar2.Plus      = Wiimote2.Guitar.Plus
   
    //Whammy/Killswitch
    if(var.Guitar2.AnalogWhammy)
      var.Guitar2.Whammy = Wiimote2.Guitar.WhammyBar
    else
      var.Guitar2.Whammy = (0.7 < Wiimote2.Guitar.WhammyBar <= 1.0)
    endif
   
  endif
////////////////////////////////////////////////////////////// 
// GH4 (WT) Drums
//////////////////////////////////////////////////////////////
elseif(var.Wiimote2Instrument == "DRUMS")
  //Player 1
  if(var.Wiimote2Player == 1)
    // Joystick
    var.Drum1.Left  = (Wiimote2.Exp0 < 25)
    var.Drum1.Right = (Wiimote2.Exp0 > 40)
    var.Drum1.Down  = (Wiimote2.Exp1 > 40)
    var.Drum1.Up    = (Wiimote2.Exp1 < 25)

    // Drum pads
    if(var.Drum1.UseVelocityPads)
      var.Drum1.Bass    = (Wiimote2.Exp2=182 or Wiimote2.Exp2=183)
      var.Drum1.Red     = (Wiimote2.Exp2=178 or Wiimote2.Exp2=179)
      var.Drum1.Yellow  = (Wiimote2.Exp2=162 or Wiimote2.Exp2=163)
      var.Drum1.Blue    = (Wiimote2.Exp2=158 or Wiimote2.Exp2=159)
      var.Drum1.Green   = (Wiimote2.Exp2=164 or Wiimote2.Exp2=165)
      var.Drum1.Orange  = (Wiimote2.Exp2=156 or Wiimote2.Exp2=157)
    else
      var.Drum1.Bass    = |(1-((Wiimote2.Exp5 & 4)   >> 2))|
      var.Drum1.Red     = |(1-((Wiimote2.Exp5 & 64)  >> 6))|
      var.Drum1.Yellow  = |(1-((Wiimote2.Exp5 & 32)  >> 5))|
      var.Drum1.Blue    = |(1-((Wiimote2.Exp5 & 8)   >> 3))|
      var.Drum1.Green   = |(1-((Wiimote2.Exp5 & 16)  >> 4))|
      var.Drum1.Orange  = |(1-((Wiimote2.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum1.WTStarpower AND var.Drum1.Yellow AND var.Drum1.Orange)
      var.Drum1.StarPower = true
      if(var.Drum1.WTStarpowerDisableHit)
        var.Drum1.Yellow = false
        var.Drum1.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum1.StarPower = var.Drum1.StarPower OR Wiimote2.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum1.Plus = Wiimote2.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum1.OrangeMap == "GREEN")
      var.Drum1.Green = var.Drum1.Green OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "YELLOW")
      var.Drum1.Yellow = var.Drum1.Yellow OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "RED")
      var.Drum1.Red = var.Drum1.Red OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BLUE")
      var.Drum1.Blue = var.Drum1.Blue OR var.Drum1.Orange
    elseif(var.Drum1.OrangeMap == "BASS")
      var.Drum1.Bass = var.Drum1.Bass OR var.Drum1.Orange
    endif

  //Player 2
  else if(var.Wiimote2Player == 2)
    // Joystick
    var.Drum2.Left  = (Wiimote2.Exp0 < 25)
    var.Drum2.Right = (Wiimote2.Exp0 > 40)
    var.Drum2.Down  = (Wiimote2.Exp1 > 40)
    var.Drum2.Up    = (Wiimote2.Exp1 < 25)

    // Drum pads
    if(var.Drum2.UseVelocityPads)
      var.Drum2.Bass    = (Wiimote2.Exp2=182 or Wiimote2.Exp2=183)
      var.Drum2.Red     = (Wiimote2.Exp2=178 or Wiimote2.Exp2=179)
      var.Drum2.Yellow  = (Wiimote2.Exp2=162 or Wiimote2.Exp2=163)
      var.Drum2.Blue    = (Wiimote2.Exp2=158 or Wiimote2.Exp2=159)
      var.Drum2.Green   = (Wiimote2.Exp2=164 or Wiimote2.Exp2=165)
      var.Drum2.Orange  = (Wiimote2.Exp2=156 or Wiimote2.Exp2=157)
    else
      var.Drum2.Bass    = |(1-((Wiimote2.Exp5 & 4)   >> 2))|
      var.Drum2.Red     = |(1-((Wiimote2.Exp5 & 64)  >> 6))|
      var.Drum2.Yellow  = |(1-((Wiimote2.Exp5 & 32)  >> 5))|
      var.Drum2.Blue    = |(1-((Wiimote2.Exp5 & 8)   >> 3))|
      var.Drum2.Green   = |(1-((Wiimote2.Exp5 & 16)  >> 4))|
      var.Drum2.Orange  = |(1-((Wiimote2.Exp5 & 128) >> 7))|
    endif
   
    //WT Starpower activation
    if(var.Drum2.WTStarpower AND var.Drum2.Yellow AND var.Drum2.Orange)
      var.Drum2.StarPower = true
      if(var.Drum2.WTStarpowerDisableHit)
        var.Drum2.Yellow = false
        var.Drum2.Orange = false
      endif
    endif
   
    //Star power by minus button
    var.Drum2.StarPower = var.Drum2.StarPower OR Wiimote2.Guitar.Minus
   
    //Pause/Back (plus)
    var.Drum2.Plus = Wiimote2.Guitar.Plus
   
    // Remap the orange pad:
    if(var.Drum2.OrangeMap == "GREEN")
      var.Drum2.Green = var.Drum2.Green OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "YELLOW")
      var.Drum2.Yellow = var.Drum2.Yellow OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "RED")
      var.Drum2.Red = var.Drum2.Red OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BLUE")
      var.Drum2.Blue = var.Drum2.Blue OR var.Drum2.Orange
    elseif(var.Drum2.OrangeMap == "BASS")
      var.Drum2.Bass = var.Drum2.Bass OR var.Drum2.Orange
    endif
  endif

//No instrument connected 
else
  Wiimote2.Led3 = false
  Wiimote2.Led4 = false
  wait 1000ms
endif


/////////////////////////////////////////////////////////////// 
endif // end Wiimote 2
///////////////////////////////////////////////////////////////

//END OF FILE



if(var.count > 1) // Wiimote 2 in this line you just had if(count > 1) that's why it didn't work
Defyant
Member
Posts: 36
Joined: December 12th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby Defyant » Fri Apr 10, 2009 6:35 pm

The script doesn't work with my drums. :|
It was working last night at least. I've tried taking the wiimote out of the drums, connecting it to bluetooth, then putting it in the drums and running the script but it still comes up with "NO EXPANSION"(which is what I did last night and it worked). I've tried leaving the wiimote in the drums, connecting it and then running the script. No luck. Can anyone shed some light on this?
I'm using GlovePIE 3.0 and version 0.7 of your script.
p.s. need an answer quick! friends are coming over and they'll be bored to tears if we can't play.

Thanks
Blue Heaven!
User avatar
death_au
Member
Posts: 3991
Joined: December 12th, 2007
Location: Australia
Reputation: 7
Contact:

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby death_au » Sat Apr 11, 2009 3:19 am

Defyant wrote:The script doesn't work with my drums. :|
It was working last night at least. I've tried taking the wiimote out of the drums, connecting it to bluetooth, then putting it in the drums and running the script but it still comes up with "NO EXPANSION"(which is what I did last night and it worked). I've tried leaving the wiimote in the drums, connecting it and then running the script. No luck. Can anyone shed some light on this?
I'm using GlovePIE 3.0 and version 0.7 of your script.
p.s. need an answer quick! friends are coming over and they'll be bored to tears if we can't play.

Thanks

I'm not sure.... The only thing I can suggest is completely disconnecting the wiimote from the drums and the computer, then reconnecting via bluetooth, plug in the drums, then run the script.

Also, thanks kirezar for that bug fix. I'll try and remember that for when I update the script. I'm between houses atm, so it may be a little while before I get everything set up again.
kirezar
Member
Posts: 115
Joined: August 30th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby kirezar » Sat Apr 11, 2009 5:42 am

@ death_au - I also fixed the joystick glitch

@ Deviant - Try to erase your wiimote completly from your bluetooth then search for it again and connect it to the drums, then turn on the script
Defyant
Member
Posts: 36
Joined: December 12th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby Defyant » Sun Apr 12, 2009 8:27 am

Okay. I tried what kirezar said, and that didn't work. So what I did then was: unplugged my Xbox 360 GH2 guitar (doubt it's related), ended the script and disconnected the wiimote, shut down BlueSoleil, took out my Bluetooth device, put the bluetooth device back in, connected a different wii remote, plugged it into the drums, ran the script, and it popped up as wiimote two with the drum expansion. However the LEDs beg to differ, as they say it's wiimote 1 but player 2. Went into FoF.. and it didn't work. BLARG! If necessary, I can take a pic of glovepie and a vid of me testing the drums.

EDIT: Okay.. I got it working for a little bit.. then I crashed my game by accident and it stopped working. It's giving me the NO EXPANSION b/s and to be honest I've given up. :|
Last edited by Defyant on Sun Apr 12, 2009 8:41 am, edited 1 time in total.
kirezar
Member
Posts: 115
Joined: August 30th, 2008
Reputation: 0

Re: death_au's All-in-one GH Wii FoF/iX GlovePIE script

Postby kirezar » Sun Apr 12, 2009 8:33 am

Try using bluetooth fix in glovePIE, may help if you're not using, and test your wiimote first

Return to “FOF Mod Discussion and Support”

Who is online

Users browsing this forum: No registered users and 9 guests