WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A few scripts made by a new guy
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 5:25 pm    Post subject: A few scripts made by a new guy

Hello everyone! I'm new in the Wiili forums, and I wanted to have a good start. I've been writting all these N64 scripts, so I thought, why not show them on the Wiili forums? So I decided to post the scripts I have written (and the ones I write from now on) on this topic.

If someone has any suggestion for a new script, then tell me!


Last edited by wii_128 on Mon Jul 07, 2008 6:13 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 5:29 pm    Post subject: Paper Mario 64 Script - Updated!

Paper Mario 64 Script

This script supports playing with only the Wiimote or with the Classic controller and the Nunchuk. Most of it is just notes on how it works, so scroll down if you want the actual script.

EDIT: Script updated. Ver2.0 - Wiimote-only mode improved drastically. Added an "unused button" (read the script for details)

Code:
//--------------------------------------/
// Paper Mario Script by wii_generation /
//--------------------------------------/

// With this script, you can play with 3 control styles: with the Nunchuk, with
// the Classic Controller, and with the Wiimote alone. This last style may be a
// little confusing, but it's similar to the Super Paper Mario controller and is
// worth trying.

// This script needs a program called PPJoy to work. If you don't have it, just
// search on the internet "Download PPJoy".

//******************************Emulator Controls*******************************

// You only need to set the controls in one style; when you do, any control
// style will work perfectly. In fact, you can switch between styles mid-game.
// Just make sure that the game is paused when switching.

// Set your emulator to these keys (when using a Nunchuk):

// A Button => A Button on the Wiimote
// B Button => B Button on the Wiimote
// R Button => Minus Button on the Wiimote
// Z Button => Z Button on Nunchuk
// Start => Plus Button on the Wiimote
// N64 Analog Stick => Nunchuk Analog Stick
// C Buttons => D-pad on the Wiimote
// Unused* = Home

// Set your emulator to these keys (when using a Classic Controller):

// A Button => a Button on Classic Controller
// B Button => b Button on Classic Controller
// Z Button => L Button on Classic Controller
// R Button => R Button on Classic Controller
// Start => Plus Button on Classic Controller
// N64 Analog Stick => Classic Controller L Stick
// C Buttons => Classic Controller R Stick
// Unused* = Home

// Set your emulator to these keys (when using only the Wiimote):

// A Button => 2 Button on the Wiimote
// B Button => 1 Button on the Wiimote
// Z Button => Shake the Wiimote (or Home Button on the Wiimote)
// R Button => Shake the Wiimote (or press Home) while holding B
// Start => Plus Button on the Wiimote
// N64 Analog Stick => D-pad on the Wiimote
// C Buttons => While holding B, D-pad on the Wiimote
// Unused* = While holding B, Minus on the Wiimote

// *This "Unused" button is that, an unused button. You can set it to L, for
// example. I use it for the Moonjump GameShark code ("Pess L to moonjump").
// I do it just for fun, since I already beat the game twice (once on the real
// Nintendo 64!). Cheating isn't always wrong... right?

//******************************Gameplay Controls*******************************

//******************************************
//******** NUNCHUK AND WIIMOTE STYLE *******
//******************************************

// Wiimote:

// A => Jump, accept
// B => Use hammer, cancel
// Plus => Pause
// Up on the D-pad (or 1) => Show status bar
// Left on the D-pad => Item Menu
// Right on the D-pad => Partner Selection
// Down on the D-pad (or C) => Partner ability
// D-pad => C Buttons
// Minus => R Button (used only to navigate menus)

// Nunchuk:

// Analog stick => Move
// Z (or shake the Wiimote) => Spin Dash, change battle order, navigate menus
// C => Partner ability

//******************************************
//******** CLASSIC CONTROLLER STYLE ********
//******************************************

// Classic Controller:

// a => Jump
// b => Use hammer
// Plus => Pause
// Up on the R Stick (or ZL/ZR) => Show status bar
// Left on the R Stick (or Minus) => Item Menu
// Right on the R Stick (or y) => Partner Selection
// Down on the R Stick (or x) => Partner ability
// R Stick => C Buttons
// R => R Button
// L Stick (or D-pad) => Move
// L => Spin Dash, change battle order

//******************************************
//*********** WIIMOTE ONLY STYLE ***********
//******************************************

// Since the Wiimote doesn't have many buttons, I came up with something. Each
// C Button has an assigned button on the Wiimote. Simple. And when you hold B,
// the arrows on the D-pad become the C buttons. Even simpler.

// Wiimote:

// 2 => Jump
// 1 => Use hammer
// Plus => Pause
// D-pad => Move
// Shake the Wiimote => Spin Dash, change battle order
// Hold B Button + D-pad => C Buttons
// Hold B Button + 1 => Press both A and B. Used for one of Watt's abilities.

// C Buttons:

// Minus => Show status bar (UpC)
// Press and let go A => Item Menu (LeftC)
// Press and hold A => Partner Selection (RightC)
// 1 and 2 simultaneously => Partner Ability (DownC)

//*************************************************************
//**** Wiimote only stuff that you'll probably never use: *****
//*************************************************************

// Shake the Wiimote in the menu => Previous (Z Button)
// Hold B Button (or 1 & 2) + Shake the Wiimote in the menu => Next (R Button)

// How to walk slowly without an analog stick:

// Press and hold B. Press and hold 2. You may release B. As long as you hold 2,
// Mario will walk slowly.

//*******************************Script Settings********************************

//******************************************
//*********** MOTION SENSITIVITY ***********
//******************************************

// You can set how sensitive the Wiimote is to motion. Change sensitivity by
// changing the variable below. The smaller the number, the more sensitive.

//Set between 10 and 20:
   var.Sensitivity = 15

//******************************************
//************ SHAKE SPIN DASH *************
//******************************************

// If you like shaking the Wiimote to Spin Dash, set the variable below to
// "true". Otherwise, set it to "false".

//Set either to true or to false:
   var.ShakeSpinning = true

// Remember that pressing Home is set to do the same things that shaking does
// (Spin Dashing, change battle order, press R instead of Z if the B Button is
// being hold, etc.) when using only the Wiimote, even if the Controls section
// doesn't mention it.

*************************************Script*************************************

// Check for expansion
if Wiimote1.HasNunchuk then
      var.Expansion = 1
   else if Wiimote1.HasClassic then
      var.Expansion = 2
   else
      var.Expansion = 0
endif

// - WIIMOTE + NUNCHUK -

if var.Expansion = 1 then
var.OneTwoPressed = 0
var.HeldA = false
var.Held1 = false
var.Held2 = false
var.Time = 15 ms
var.SlowGo = 0
var.WiiL = 0
var.One = 0
var.Two = 0
var.XD = 0

//Debug
debug = "Analog Stick=> " +PPJoy1.Analog0+' , '+PPJoy1.Analog1

// Nunchuk Analog Stick
PPJoy1.analog0 = Wiimote1.Nunchuk.JoyX
PPJoy1.analog1 = Wiimote1.Nunchuk.JoyY

// Button Configuration
PPJoy1.Digital0 = Wiimote1.Up or Wiimote1.One
PPJoy1.Digital1 = Wiimote1.Down or Wiimote1.Nunchuk.CButton
PPJoy1.Digital2 = Wiimote1.Left
PPJoy1.Digital3 = Wiimote1.Right
PPJoy1.Digital4 = Wiimote1.A
PPJoy1.Digital5 = Wiimote1.B
PPJoy1.Digital12 = Wiimote1.Minus
PPJoy1.Digital10 = Wiimote1.Plus
PPJoy1.Digital9 = Wiimote1.Home

endif

// Z = Z
if Wiimote1.Nunchuk.ZButton = true and (var.Expansion = 1) then
PPJoy1.Digital11 = true
endif
if (Wiimote1.Nunchuk.ZButton = false) and (var.Shake = 0) and (var.Expansion = 1) then
PPJoy1.Digital11 = false
endif

// Shake Spin Dash
if ((Wiimote1.RelAccX > var.Sensitivity) or (Wiimote1.RelAccY > var.Sensitivity) or (Wiimote1.RelAccZ > var.Sensitivity)) and (var.ShakeSpinning = true) and (var.Expansion = 1) and (var.Shake = 0) then
  var.Shake = true
  PPJoy1.Digital11 = true
  wait 100 ms
  PPJoy1.Digital11 = false
  wait 300 ms
  var.Shake = 0
  endif
endif

// - CLASSIC CONTROLLER -

if var.Expansion = 2 then
var.OneTwoPressed = 0
var.Shake = 0
var.HeldA = false
var.Held1 = false
var.Held2 = false
var.Time = 15 ms
var.SlowGo = 0
var.WiiL = 0
var.One = 0
var.Two = 0
var.XD = 0

//Debug
debug = "L-Stick=> " +PPJoy1.analog0+' , '+PPJoy1.analog1

// Movement
PPJoy1.analog0 = Wiimote1.Classic.Joy1X
PPJoy1.analog1 = Wiimote1.Classic.Joy1Y
if Wiimote1.Classic.Up then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Classic.Down then
  PPJoy1.analog1 = 1
endif
if Wiimote1.Classic.Left then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Classic.Right then
  PPJoy1.analog0 = 1
endif

// Button Configuration
PPJoy1.Digital0 = Wiimote1.Classic.ZL or Wiimote1.Classic.ZR
PPJoy1.Digital1 = Wiimote1.Classic.x
PPJoy1.Digital2 = Wiimote1.Classic.Minus
PPJoy1.Digital3 = Wiimote1.Classic.y
PPJoy1.Digital4 = Wiimote1.Classic.a
PPJoy1.Digital5 = Wiimote1.Classic.b
PPJoy1.Digital11 = Wiimote1.Classic.L
PPJoy1.Digital12 = Wiimote1.Classic.R
PPJoy1.Digital10 = Wiimote1.Classic.Plus
PPJoy1.Digital9 = Wiimote1.Classic.Home

// C Buttons
if (Wiimote1.Classic.Joy2X > 0.4) then
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = true
  wait 5 ms
endif
if (Wiimote1.Classic.Joy2X < -0.4) then
  PPJoy1.Digital2 = true
  PPJoy1.Digital3 = false
  wait 5 ms
endif
if (0.4 > Wiimote1.Classic.Joy2X > -0.4) and (not(PPJoy1.Digital2)) and (not(PPJoy1.Digital3)) then
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = false
  wait 5 ms
endif
if (Wiimote1.Classic.Joy2Y > 0.4) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = true
  wait 5 ms
endif
if (Wiimote1.Classic.Joy2Y < -0.4) then
  PPJoy1.Digital0 = true
  PPJoy1.Digital1 = false
  wait 5 ms
endif
if (0.4 > Wiimote1.Classic.Joy2Y > -0.4) and (not(PPJoy1.Digital0)) and (not(PPJoy1.Digital1)) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = false
  wait 5 ms
endif

endif

// - WIIMOTE -

if var.Expansion = 0 then

//Debug
debug = "D-pad=> " +PPJoy1.analog0+' , '+PPJoy1.analog1

// Plus = Pause
PPJoy1.Digital10 = Wiimote1.Plus

// Slow Movement
if Wiimote1.Two and Wiimote1.B then
  var.SlowGo = 1
endif
if not(Wiimote1.Two) then
  var.SlowGo = 0
endif
if Released(Wiimote1.B) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = false
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = false
endif
if Pressed(Wiimote1.B) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = false
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = false
endif

// Jump by holding 2 for 15 ms
if (Pressed(HeldDown(Wiimote1.Two, var.Time))) and (Wiimote1.B = false) and (var.SlowGo = 0) then
  PPJoy1.Digital4 = true
  var.Two = 1
endif
if Wiimote1.Two = false or var.OneTwoPressed = 1 then
  PPJoy1.Digital4 = false
endif
if Wiimote1.Two = false then
  wait 25 ms
  var.Two = 0
endif

// If 2 is tapped and 1 is false, Jump
if Released(Wiimote1.Two) and (var.XD = 0) and (var.WiiL = 0) and (var.Two = 0) and (Wiimote1.B = false) then
  PPJoy1.Digital4 = true
  wait 40 ms
  PPJoy1.Digital4 = false
endif

// Use Hammer by holding 1 for 15 ms
if (Pressed(HeldDown(Wiimote1.One, var.Time))) and (Wiimote1.B = false) and (var.SlowGo = 0) then
  PPJoy1.Digital5 = true
  var.One = 1
endif
if Wiimote1.One = false or var.OneTwoPressed = 1 then
  PPJoy1.Digital5 = false
endif
if Wiimote1.One = false then
  wait 25 ms
  var.One = 0
endif

// If 1 is tapped and 2 is false, use Hammer
if Released(Wiimote1.One) and (var.XD = 0) and (var.WiiL = 0) and (var.One = 0) and (Wiimote1.B = false) then
  PPJoy1.Digital5 = true
  wait 40 ms
  PPJoy1.Digital5 = false
endif

// If both 1 and 2 buttons are pressed, then var.OneTwoPressed = 1
if Wiimote1.One and Wiimote1.Two then
var.OneTwoPressed = 1
var.XD = 1
else
var.OneTwoPressed = 0
wait 25 ms
var.XD = 0
endif

if Wiimote1.B = true then
var.Time = 30 ms
else
var.Time = 15 ms
endif

// 1 & 2 = Down C
if Wiimote1.B = false then
  if var.OneTwoPressed = 1 then
    PPJoy1.Digital1 = true
  endif
  if var.OneTwoPressed = 0 then
    PPJoy1.Digital1 = false
  endif
endif

// Minus = Up C
if Wiimote1.B = false then
  if Wiimote1.Minus = true then
    PPJoy1.Digital0 = true
  endif
  if Wiimote1.Minus = false then
    PPJoy1.Digital0 = false
  endif
endif

// A = Left/Right C
if Wiimote.B = false then
if Released(Wiimote1.A) and PPJoy1.Digital3 = false then
   if !var.HeldA then
      PPJoy1.Digital2 = true
      PPJoy1.Digital3 = false
      wait 100 ms
      PPJoy1.Digital2 = false
      PPJoy1.Digital3 = false
   else
      var.HeldA = false
   endif
else
   if Pressed(HeldDown(Wiimote1.A, 190 ms)) then
      PPJoy1.Digital2 = false
      PPJoy1.Digital3 = true
      wait 100 ms
      PPJoy1.Digital2 = false
      PPJoy1.Digital3 = false
      var.HeldA = true
   endif
endif
endif

// D-pad Movement
if var.SlowGo = 1 then
if Wiimote1.Right then
  PPJoy1.analog1 = -0.4
endif
if Wiimote1.Left then
  PPJoy1.analog1 = 0.4
endif
if (not(Wiimote1.Left)) and (not(Wiimote1.Right)) then
  PPJoy1.analog1 = 0
endif
if Wiimote1.Up then
  PPJoy1.analog0 = -0.4
endif
if Wiimote1.Down then
  PPJoy1.analog0 = 0.4
endif
if (not(Wiimote1.Up)) and (not(Wiimote1.Down)) then
  PPJoy1.analog0 = 0
endif
else if Wiimote1.B = false then
if Wiimote1.Right then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Left then
  PPJoy1.analog1 = 1
endif
if (not(Wiimote1.Left)) and (not(Wiimote1.Right)) then
  PPJoy1.analog1 = 0
endif
if Wiimote1.Up then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Down then
  PPJoy1.analog0 = 1
endif
if (not(Wiimote1.Up)) and (not(Wiimote1.Down)) then
  PPJoy1.analog0 = 0
endif
endif

// C Buttons when B is pressed
if Wiimote1.B = true then
if var.SlowGo = 0 then
PPJoy1.analog0 = 0
PPJoy1.analog1 = 0
endif
if Wiimote1.Up then
  PPJoy1.Digital2 = true
endif
if not(Wiimote1.Up) then
  PPJoy1.Digital2 = false
endif
if Wiimote1.Down then
  PPJoy1.Digital3 = true
endif
if not(Wiimote1.Down) then
  PPJoy1.Digital3 = false
endif
if Wiimote1.Left or Wiimote1.One then
  PPJoy1.Digital1 = true
endif
if not(Wiimote1.Left) then
  PPJoy1.Digital1 = false
endif
if Wiimote1.Right then
  PPJoy1.Digital0 = true
endif
if not(Wiimote1.Right) then
  PPJoy1.Digital0 = false
endif
if Wiimote1.One then
  PPJoy1.Digital4 = true
  PPJoy1.Digital5 = true
endif
if not(Wiimote1.One) then
  PPJoy1.Digital4 = false
  PPJoy1.Digital5 = false
endif
endif

// Unused Button
if Wiimote1.Minus and Wiimote1.B then
  var.WiiL = 1
endif
if var.WiiL = 1 then
  PPJoy1.Digital9 = true
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = false
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = false
endif
if not(Wiimote1.Minus) then
  PPJoy1.Digital9 = false
  wait 25 ms
  var.WiiL = 0
endif

// Shake/Home Spin Dash
if ((Wiimote1.RelAccX > var.Sensitivity*0.7) or (Wiimote1.RelAccY > var.Sensitivity*0.7) or (Wiimote1.RelAccZ > var.Sensitivity*0.7)) and (var.SlowGo = 0) and (var.ShakeSpinning = true) and (var.Expansion = 0) and (var.Shake = 0) then
   if (Wiimote1.B = true) or (var.OneTwoPressed = 1) then
   var.Shake = true
   PPJoy1.Digital12 = true
   wait 100 ms
   PPJoy1.Digital12 = false
   endif
   if (Wiimote1.B = false) and (var.OneTwoPressed = 0) then
   var.Shake = true
   PPJoy1.Digital11 = true
   wait 100 ms
   PPJoy1.Digital11 = false
   endif
   wait 400 ms
   var.Shake = 0
endif
if Pressed(Wiimote1.Home) and (var.SlowGo = 0) and (var.Expansion = 0) then
   if (Wiimote1.B = true) or (var.OneTwoPressed = 1) then
   PPJoy1.Digital12 = true
   wait 100 ms
   PPJoy1.Digital12 = false
   endif
   if (Wiimote1.B = false) and (var.OneTwoPressed = 0) then
   PPJoy1.Digital11 = true
   wait 100 ms
   PPJoy1.Digital11 = false
   endif
endif

endif

// LEDs
Wiimote1.Led1=true
Wiimote1.Led2=false
Wiimote1.Led3=false
Wiimote1.Led4=false
Wiimote2.Led1=false
Wiimote2.Led2=true
Wiimote2.Led3=false
Wiimote2.Led4=false
Wiimote3.Led1=false
Wiimote3.Led2=false
Wiimote3.Led3=true
Wiimote3.Led4=false
Wiimote4.Led1=false
Wiimote4.Led2=false
Wiimote4.Led3=false
Wiimote4.Led4=true


I'll post my Super Mario 64 script next.


Last edited by wii_128 on Sat Sep 27, 2008 10:14 pm; edited 7 times in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 5:40 pm    Post subject: Super Mario 64 Script

Super Mario 64 Script

The credit of this script doesn't go only to me; I took some of Jayz Facez's script for the motion gestures. If you like my script, thank him!

EDIT: Script updated. Ver1.1 - Some PPJoy issues fixed.

Code:
//-----------------------------------------/
// Super Mario 64 Script by wii_generation /
//-----------------------------------------/

// Thanks to Jayz Facez; the Wiimote + Nunchuk part of this script is based
// on the script he wrote.

// This script needs a program called PPJoy to work. If you don't have it, just
// search on the internet "Download PPJoy".

//******************************Emulator Controls*******************************

// You only need to set the controls in one style; when you do, any control
// style will work perfectly. In fact, you can switch between styles mid-game.
// Just make sure that the game is paused when switching.

// Set your emulator to these keys (when using a Nunchuk):

// A Button => A Button on the Wiimote
// B Button => B Button on the Wiimote
// R Button => C Button on Nunchuk
// Z Button => Z Button on Nunchuk
// Start => Plus Button on the Wiimote
// N64 Analog Stick => Nunchuk Analog Stick
// C Buttons => D-pad on the Wiimote

// Set your emulator to these keys (when using a Classic Controller):

// A Button => a Button on Classic Controller
// B Button => b Button on Classic Controller
// R Button => R Button on Classic Controller
// Z Button => L Button on Classic Controller
// Start => Plus Button on Classic Controller
// N64 Analog Stick => Classic Controller L Stick
// C Buttons => Classic Controller R Stick

// Set your emulator to these keys (when using only the Wiimote):

// A Button => 2 Button on the Wiimote
// B Button => 1 Button on the Wiimote
// R Button => A Button on the Wiimote
// Z Button => B Button on the Wiimote
// Start => Plus Button on the Wiimote
// N64 Analog Stick => D-pad
// C Buttons => While holding 1 and 2, D-pad on the Wiimote

//******************************Gameplay Controls*******************************

//******************************************
//******** NUNCHUK AND WIIMOTE STYLE *******
//******************************************

// Wiimote:

// A => Jump, exit first person
// B (or Shake the Wiimote) => Attack
// D-pad => Change the camera view
// Plus => Start

// Nunchuk:

// Flick the Nunchuk upwards (while standing still) => Backflip
// Flick the Nunchuk upwards (while moving) => Long Jump
// Analog stick => Move
// C => Change the camera angle
// Z => Crouch

//******************************************
//******** CLASSIC CONTROLLER STYLE ********
//******************************************

// Classic Controller:

// a => Jump, exit first person
// b => Attack
// Plus => Start
// L Stick (or D-pad) => Move
// L => Crouch
// R Stick => Change the camera view
// R => Change the camera angle

// If enabled (disabled by default):

// x (while standing still) => Backflip
// x (while moving) => Long Jump

//******************************************
//*********** WIIMOTE ONLY STYLE ***********
//******************************************

// Ok, since the Wiimote doesn't have many buttons, I came up with something.
// When you hold both 1 and 2, the arrows on the D-pad become the C buttons.
// Simple.

// Wiimote:

// 2 => Jump, exit first person
// 1 => Attack
// Plus => Start
// D-pad => Move
// D-pad (while holding 1 and 2) => Change the camera view
// A => Change the camera angle
// B => Crouch
// Shake the Wiimote (while standing still) => Backflip
// Shake the Wiimote (while moving) => Long Jump
// Shake the Wiimote (after jumping) => Ground Pound
// First Person = Minus (or Up while holding 1 and 2)

//*******************************Script Settings********************************

//******************************************
//*********** MOTION SENSITIVITY ***********
//******************************************

// You can set how sensitive the Wiimote and Nunchuk are to motion. Change
// sensitivity by changing the variable below. The smaller the number, the more
// sensitive. The default is 15, so if you feel like motion is messed up, just
// change it back to 15.

//Set between 10 and 20:
   var.Sensitivity = 15

//******************************************
//***** AUTO ATTACK (WIIMOTE + NUNCHUK) ****
//******************************************

// As it says in the in the Gameplay Controls, you can attack by shaking the
// Wiimote, pretty much like in Super Mario Galaxy. Though I think it works
// well, many people that tried this script say it feels bad. So, to turn this
// function off, change the variable below to "false". To turn it back on,
// change it to "true".

//Set either to true or to false:
   var.AutoGalaxyAttack = true

//******************************************
//********** AUTO HIGH/LONG JUMP ***********
//******************************************

// The same way, you can high/long jump (Z button + A button) with gestures.
// When using the Wiimote + Nunchuck combo, you flick the Nunchuk upwards;
// when using the Wiimote alone, it's done by shaking the whole Wiimote; and
// it's just a matter of pressing x when using the Classic Controller. If you
// feel this is like cheating or just don't like it, change the variables below
// to false (you can change each independantly). Change each one back to "true"
// to turn them on.

//Set either to true or to false (Wiimote + Nunchuk):
   var.NunchukAutoJump = true

// A nice feature, courtesy of Jayz Facez's script. Feel free to thank him
// on the Wiili forums.

//Set either to true or to false (Classic Controller):
   var.ClassicAutoJump = false

// I myself don't like using this feature with the Classic Controller, so it's
// false by default.

//Set either to true or to false (Wiimmote only):
   var.WiimoteAutoJump = true

// Pressing B with the Wiimote only is a huge pain. So try to leave the
// WiimoteAutoJump variable true. You shouldn't use that style, anyway...
// this game just wasn't made for non-analog control...

*************************************Script*************************************

// Check for expansion
if Wiimote1.HasNunchuk then
      var.Expansion = 1
   else if Wiimote1.HasClassic then
      var.Expansion = 2
   else
      var.Expansion = 0
endif

// - WIIMOTE -

if var.Expansion = 0 then

//Debug
debug = "D-pad=> " +PPJoy1.analog0+' , '+PPJoy1.analog1

// D-pad Movement
if var.OneTwoPressed = false then

if Wiimote1.Right then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Left then
  PPJoy1.analog1 = 1
endif
if (not(Wiimote1.Left)) and (not(Wiimote1.Right)) then
  PPJoy1.analog1 = 0
endif
if Wiimote1.Up then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Down then
  PPJoy1.analog0 = 1
endif
if (not(Wiimote1.Up)) and (not(Wiimote1.Down)) then
  PPJoy1.analog0 = 0
endif

endif

// Button Configuration
PPJoy1.Digital10 = Wiimote1.Plus
PPJoy1.Digital12 = Wiimote1.A

// Press B to Crouch
if (Wiimote1.B) then
  PPJoy1.Digital11 = true
else if (not(Wiimote1.B)) and var.Jumping = 0 then
  PPJoy1.Digital11 = false
endif

// Press 2 to Jump
if (Wiimote1.Two) and (var.OneTwoPressed = false) then
  wait 15 ms
  if (Wiimote1.Two) and (var.OneTwoPressed = false) then
    PPJoy1.Digital4 = true
  else
    PPJoy1.Digital4 = false
  endif
else if (not(Wiimote1.Two)) and var.Jumping = 0 then
  PPJoy1.Digital4 = false
endif

// Shake Wiimote to High/Long Jump
if ((Wiimote1.RelAccX > var.Sensitivity*0.8) or (Wiimote1.RelAccY > var.Sensitivity*0.8) or (Wiimote1.RelAccZ > var.Sensitivity*0.8)) and (var.WiimoteAutoJump = true) and (var.Jumping = 0) then
  var.Jumping = 1
endif
if var.Jumping = 1 then
  PPJoy1.Digital4 = false
  PPJoy1.Digital11 = true
  wait 100 ms
  PPJoy1.Digital4 = true
  PPJoy1.Digital11 = true
  wait 100 ms
  PPJoy1.Digital4 = false
  PPJoy1.Digital11 = false
  wait 450 ms
  var.Jumping = 0
endif

// Press 1 to Attack
if Wiimote1.One and (var.OneTwoPressed = false) then
  wait 15 ms
  if Wiimote1.One and (var.OneTwoPressed = false) then
    PPJoy1.Digital5 = true
  else
    PPJoy1.Digital5 = false
  endif
else
  PPJoy1.Digital5 = false
endif

// If both 1 and 2 buttons are pressed, then var.OneTwoPressed = true
if Wiimote1.One and Wiimote1.Two then

var.XD = true
endif
if var.XD = true then
var.OneTwoPressed = true
else
var.OneTwoPressed = false
endif
if (not(Wiimote1.One)) and (not(Wiimote1.Two)) then
var.XD = false
endif

// C Buttons when 1 and 2 are pressed
if var.OneTwoPressed = true then

if Wiimote1.Up then
  PPJoy1.Digital2 = true
endif
if not(Wiimote1.Up) then
  PPJoy1.Digital2 = false
endif
if Wiimote1.Down then
  PPJoy1.Digital3 = true
endif
if not(Wiimote1.Down) then
  PPJoy1.Digital3 = false
endif
if Wiimote1.Left then
  PPJoy1.Digital1 = true
endif
if not(Wiimote1.Left) then
  PPJoy1.Digital1 = false
endif
if Wiimote1.Right then
  PPJoy1.Digital0 = true
endif
if not(Wiimote1.Right) then
  PPJoy1.Digital0 = false
endif

endif

// Minus = Up C if var.OneTwoPressed = false
if var.OneTwoPressed = false then
  if Wiimote1.Minus = true then
    PPJoy1.Digital0 = true
  endif
  if Wiimote1.Minus = false then
    PPJoy1.Digital0 = false
  endif
endif

endif

// - WIIMOTE + NUNCHUK -

if var.Expansion = 1 then

//Debug
debug = "Analog Stick=> " +PPJoy1.Analog0+' , '+PPJoy1.Analog1

// Nunchuk Analog Stick
PPJoy1.analog0 = Wiimote1.Nunchuk.JoyX
PPJoy1.analog1 = Wiimote1.Nunchuk.JoyY

// Button Configuration
PPJoy1.Digital0 = Wiimote1.Up
PPJoy1.Digital1 = Wiimote1.Down
PPJoy1.Digital2 = Wiimote1.Left
PPJoy1.Digital3 = Wiimote1.Right
PPJoy1.Digital10 = Wiimote1.Plus
PPJoy1.Digital12 = Wiimote1.Nunchuk.CButton

// Super Mario Galaxy Style Attack
if ((Wiimote1.RelAccX > var.Sensitivity) or (Wiimote1.RelAccY > var.Sensitivity) or (Wiimote1.RelAccZ > var.Sensitivity)) and (var.AutoGalaxyAttack = true) then
  var.Attacking = 1
endif
if var.Attacking = 1 then
  PPJoy1.Digital5 = true
  wait 60 ms
  PPJoy1.Digital5 = false
  wait 60 ms
  var.Attacking = 0
  wait 10 ms
endif

// Press B to Attack
if (Wiimote1.B) and var.Attacking = 0 then
  PPJoy1.Digital5 = true
else if (not(Wiimote1.B)) and var.Attacking = 0 then
  PPJoy1.Digital5 = false
endif

// Press A to Jump
if (Wiimote1.A) then
  PPJoy1.Digital4 = true
else if (not(Wiimote1.A)) and var.Jumping = 0 then
  PPJoy1.Digital4 = false
endif

// Press Z to Crouch
if (Wiimote1.Nunchuk.ZButton) then
  PPJoy1.Digital11 = true
else if (not(Wiimote1.Nunchuk.ZButton)) and var.Jumping = 0 then
  PPJoy1.Digital11 = false
endif

// Flick Nunchuk upwards to High/Long Jump
if (Wiimote1.Nunchuk.RelAccY > var.Sensitivity*0.7) and (var.NunchukAutoJump = true) and (var.Jumping = 0) then
  var.Jumping = 1
endif
if var.Jumping = 1 then
  PPJoy1.Digital4 = false
  PPJoy1.Digital11 = true
  wait 100 ms
  PPJoy1.Digital4 = true
  PPJoy1.Digital11 = true
  wait 100 ms
  PPJoy1.Digital4 = false
  PPJoy1.Digital11 = false
  wait 450 ms
  var.Jumping = 0
  wait 10 ms
endif

endif

// - CLASSIC CONTROLLER -

if var.Expansion = 2 then

//Debug
debug = "L-Stick/D-pad=> " +PPJoy1.analog0+' , '+PPJoy1.analog1

// Movement
PPJoy1.analog0 = Wiimote1.Classic.Joy1X
PPJoy1.analog1 = Wiimote1.Classic.Joy1Y
if Wiimote1.Classic.Up then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Classic.Down then
  PPJoy1.analog1 = 1
endif
if Wiimote1.Classic.Left then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Classic.Right then
  PPJoy1.analog0 = 1
endif

// Button Configuration
PPJoy1.Digital5 = Wiimote1.Classic.b
PPJoy1.Digital10 = Wiimote1.Classic.Plus
PPJoy1.Digital12 = Wiimote1.Classic.R

// Press a to Jump
if (Wiimote1.Classic.a) then
  PPJoy1.Digital4 = true
else if (not(Wiimote1.Classic.a)) and var.Jumping = 0 then
  PPJoy1.Digital4 = false
endif

// Press L to Crouch
if (Wiimote1.Classic.L) then
  PPJoy1.Digital11 = true
else if (not(Wiimote1.Classic.L)) and var.Jumping = 0 then
  PPJoy1.Digital11 = false
endif

// Press x to High/Long Jump
if (Wiimote1.Classic.x) and (var.ClassicAutoJump = true) and (var.Jumping = 0) then
  var.Jumping = 1
endif
if var.Jumping = 1 then
  PPJoy1.Digital4 = 0
  PPJoy1.Digital11 = 1
  wait 100 ms
  PPJoy1.Digital4 = 1
  PPJoy1.Digital11 = 1
  wait 100 ms
  PPJoy1.Digital4 = 0
  PPJoy1.Digital11 = 0
  wait 450 ms
  var.Jumping = 0
  wait 10 ms
endif

// C Buttons
if (Wiimote1.Classic.Joy2X > 0.4) then
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = true
endif
if (Wiimote1.Classic.Joy2X < -0.4) then
  PPJoy1.Digital2 = true
  PPJoy1.Digital3 = false
endif
if (0.4 > Wiimote1.Classic.Joy2X > -0.4) then
  PPJoy1.Digital2 = false
  PPJoy1.Digital3 = false
endif
if (Wiimote1.Classic.Joy2Y > 0.4) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = true
endif
if (Wiimote1.Classic.Joy2Y < -0.4) then
  PPJoy1.Digital0 = true
  PPJoy1.Digital1 = false
endif
if (0.4 > Wiimote1.Classic.Joy2Y > -0.4) then
  PPJoy1.Digital0 = false
  PPJoy1.Digital1 = false
endif

endif

// LEDs
Wiimote1.Led1=true
Wiimote1.Led2=false
Wiimote1.Led3=false
Wiimote1.Led4=false
Wiimote2.Led1=false
Wiimote2.Led2=true
Wiimote2.Led3=false
Wiimote2.Led4=false
Wiimote3.Led1=false
Wiimote3.Led2=false
Wiimote3.Led3=true
Wiimote3.Led4=false
Wiimote4.Led1=false
Wiimote4.Led2=false
Wiimote4.Led3=false
Wiimote4.Led4=true
[/code]

Last edited by wii_128 on Sat Sep 27, 2008 10:17 pm; edited 5 times in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 6:00 pm    Post subject: Ultimate Mario Kart 64 script

Ultimate Mario Kart 64 script

This is the script that I put more effort into. It has support for every Wiimote expansion (except the Balance Board, I still don't know how it works), and you can swap between styles without changing the control configuration. It was the first script I started writting, too; it was about 3 weeks ago. I really hope someone enjoys it!

The funny thing is, when I woke up the other morning, my PC was on, and my script was at the top. Someone added guitar compatibility while I was sleeping. Guess I should have turned off the computer the night before. Anyway, I liked the idea, so I fixed some bugs it had and wrote how it works in the HowTo section.

EDIT: The guitar part was useless and made the loading time longer. So I took it away.

EDIT: Script Updated. Ver2.0 - Wii Wheel mode optimized. Better performance overall.

EDIT: Script Updated. Ver2.1 - Wii Wheel mode optimized. Again. I also changed the PPJoy configuration so it would match the one on all my other N64 scripts (took me like an hour Sad but oh well).

Code:
Made by wii_generation, with the help of Fuzzyhead

Code:
//-------------------------------------------------/
// Mario Kart 64 Ultimate Script by wii_generation /
//-------------------------------------------------/

// This script emulates how you play Mario Kart Wii with the Nunchuk, the
// Classic Controller, or the Wiimote. Each player can have either the Nunchuk
// and Wiimote combo, a Classic Controller, or only the Wiimote. Since this
// script is long, it can take up to 10 seconds to load; so don't click the Run
// button like there's no tomorrow.

// Thanks to Fuzzyhead; I wrote the Wiimote only part of the script by reading
// his NFS script. His script is very cool, so try it if you own NFS.

// This script needs a program called PPJoy to work. If you don't have it, just
// search on the internet "Download PPJoy".

//******************************Emulator Controls*******************************

// You only need to set the controls in one style; when you do, any control
// style will work perfectly. In fact, you can switch between styles mid-game.
// Just make sure that the game is paused when switching.

// Set your emulator to these keys (when using a Nunchuk):

// Analog Stick => Nunchuk Analog Stick
// A-Button => A Button on the Wiimote
// B-Button => B Button on the Wiimote
// Start => Plus Button on the Wiimote
// UpC => C Button on Nunchuk
// RightC => Minus Button on the Wiimote
// Z-Button => Z Button on Nunchuk
// R-Button => 1 Button on the Wiimote
// L-Button => 2 Button on the Wiimote

// Set your emulator to these keys (when using a Classic Controller):

// Analog Stick => Classic Controller L Stick
// A-Button => a Button on Classic Controller
// B-Button => b Button on Classic Controller
// Start => Plus Button on Classic Controller
// UpC => x or ZR Button on Classic Controller
// RightC => Minus or Y Button on the Wiimote
// Z-Button => L Button on Classic Controller
// R-Button => R Button on Classic Controller
// L-Button => ZL Button on the Wiimote

// Set your emulator to these keys (when using only the Wiimote):

// Analog Stick => D-Pad
// A-Button => 1 Button on the Wiimote
// B-Button => 2 Button on the Wiimote
// Start => Press and let go the Plus Button on the Wiimote
// UpC => Press and hold the Minus Button on the Wiimote
// RightC => Press and let go the Minus Button on the Wiimote
// Z-Button => A Button on the Wiimote
// R-Button => B Button on the Wiimote
// L-Button => Press and hold the Plus Button on the Wiimote

// Make sure that the Wiimote is in a flat, horizontal surface while setting the
// emulator keys.

//******************************Gameplay Controls*******************************

//******************************************
//******** NUNCHUK AND WIIMOTE STYLE *******
//******************************************

// Personally, my favorite style. It works well, everything is in the right
// place, and you can have your hands apart. Which is very confortable.

// These controls are just like those in Mario Kart Wii (Nunchuk mode,
// obviously), but since there are some extra functions, you should read this
// even if you own Mario Kart Wii.

// Wiimote:

// A => Accelerate/Confirm selection
// B => Brake/Cancel or Drift (if accelerating)
// Plus => Pause
// Minus => Change HUD
// 2 => Change music volume

// Nunchuk:

// Analog Stick => Steer, throw item forward/backwards
// Z Button => Use Item
// C Button => Change camera angle

// Only needed in the main menu:

// D-pad => N64 Analog Stick
// 1 => Check Data
// 2 => Options

//******************************************
//******** CLASSIC CONTROLLER STYLE ********
//******************************************

// Racing with the Classic Cotroller isn't that good, but it's worth trying.

// These controls are just like those in Mario Kart Wii (when the Classic thing
// is plugged), but since there are some extra functions, you should read them
// even if you have played MK Wii.

// Classic Controller:

// a => Accelerate/Confirm selection
// b => Brake/Cancel
// Plus => Pause
// Minus => Change HUD
// ZL => Change music volume
// L Stick (or D-pad) => Steer, throw item forward/backwards
// L => Use item
// R => Drift
// x (or ZR) => Change camera angle

// Only needed in the main menu:

// R => Check Data
// ZL => Options

//******************************************
//******** WIIMOTE / WII WHEEL STYLE *******
//******************************************

// Since I built this controller configuration from scratch, you really should
// read how this style works below. It loosely resembles the Mario Kart Wii
// configuration, though. Note that you can steer like in Excite Truck (buttons
// facing up) or like in Mario Kart Wii (buttons facing you).

// Wiimote:

// 1 => Accelerate/Confirm selection
// 2 => Brake/Cancel or Drift (if accelerating)
// Tilt the Wiimote => Steer
// D-pad => Steer, throw item forward/backwards
// A (or shake the Wiimote) => Use item
// B => Drift
// Home => Disable/enable tilt sensing for steering*

// Plus => Press => Pause
//         Hold => Change music volume

// Minus => Press => Change HUD
//          Hold => Change camera angle

// Only needed in the main menu:

// B => Check Data
// Press and hold Plus => Options

// *Use this when surfing menus (optional) or if you want to race using the
// D-pad. When tilt is disabled in a Wiimote, its player LED will blink instead
// of glow.

//*******************************Script Settings********************************

//******************************************
//**************** DEAD ZONE ***************
//******************************************

// With this, you can set how many degrees of inclination are needed for the
// script to identify a full analog stick press when using the Wiimote or Wii
// Wheel. The default is 70.

//Set between 50 and 80:
  var.DeadZone = 70

//******************************************
//*************** CALIBRATION **************
//******************************************

// Sometimes, Wiimotes don't detect pitch correctly. Even when the Wiimote is
// in a completely horizontal position, it reads that it's tilted. Try raising
// or lowering the variable below to fix the problem.

//Set between -10 and 10:
  var.InitialCalibration = 0

//******************************************
//**************** FRAMERATE ***************
//******************************************

// If you have a slow PC, you may want to reduce the framerate for this script
// to prevent lag. If, on the other hand, you have a fast PC, making the
// framerate higher will make gameplay more fluid. The default is 60 Hz.

//Set between 40 hz and 100 hz:
  Pie.FrameRate = 60 hz

//*******************Important things to remember when playing******************

// The Wiimote / Wii Wheel is VERY sensitive. If it's too sensitive for you, try
// using other controller style or the Wiimote with tilt disabled (see the
// "Gameplay Controls" section).

// If you like this script and don't own Mario Kart Wii, you may want to get it.
// The controls work way better, and don't make me write about the graphics.
// Also, it has twice the amount of circuits and online play :)

*************************************Script*************************************

//Debug
debug = "Joystick   P1=> " +PPJoy1.analog0+' , '+PPJoy1.analog1+'   P2=> ' +PPJoy2.analog0+' , '+PPJoy2.analog1+'   P3=> ' +PPJoy3.analog0+' , '+PPJoy3.analog1+'   P4=> ' +PPJoy4.analog0+' , '+PPJoy4.analog1

// Check for expansions and set hold times
if Wiimote1.HasNunchuk then
      var.Expansion1 = 1
   else if Wiimote1.HasClassic then
      var.Expansion1 = 2
   else
      var.Expansion1 = 0
endif
if Wiimote2.HasNunchuk then
      var.Expansion2 = 1
   else if Wiimote2.HasClassic then
      var.Expansion2 = 2
   else
      var.Expansion2 = 0
endif
if Wiimote3.HasNunchuk then
      var.Expansion3 = 1
   else if Wiimote3.HasClassic then
      var.Expansion3 = 2
   else
      var.Expansion3 = 0
endif
if Wiimote4.HasNunchuk then
      var.Expansion4 = 1
   else if Wiimote4.HasClassic then
      var.Expansion4 = 2
   else
      var.Expansion4 = 0
endif
var.HeldTime = 180 ms
var.HeldTime2 = 350 ms

//********************P1********************

// - WIIMOTE -

if var.Expansion1 = 0 then

// Set the Pitch value
var.Pitch1 = Wiimote1.SmoothPitch - var.InitialCalibration

// Steering
if var.MotionOff1 = 0 and Wiimote1.Up = false and Wiimote1.Down = false then
if (var.DeadZone*-0.1 < var.Pitch1 < var.DeadZone*0.1) then
PPJoy1.Analog0 = 0
endif
if (var.DeadZone*-0.5 < var.Pitch1 < var.DeadZone*-0.3) then
PPJoy1.Analog0 = -0.55
endif
if (var.DeadZone*-0.3 < var.Pitch1 < var.DeadZone*-0.2) then
PPJoy1.Analog0 = -0.45
endif
if (var.DeadZone*-0.2 < var.Pitch1 < var.DeadZone*-0.1) then
PPJoy1.Analog0 = -0.35
endif
if (var.DeadZone*-0.1 < var.Pitch1 < var.DeadZone*0.1) then
PPJoy1.Analog0 = 0
endif
if (var.DeadZone*0.1 < var.Pitch1 < var.DeadZone*0.2) then
PPJoy1.Analog0 = 0.35
endif
if (var.DeadZone*0.2 < var.Pitch1 < var.DeadZone*0.3) then
PPJoy1.Analog0 = 0.45
endif
if (var.DeadZone*0.3 < var.Pitch1 < var.DeadZone*0.5) then
PPJoy1.Analog0 = 0.55
endif
if (var.DeadZone*0.5 < var.Pitch1) or (var.DeadZone*-0.5 > var.Pitch1) then
PPJoy1.Analog0 = (var.Pitch1 / var.DeadZone)
endif
endif

// D-pad Steering
if Wiimote1.Right then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Left then
  PPJoy1.analog1 = 1
endif
if (not(Wiimote1.Left)) and (not(Wiimote1.Right)) then
  PPJoy1.analog1 = 0
endif
if Wiimote1.Up then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Down then
  PPJoy1.analog0 = 1
endif
if var.MotionOff1 = true then
if (not(Wiimote1.Up)) and (not(Wiimote1.Down)) then
  PPJoy1.analog0 = 0
endif
endif

// Digital Buttons in Wiimote
PPJoy1.Digital4 = Wiimote1.Two
PPJoy1.Digital11 = Wiimote1.A

// Shake Item
if (Wiimote1.RelAccX > 10) or (Wiimote1.RelAccY > 10) or (Wiimote1.RelAccZ > 10) then
   PPJoy1.Digital11 = true
   wait 100 ms
   PPJoy1.Digital11 = false
   wait 250 ms
endif

// Minus Action
if Released(Wiimote1.Minus) then
   if !var.Held1 then
      PPJoy1.Digital3 = true
      PPJoy1.Digital0 = false
      wait 60 ms
      PPJoy1.Digital3 = false
   else
      var.Held1 = false
   endif
else
   if Pressed(HeldDown(Wiimote1.Minus, var.HeldTime)) then
      PPJoy1.Digital3 = false
      PPJoy1.Digital0 = true
      wait 60 ms
      PPJoy1.Digital0 = false
      var.Held1 = true
   endif
endif

// Plus Action
if Released(Wiimote1.Plus) then
   if !var.Held11 then
      PPJoy1.Digital9 = false
      PPJoy1.Digital10 = true
      wait 60 ms
      PPJoy1.Digital10 = false
   else
      var.Held11 = false
   endif
else
   if Pressed(HeldDown(Wiimote1.Plus, var.HeldTime2)) then
      PPJoy1.Digital10 = false
      PPJoy1.Digital9 = true
      wait 60 ms
      PPJoy1.Digital9 = false
      var.Held11 = true
   endif
endif

// Home Action
if Released(Wiimote1.Home) then
  var.ChangeMode1 = true
  wait 60 ms
  var.ChangeMode1 = 0
endif
if var.ChangeMode1 = true and var.MotionOff1 = 0 and var.XD1 = 0 then
  var.XD1 = true
  var.MotionOff1 = true
  wait 100 ms
  var.XD1 = 0
endif
if var.ChangeMode1 = true and var.MotionOff1 = true and var.XD1 = 0 then
  var.XD1 = true
  var.MotionOff1 = 0
  wait 100 ms
  var.XD1 = 0
endif

// One Action
if ((Wiimote1.Two = true) and (Wiimote1.One = true)) or (Wiimote1.B = true) then
  PPJoy1.Digital12 = true
  PPJoy1.Digital5 = false
endif
if (Wiimote1.Two = false) and (Wiimote1.One = true) and (Wiimote1.B = true) then
  PPJoy1.Digital5 = true
  PPJoy1.Digital12 = true
endif
if (Wiimote1.One = false) and (Wiimote1.B = false) then
  PPJoy1.Digital5 = false
  PPJoy1.Digital12 = false
endif
if (not(Wiimote1.Two)) and (Pressed(HeldDown(Wiimote1.One, 200 ms))) then
  var.Reversing1 = 1
  PPJoy1.Digital12 = false
  PPJoy1.Digital5 = true
endif
if (not(Wiimote1.Two)) and Wiimote1.One then
  PPJoy1.Digital5 = true
endif
if (Wiimote1.Two = true) then
  var.Reversing1 = 0
endif
if not(Wiimote1.One) then
  var.Reversing1 = 0
endif
if var.Reversing1 = 1 then
PPJoy1.analog1 = 1
endif

endif

// - WIIMOTE + NUNCHUK -

if var.Expansion1 = 1 then

// Steering
PPJoy1.analog0 = Wiimote1.Nunchuk.JoyX
PPJoy1.analog1 = Wiimote1.Nunchuk.JoyY
if Wiimote1.Up then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Down then
  PPJoy1.analog1 = 1
endif
if Wiimote1.Left then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Right then
  PPJoy1.analog0 = 1
endif

// Digital Buttons in Wiimote
PPJoy1.Digital4 = Wiimote1.A
PPJoy1.Digital9 = Wiimote1.Two
PPJoy1.Digital3 = Wiimote1.Minus
PPJoy1.Digital10 = Wiimote1.Plus

// Digital Buttons in Nunchuk
PPJoy1.Digital0 = Wiimote1.Nunchuk.CButton
PPJoy1.Digital11 = Wiimote1.Nunchuk.ZButton

// B Action
if ((Wiimote1.A = true) and (Wiimote1.B = true)) or (Wiimote1.One = true) then
  PPJoy1.Digital12 = true
  PPJoy1.Digital5 = false
endif
if (Wiimote1.A = false) and (Wiimote1.B = true) and (Wiimote1.One = true) then
  PPJoy1.Digital5 = true
  PPJoy1.Digital12 = true
endif
if (Wiimote1.B = false) and (Wiimote1.One = false) then
  PPJoy1.Digital5 = false
  PPJoy1.Digital12 = false
endif
if (not(Wiimote1.A)) and (Pressed(HeldDown(Wiimote1.B, 200 ms))) then
  var.Reversing1 = 1
  PPJoy1.Digital12 = false
  PPJoy1.Digital5 = true
endif
if (not(Wiimote1.A)) and Wiimote1.B then
  PPJoy1.Digital5 = true
endif
if (Wiimote1.A = true) then
  var.Reversing1 = 0
endif
if not(Wiimote1.B) then
  var.Reversing1 = 0
endif
if var.Reversing1 = 1 then
PPJoy1.analog1 = 1
endif

endif

// - CLASSIC CONTROLLER -

if var.Expansion1 = 2 then

// Steering
PPJoy1.analog0 = Wiimote1.Classic.Joy1X
PPJoy1.analog1 = Wiimote1.Classic.Joy1Y
if Wiimote1.Classic.Up then
  PPJoy1.analog1 = -1
endif
if Wiimote1.Classic.Down then
  PPJoy1.analog1 = 1
endif
if Wiimote1.Classic.Left then
  PPJoy1.analog0 = -1
endif
if Wiimote1.Classic.Right then
  PPJoy1.analog0 = 1
endif

// Digital Buttons in Classic Controller
PPJoy1.Digital4 = Wiimote1.Classic.a
PPJoy1.Digital12 = Wiimote1.Classic.R
PPJoy1.Digital9 = Wiimote1.Classic.ZL
PPJoy1.Digital3 = Wiimote1.Classic.Minus or Wiimote1.Classic.y
PPJoy1.Digital10 = Wiimote1.Classic.Plus
PPJoy1.Digital0 = Wiimote1.Classic.ZR or Wiimote1.Classic.x
PPJoy1.Digital11 = Wiimote1.Classic.L

// Reversing
if (not(Wiimote1.Classic.a)) and (Pressed(HeldDown(Wiimote1.Classic.b, 200 ms))) then
  PPJoy1.Digital12 = false
  PPJoy1.Digital5 = true
  var.Reversing1 = 1
endif
if (Wiimote1.Classic.a = true) then
  var.Reversing1 = 0
endif
if Wiimote1.Classic.b then
  PPJoy1.Digital5 = true
endif
if (Wiimote1.Classic.b = false) or Wiimote1.Classic.R then
  var.Reversing1 = 0
  PPJoy1.Digital5 = false
endif
if var.Reversing1 = 1 then
PPJoy1.analog1 = 1
endif

endif

//********************P2********************

// - WIIMOTE -

if var.Expansion2 = 0 then

// Set the Pitch value
var.Pitch2 = Wiimote2.SmoothPitch - var.InitialCalibration

// Steering
if var.MotionOff2 = 0 and Wiimote2.Up = false and Wiimote2.Down = false then
if (var.DeadZone*-0.1 < var.Pitch2 < var.DeadZone*0.1) then
PPJoy2.Analog0 = 0
endif
if (var.DeadZone*-0.5 < var.Pitch2 < var.DeadZone*-0.3) then
PPJoy2.Analog0 = -0.55
endif
if (var.DeadZone*-0.3 < var.Pitch2 < var.DeadZone*-0.2) then
PPJoy2.Analog0 = -0.45
endif
if (var.DeadZone*-0.2 < var.Pitch2 < var.DeadZone*-0.1) then
PPJoy2.Analog0 = -0.35
endif
if (var.DeadZone*-0.1 < var.Pitch2 < var.DeadZone*0.1) then
PPJoy2.Analog0 = 0
endif
if (var.DeadZone*0.1 < var.Pitch2 < var.DeadZone*0.2) then
PPJoy2.Analog0 = 0.35
endif
if (var.DeadZone*0.2 < var.Pitch2 < var.DeadZone*0.3) then
PPJoy2.Analog0 = 0.45
endif
if (var.DeadZone*0.3 < var.Pitch2 < var.DeadZone*0.5) then
PPJoy2.Analog0 = 0.55
endif
if (var.DeadZone*0.5 < var.Pitch2) or (var.DeadZone*-0.5 > var.Pitch2) then
PPJoy2.Analog0 = (var.Pitch2 / var.DeadZone)
endif
endif

// D-pad Steering
if Wiimote2.Right then
  PPJoy2.analog1 = -1
endif
if Wiimote2.Left then
  PPJoy2.analog1 = 1
endif
if (not(Wiimote2.Left)) and (not(Wiimote2.Right)) then
  PPJoy2.analog1 = 0
endif
if Wiimote2.Up then
  PPJoy2.analog0 = -1
endif
if Wiimote2.Down then
  PPJoy2.analog0 = 1
endif
if var.MotionOff2 = true then
if (not(Wiimote2.Up)) and (not(Wiimote2.Down)) then
  PPJoy2.analog0 = 0
endif
endif

// Digital Buttons in Wiimote
PPJoy2.Digital4 = Wiimote2.Two
PPJoy2.Digital11 = Wiimote2.A

// Shake Item
if (Wiimote2.RelAccX > 10) or (Wiimote2.RelAccY > 10) or (Wiimote2.RelAccZ > 10) then
   PPJoy2.Digital11 = true
   wait 100 ms
   PPJoy2.Digital11 = false
   wait 250 ms
endif

// Minus Action
if Released(Wiimote2.Minus) then
   if !var.Held2 then
      PPJoy2.Digital3 = true
      PPJoy2.Digital0 = false
      wait 60 ms
      PPJoy2.Digital3 = false
   else
      var.Held2 = false
   endif
else
   if Pressed(HeldDown(Wiimote2.Minus, var.HeldTime)) then
      PPJoy2.Digital3 = false
      PPJoy2.Digital0 = true
      wait 60 ms
      PPJoy2.Digital0 = false
      var.Held2 = true
   endif
endif

// Plus Action
if Released(Wiimote2.Plus) then
   if !var.Held22 then
      PPJoy2.Digital9 = false
      PPJoy2.Digital10 = true
      wait 60 ms
      PPJoy2.Digital10 = false
   else
      var.Held22 = false
   endif
else
   if Pressed(HeldDown(Wiimote2.Plus, var.HeldTime2)) then
      PPJoy2.Digital10 = false
      PPJoy2.Digital9 = true
      wait 60 ms
      PPJoy2.Digital9 = false
      var.Held22 = true
   endif
endif

// Home Action
if Released(Wiimote2.Home) then
  var.ChangeMode2 = true
  wait 60 ms
  var.ChangeMode2 = 0
endif
if var.ChangeMode2 = true and var.MotionOff2 = 0 and var.XD2 = 0 then
  var.XD2 = true
  var.MotionOff2 = true
  wait 100 ms
  var.XD2 = 0
endif
if var.ChangeMode2 = true and var.MotionOff2 = true and var.XD2 = 0 then
  var.XD2 = true
  var.MotionOff2 = 0
  wait 100 ms
  var.XD2 = 0
endif

// One Action
if ((Wiimote2.Two = true) and (Wiimote2.One = true)) or (Wiimote2.B = true) then
  PPJoy2.Digital12 = true
  PPJoy2.Digital5 = false
endif
if (Wiimote2.Two = false) and (Wiimote2.One = true) and (Wiimote2.B = true) then
  PPJoy2.Digital5 = true
  PPJoy2.Digital12 = true
endif
if (Wiimote2.One = false) and (Wiimote2.B = false) then
  PPJoy2.Digital5 = false
  PPJoy2.Digital12 = false
endif
if (not(Wiimote2.Two)) and (Pressed(HeldDown(Wiimote2.One, 200 ms))) then
  var.Reversing2 = 1
  PPJoy2.Digital12 = false
  PPJoy2.Digital5 = true
endif
if (not(Wiimote2.Two)) and Wiimote2.One then
  PPJoy2.Digital5 = true
endif
if (Wiimote2.Two = true) then
  var.Reversing2 = 0
endif
if not(Wiimote2.One) then
  var.Reversing2 = 0
endif
if var.Reversing2 = 1 then
PPJoy2.analog1 = 1
endif

endif

// - WIIMOTE + NUNCHUK -

if var.Expansion2 = 1 then

// Steering
PPJoy2.analog0 = Wiimote2.Nunchuk.JoyX
PPJoy2.analog1 = Wiimote2.Nunchuk.JoyY
if Wiimote2.Up then
  PPJoy2.analog1 = -1
endif
if Wiimote2.Down then
  PPJoy2.analog1 = 1
endif
if Wiimote2.Left then
  PPJoy2.analog0 = -1
endif
if Wiimote2.Right then
  PPJoy2.analog0 = 1
endif

// Digital Buttons in Wiimote
PPJoy2.Digital4 = Wiimote2.A
PPJoy2.Digital9 = Wiimote2.Two
PPJoy2.Digital3 = Wiimote2.Minus
PPJoy2.Digital10 = Wiimote2.Plus

// Digital Buttons in Nunchuk
PPJoy2.Digital0 = Wiimote2.Nunchuk.CButton
PPJoy2.Digital11 = Wiimote2.Nunchuk.ZButton

// B Action
if ((Wiimote2.A = true) and (Wiimote2.B = true)) or (Wiimote2.One = true) then
  PPJoy2.Digital12 = true
  PPJoy2.Digital5 = false
endif
if (Wiimote2.A = false) and (Wiimote2.B = true) and (Wiimote2.One = true) then
  PPJoy2.Digital5 = true
  PPJoy2.Digital12 = true
endif
if (Wiimote2.B = false) and (Wiimote2.One = false) then
  PPJoy2.Digital5 = false
  PPJoy2.Digital12 = false
endif
if (not(Wiimote2.A)) and (Pressed(HeldDown(Wiimote2.B, 200 ms))) then
  var.Reversing2 = 1
  PPJoy2.Digital12 = false
  PPJoy2.Digital5 = true
endif
if (not(Wiimote2.A)) and Wiimote2.B then
  PPJoy2.Digital5 = true
endif
if (Wiimote2.A = true) then
  var.Reversing2 = 0
endif
if not(Wiimote2.B) then
  var.Reversing2 = 0
endif
if var.Reversing2 = 1 then
PPJoy2.analog1 = 1
endif

endif

// - CLASSIC CONTROLLER -

if var.Expansion2 = 2 then

// Steering
PPJoy2.analog0 = Wiimote2.Classic.Joy1X
PPJoy2.analog1 = Wiimote2.Classic.Joy1Y
if Wiimote2.Classic.Up then
  PPJoy2.analog1 = -1
endif
if Wiimote2.Classic.Down then
  PPJoy2.analog1 = 1
endif
if Wiimote2.Classic.Left then
  PPJoy2.analog0 = -1
endif
if Wiimote2.Classic.Right then
  PPJoy2.analog0 = 1
endif

// Digital Buttons in Classic Controller
PPJoy2.Digital4 = Wiimote2.Classic.a
PPJoy2.Digital12 = Wiimote2.Classic.R
PPJoy2.Digital9 = Wiimote2.Classic.ZL
PPJoy2.Digital3 = Wiimote2.Classic.Minus or Wiimote2.Classic.y
PPJoy2.Digital10 = Wiimote2.Classic.Plus
PPJoy2.Digital0 = Wiimote2.Classic.ZR or Wiimote2.Classic.x
PPJoy2.Digital11 = Wiimote2.Classic.L

// Reversing
if (not(Wiimote2.Classic.a)) and (Pressed(HeldDown(Wiimote2.Classic.b, 200 ms))) then
  PPJoy2.Digital12 = false
  PPJoy2.Digital5 = true
  var.Reversing2 = 1
endif
if (Wiimote2.Classic.a = true) then
  var.Reversing2 = 0
endif
if Wiimote2.Classic.b then
  PPJoy2.Digital5 = true
endif
if (Wiimote2.Classic.b = false) or Wiimote2.Classic.R then
  var.Reversing2 = 0
  PPJoy2.Digital5 = false
endif
if var.Reversing2 = 1 then
PPJoy2.analog1 = 1
endif

endif

//********************P3********************

// - WIIMOTE -

if var.Expansion3 = 0 then

// Set the Pitch value
var.Pitch3 = Wiimote3.SmoothPitch - var.InitialCalibration

// Steering
if var.MotionOff3 = 0 and Wiimote3.Up = false and Wiimote3.Down = false then
if (var.DeadZone*-0.1 < var.Pitch3 < var.DeadZone*0.1) then
PPJoy3.Analog0 = 0
endif
if (var.DeadZone*-0.5 < var.Pitch3 < var.DeadZone*-0.3) then
PPJoy3.Analog0 = -0.55
endif
if (var.DeadZone*-0.3 < var.Pitch3 < var.DeadZone*-0.2) then
PPJoy3.Analog0 = -0.45
endif
if (var.DeadZone*-0.2 < var.Pitch3 < var.DeadZone*-0.1) then
PPJoy3.Analog0 = -0.35
endif
if (var.DeadZone*-0.1 < var.Pitch3 < var.DeadZone*0.1) then
PPJoy3.Analog0 = 0
endif
if (var.DeadZone*0.1 < var.Pitch3 < var.DeadZone*0.2) then
PPJoy3.Analog0 = 0.35
endif
if (var.DeadZone*0.2 < var.Pitch3 < var.DeadZone*0.3) then
PPJoy3.Analog0 = 0.45
endif
if (var.DeadZone*0.3 < var.Pitch3 < var.DeadZone*0.5) then
PPJoy3.Analog0 = 0.55
endif
if (var.DeadZone*0.5 < var.Pitch3) or (var.DeadZone*-0.5 > var.Pitch3) then
PPJoy3.Analog0 = (var.Pitch3 / var.DeadZone)
endif
endif

// D-pad Steering
if Wiimote3.Right then
  PPJoy3.analog1 = -1
endif
if Wiimote3.Left then
  PPJoy3.analog1 = 1
endif
if (not(Wiimote3.Left)) and (not(Wiimote3.Right)) then
  PPJoy3.analog1 = 0
endif
if Wiimote3.Up then
  PPJoy3.analog0 = -1
endif
if Wiimote3.Down then
  PPJoy3.analog0 = 1
endif
if var.MotionOff3 = true then
if (not(Wiimote3.Up)) and (not(Wiimote3.Down)) then
  PPJoy3.analog0 = 0
endif
endif

// Digital Buttons in Wiimote
PPJoy3.Digital4 = Wiimote3.Two
PPJoy3.Digital11 = Wiimote3.A

// Shake Item
if (Wiimote3.RelAccX > 10) or (Wiimote3.RelAccY > 10) or (Wiimote3.RelAccZ > 10) then
   PPJoy3.Digital11 = true
   wait 100 ms
   PPJoy3.Digital11 = false
   wait 250 ms
endif

// Minus Action
if Released(Wiimote3.Minus) then
   if !var.Held3 then
      PPJoy3.Digital3 = true
      PPJoy3.Digital0 = false
      wait 60 ms
      PPJoy3.Digital3 = false
   else
      var.Held3 = false
   endif
else
   if Pressed(HeldDown(Wiimote3.Minus, var.HeldTime)) then
      PPJoy3.Digital3 = false
      PPJoy3.Digital0 = true
      wait 60 ms
      PPJoy3.Digital0 = false
      var.Held3 = true
   endif
endif

// Plus Action
if Released(Wiimote3.Plus) then
   if !var.Held33 then
      PPJoy3.Digital9 = false
      PPJoy3.Digital10 = true
      wait 60 ms
      PPJoy3.Digital10 = false
   else
      var.Held33 = false
   endif
else
   if Pressed(HeldDown(Wiimote3.Plus, var.HeldTime2)) then
      PPJoy3.Digital10 = false
      PPJoy3.Digital9 = true
      wait 60 ms
      PPJoy3.Digital9 = false
      var.Held33 = true
   endif
endif

// Home Action
if Released(Wiimote3.Home) then
  var.ChangeMode3 = true
  wait 60 ms
  var.ChangeMode3 = 0
endif
if var.ChangeMode3 = true and var.MotionOff3 = 0 and var.XD3 = 0 then
  var.XD3 = true
  var.MotionOff3 = true
  wait 100 ms
  var.XD3 = 0
endif
if var.ChangeMode3 = true and var.MotionOff3 = true and var.XD3 = 0 then
  var.XD3 = true
  var.MotionOff3 = 0
  wait 100 ms
  var.XD3 = 0
endif

// One Action
if ((Wiimote3.Two = true) and (Wiimote3.One = true)) or (Wiimote3.B = true) then
  PPJoy3.Digital12 = true
  PPJoy3.Digital5 = false
endif
if (Wiimote3.Two = false) and (Wiimote3.One = true) and (Wiimote3.B = true) then
  PPJoy3.Digital5 = true
  PPJoy3.Digital12 = true
endif
if (Wiimote3.One = false) and (Wiimote3.B = false) then
  PPJoy3.Digital5 = false
  PPJoy3.Digital12 = false
endif
if (not(Wiimote3.Two)) and (Pressed(HeldDown(Wiimote3.One, 200 ms))) then
  var.Reversing3 = 1
  PPJoy3.Digital12 = false
  PPJoy3.Digital5 = true
endif
if (not(Wiimote3.Two)) and Wiimote3.One then
  PPJoy3.Digital5 = true
endif
if (Wiimote3.Two = true) then
  var.Reversing3 = 0
endif
if not(Wiimote3.One) then
  var.Reversing3 = 0
endif
if var.Reversing3 = 1 then
PPJoy3.analog1 = 1
endif

endif

// - WIIMOTE + NUNCHUK -

if var.Expansion3 = 1 then

// Steering
PPJoy3.analog0 = Wiimote3.Nunchuk.JoyX
PPJoy3.analog1 = Wiimote3.Nunchuk.JoyY
if Wiimote3.Up then
  PPJoy3.analog1 = -1
endif
if Wiimote3.Down then
  PPJoy3.analog1 = 1
endif
if Wiimote3.Left then
  PPJoy3.analog0 = -1
endif
if Wiimote3.Right then
  PPJoy3.analog0 = 1
endif

// Digital Buttons in Wiimote
PPJoy3.Digital4 = Wiimote3.A
PPJoy3.Digital9 = Wiimote3.Two
PPJoy3.Digital3 = Wiimote3.Minus
PPJoy3.Digital10 = Wiimote3.Plus

// Digital Buttons in Nunchuk
PPJoy3.Digital0 = Wiimote3.Nunchuk.CButton
PPJoy3.Digital11 = Wiimote3.Nunchuk.ZButton

// B Action
if ((Wiimote3.A = true) and (Wiimote3.B = true)) or (Wiimote3.One = true) then
  PPJoy3.Digital12 = true
  PPJoy3.Digital5 = false
endif
if (Wiimote3.A = false) and (Wiimote3.B = true) and (Wiimote3.One = true) then
  PPJoy3.Digital5 = true
  PPJoy3.Digital12 = true
endif
if (Wiimote3.B = false) and (Wiimote3.One = false) then
  PPJoy3.Digital5 = false
  PPJoy3.Digital12 = false
endif
if (not(Wiimote3.A)) and (Pressed(HeldDown(Wiimote3.B, 200 ms))) then
  var.Reversing3 = 1
  PPJoy3.Digital12 = false
  PPJoy3.Digital5 = true
endif
if (not(Wiimote3.A)) and Wiimote3.B then
  PPJoy3.Digital5 = true
endif
if (Wiimote3.A = true) then
  var.Reversing3 = 0
endif
if not(Wiimote3.B) then
  var.Reversing3 = 0
endif
if var.Reversing3 = 1 then
PPJoy3.analog1 = 1
endif

endif

// - CLASSIC CONTROLLER -

if var.Expansion3 = 2 then

// Steering
PPJoy3.analog0 = Wiimote3.Classic.Joy1X
PPJoy3.analog1 = Wiimote3.Classic.Joy1Y
if Wiimote3.Classic.Up then
  PPJoy3.analog1 = -1
endif
if Wiimote3.Classic.Down then
  PPJoy3.analog1 = 1
endif
if Wiimote3.Classic.Left then
  PPJoy3.analog0 = -1
endif
if Wiimote3.Classic.Right then
  PPJoy3.analog0 = 1
endif

// Digital Buttons in Classic Controller
PPJoy3.Digital4 = Wiimote3.Classic.a
PPJoy3.Digital12 = Wiimote3.Classic.R
PPJoy3.Digital9 = Wiimote3.Classic.ZL
PPJoy3.Digital3 = Wiimote3.Classic.Minus or Wiimote3.Classic.y
PPJoy3.Digital10 = Wiimote3.Classic.Plus
PPJoy3.Digital0 = Wiimote3.Classic.ZR or Wiimote3.Classic.x
PPJoy3.Digital11 = Wiimote3.Classic.L

// Reversing
if (not(Wiimote3.Classic.a)) and (Pressed(HeldDown(Wiimote3.Classic.b, 200 ms))) then
  PPJoy3.Digital12 = false
  PPJoy3.Digital5 = true
  var.Reversing3 = 1
endif
if (Wiimote3.Classic.a = true) then
  var.Reversing3 = 0
endif
if Wiimote3.Classic.b then
  PPJoy3.Digital5 = true
endif
if (Wiimote3.Classic.b = false) or Wiimote3.Classic.R then
  var.Reversing3 = 0
  PPJoy3.Digital5 = false
endif
if var.Reversing3 = 1 then
PPJoy3.analog1 = 1
endif

endif


//********************P4********************

// - WIIMOTE -

if var.Expansion4 = 0 then

// Set the Pitch value
var.Pitch4 = Wiimote4.SmoothPitch - var.InitialCalibration

// Steering
if var.MotionOff4 = 0 and Wiimote4.Up = false and Wiimote4.Down = false then
if (var.DeadZone*-0.1 < var.Pitch4 < var.DeadZone*0.1) then
PPJoy4.Analog0 = 0
endif
if (var.DeadZone*-0.5 < var.Pitch4 < var.DeadZone*-0.3) then
PPJoy4.Analog0 = -0.55
endif
if (var.DeadZone*-0.3 < var.Pitch4 < var.DeadZone*-0.2) then
PPJoy4.Analog0 = -0.45
endif
if (var.DeadZone*-0.2 < var.Pitch4 < var.DeadZone*-0.1) then
PPJoy4.Analog0 = -0.35
endif
if (var.DeadZone*-0.1 < var.Pitch4 < var.DeadZone*0.1) then
PPJoy4.Analog0 = 0
endif
if (var.DeadZone*0.1 < var.Pitch4 < var.DeadZone*0.2) then
PPJoy4.Analog0 = 0.35
endif
if (var.DeadZone*0.2 < var.Pitch4 < var.DeadZone*0.3) then
PPJoy4.Analog0 = 0.45
endif
if (var.DeadZone*0.3 < var.Pitch4 < var.DeadZone*0.5) then
PPJoy4.Analog0 = 0.55
endif
if (var.DeadZone*0.5 < var.Pitch4) or (var.DeadZone*-0.5 > var.Pitch4) then
PPJoy4.Analog0 = (var.Pitch4 / var.DeadZone)
endif
endif

// D-pad Steering
if Wiimote4.Right then
  PPJoy4.analog1 = -1
endif
if Wiimote4.Left then
  PPJoy4.analog1 = 1
endif
if (not(Wiimote4.Left)) and (not(Wiimote4.Right)) then
  PPJoy4.analog1 = 0
endif
if Wiimote4.Up then
  PPJoy4.analog0 = -1
endif
if Wiimote4.Down then
  PPJoy4.analog0 = 1
endif
if var.MotionOff4 = true then
if (not(Wiimote4.Up)) and (not(Wiimote4.Down)) then
  PPJoy4.analog0 = 0
endif
endif

// Digital Buttons in Wiimote
PPJoy4.Digital4 = Wiimote4.Two
PPJoy4.Digital11 = Wiimote4.A

// Shake Item
if (Wiimote4.RelAccX > 10) or (Wiimote4.RelAccY > 10) or (Wiimote4.RelAccZ > 10) then
   PPJoy4.Digital11 = true
   wait 100 ms
   PPJoy4.Digital11 = false
   wait 250 ms
endif

// Minus Action
if Released(Wiimote4.Minus) then
   if !var.Held4 then
      PPJoy4.Digital3 = true
      PPJoy4.Digital0 = false
      wait 60 ms
      PPJoy4.Digital3 = false
   else
      var.Held4 = false
   endif
else
   if Pressed(HeldDown(Wiimote4.Minus, var.HeldTime)) then
      PPJoy4.Digital3 = false
      PPJoy4.Digital0 = true
      wait 60 ms
      PPJoy4.Digital0 = false
      var.Held4 = true
   endif
endif

// Plus Action
if Released(Wiimote4.Plus) then
   if !var.Held44 then
      PPJoy4.Digital9 = false
      PPJoy4.Digital10 = true
      wait 60 ms
      PPJoy4.Digital10 = false
   else
      var.Held44 = false
   endif
else
   if Pressed(HeldDown(Wiimote4.Plus, var.HeldTime2)) then
      PPJoy4.Digital10 = false
      PPJoy4.Digital9 = true
      wait 60 ms
      PPJoy4.Digital9 = false
      var.Held44 = true
   endif
endif

// Home Action
if Released(Wiimote4.Home) then
  var.ChangeMode4 = true
  wait 60 ms
  var.ChangeMode4 = 0
endif
if var.ChangeMode4 = true and var.MotionOff4 = 0 and var.XD4 = 0 then
  var.XD4 = true
  var.MotionOff4 = true
  wait 100 ms
  var.XD4 = 0
endif
if var.ChangeMode4 = true and var.MotionOff4 = true and var.XD4 = 0 then
  var.XD4 = true
  var.MotionOff4 = 0
  wait 100 ms
  var.XD4 = 0
endif

// One Action
if ((Wiimote4.Two = true) and (Wiimote4.One = true)) or (Wiimote4.B = true) then
  PPJoy4.Digital12 = true
  PPJoy4.Digital5 = false
endif
if (Wiimote4.Two = false) and (Wiimote4.One = true) and (Wiimote4.B = true) then
  PPJoy4.Digital5 = true
  PPJoy4.Digital12 = true
endif
if (Wiimote4.One = false) and (Wiimote4.B = false) then
  PPJoy4.Digital5 = false
  PPJoy4.Digital12 = false
endif
if (not(Wiimote4.Two)) and (Pressed(HeldDown(Wiimote4.One, 200 ms))) then
  var.Reversing4 = 1
  PPJoy4.Digital12 = false
  PPJoy4.Digital5 = true
endif
if (not(Wiimote4.Two)) and Wiimote4.One then
  PPJoy4.Digital5 = true
endif
if (Wiimote4.Two = true) then
  var.Reversing4 = 0
endif
if not(Wiimote4.One) then
  var.Reversing4 = 0
endif
if var.Reversing4 = 1 then
PPJoy4.analog1 = 1
endif

endif

// - WIIMOTE + NUNCHUK -

if var.Expansion4 = 1 then

// Steering
PPJoy4.analog0 = Wiimote4.Nunchuk.JoyX
PPJoy4.analog1 = Wiimote4.Nunchuk.JoyY
if Wiimote4.Up then
  PPJoy4.analog1 = -1
endif
if Wiimote4.Down then
  PPJoy4.analog1 = 1
endif
if Wiimote4.Left then
  PPJoy4.analog0 = -1
endif
if Wiimote4.Right then
  PPJoy4.analog0 = 1
endif

// Digital Buttons in Wiimote
PPJoy4.Digital4 = Wiimote4.A
PPJoy4.Digital9 = Wiimote4.Two
PPJoy4.Digital3 = Wiimote4.Minus
PPJoy4.Digital10 = Wiimote4.Plus

// Digital Buttons in Nunchuk
PPJoy4.Digital0 = Wiimote4.Nunchuk.CButton
PPJoy4.Digital11 = Wiimote4.Nunchuk.ZButton

// B Action
if ((Wiimote4.A = true) and (Wiimote4.B = true)) or (Wiimote4.One = true) then
  PPJoy4.Digital12 = true
  PPJoy4.Digital5 = false
endif
if (Wiimote4.A = false) and (Wiimote4.B = true) and (Wiimote4.One = true) then
  PPJoy4.Digital5 = true
  PPJoy4.Digital12 = true
endif
if (Wiimote4.B = false) and (Wiimote4.One = false) then
  PPJoy4.Digital5 = false
  PPJoy4.Digital12 = false
endif
if (not(Wiimote4.A)) and (Pressed(HeldDown(Wiimote4.B, 200 ms))) then
  var.Reversing4 = 1
  PPJoy4.Digital12 = false
  PPJoy4.Digital5 = true
endif
if (not(Wiimote4.A)) and Wiimote4.B then
  PPJoy4.Digital5 = true
endif
if (Wiimote4.A = true) then
  var.Reversing4 = 0
endif
if not(Wiimote4.B) then
  var.Reversing4 = 0
endif
if var.Reversing4 = 1 then
PPJoy4.analog1 = 1
endif

endif

// - CLASSIC CONTROLLER -

if var.Expansion4 = 2 then

// Steering
PPJoy4.analog0 = Wiimote4.Classic.Joy1X
PPJoy4.analog1 = Wiimote4.Classic.Joy1Y
if Wiimote4.Classic.Up then
  PPJoy4.analog1 = -1
endif
if Wiimote4.Classic.Down then
  PPJoy4.analog1 = 1
endif
if Wiimote4.Classic.Left then
  PPJoy4.analog0 = -1
endif
if Wiimote4.Classic.Right then
  PPJoy4.analog0 = 1
endif

// Digital Buttons in Classic Controller
PPJoy4.Digital4 = Wiimote4.Classic.a
PPJoy4.Digital12 = Wiimote4.Classic.R
PPJoy4.Digital9 = Wiimote4.Classic.ZL
PPJoy4.Digital3 = Wiimote4.Classic.Minus or Wiimote4.Classic.y
PPJoy4.Digital10 = Wiimote4.Classic.Plus
PPJoy4.Digital0 = Wiimote4.Classic.ZR or Wiimote4.Classic.x
PPJoy4.Digital11 = Wiimote4.Classic.L

// Reversing
if (not(Wiimote4.Classic.a)) and (Pressed(HeldDown(Wiimote4.Classic.b, 200 ms))) then
  PPJoy4.Digital12 = false
  PPJoy4.Digital5 = true
  var.Reversing4 = 1
endif
if (Wiimote4.Classic.a = true) then
  var.Reversing4 = 0
endif
if Wiimote4.Classic.b then
  PPJoy4.Digital5 = true
endif
if (Wiimote4.Classic.b = false) or Wiimote4.Classic.R then
  var.Reversing4 = 0
  PPJoy4.Digital5 = false
endif
if var.Reversing4 = 1 then
PPJoy4.analog1 = 1
endif

endif

//*******************LEDs*******************

// ---P1---

if var.MotionOff2 = 0 and var.AllLeds1 = 0 then
Wiimote1.Led1=true
Wiimote1.Led2=false
Wiimote1.Led3=false
Wiimote1.Led4=false
endif

if var.MotionOff2 = true and var.AllLeds1 = 0 then
Wiimote1.Led1=false
Wiimote1.Led2=false
Wiimote1.Led3=false
Wiimote1.Led4=false
wait 600 ms
Wiimote1.Led1=true
Wiimote1.Led2=false
Wiimote1.Led3=false
Wiimote1.Led4=false
wait 400 ms
endif

// ---P2---

if var.MotionOff2 = 0 and var.AllLeds2 = 0 then
Wiimote2.Led1=false
Wiimote2.Led2=true
Wiimote2.Led3=false
Wiimote2.Led4=false
endif

if var.MotionOff2 = true and var.AllLeds2 = 0 then
Wiimote2.Led1=false
Wiimote2.Led2=false
Wiimote2.Led3=false
Wiimote2.Led4=false
wait 600 ms
Wiimote2.Led1=false
Wiimote2.Led2=true
Wiimote2.Led3=false
Wiimote2.Led4=false
wait 400 ms
endif

// ---P3---

if var.MotionOff3 = 0 and var.AllLeds3 = 0 then
Wiimote3.Led1=false
Wiimote3.Led2=false
Wiimote3.Led3=true
Wiimote3.Led4=false
endif

if var.MotionOff3 = true and var.AllLeds3 = 0 then
Wiimote3.Led1=false
Wiimote3.Led2=false
Wiimote3.Led3=false
Wiimote3.Led4=false
wait 600 ms
Wiimote3.Led1=false
Wiimote3.Led2=false
Wiimote3.Led3=true
Wiimote3.Led4=false
wait 400 ms
endif

// ---P4---

if var.MotionOff4 = 0 and var.AllLeds4 = 0 then
Wiimote4.Led1=false
Wiimote4.Led2=false
Wiimote4.Led3=false
Wiimote4.Led4=true
endif

if var.MotionOff4 = true and var.AllLeds4 = 0 then
Wiimote4.Led1=false
Wiimote4.Led2=false
Wiimote4.Led3=false
Wiimote4.Led4=false
wait 600 ms
Wiimote4.Led1=false
Wiimote4.Led2=false
Wiimote4.Led3=false
Wiimote4.Led4=true
wait 400 ms
endif


This is my longest script by now (more than 1500 lines), so it may take some time to load in most PCs.

EDIT: Now the script is shorter; it's still 1400+ lines, though. I love being evil Twisted Evil


Last edited by wii_128 on Sat Sep 27, 2008 10:18 pm; edited 9 times in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 6:05 pm    Post subject: About my scripts

If you read my scripts, you may have noticed that all of them support 4 Wiimotes. Even in the scripts for 1-player games, the LEDs in Wiimotes 2, 3 and 4 light up. That's why they're so long Rolling Eyes
Back to top
View user's profile Send private message Send e-mail MSN Messenger
wii_128



Joined: 07 Jul 2008
Posts: 61

Digg It
PostPosted: Mon Jul 07, 2008 6:23 pm    Post subject: Heli Attack 3 Script

Heli Attack 3 Script

Even if this isn't a N64 script, someone may like it. So here it is:

Code:
Mouse pointing by Frivolous Sam. Heli Attack 3 game by SquareCircleCo.

Code: