Sponsors of Wiimoteproject.com
IR Pens for Wiimote Whiteboard
Wiimote Project » Wiimote Projects » Wiimote Glovepie projects » My N64 GlovePIE script
Pages: [1]
  Print  
Author Topic: My N64 GlovePIE script  (Read 21910 times)
0 Members and 2 Guests are viewing this topic.
*
Karma: +0/-0
Posts: 6
Offline Offline
View Profile
« on: January 12, 2009, 01:23:32 PM »

This script is mostly used with platformers such as Super Mario 64 and Conker's Bad Fur Day. The only portion I copied was for the analog stick, I typed out the rest. Forgive me if there is a similar script in the 'WiiMote' directory that comes with GlovePIE.

Code:
/*
GlovePIE script by Andrew H.
For Project64 (Using default controls)

--Controls On WiiMote---
Left, Up, Right, Down directional pad arrows control the "C" buttons respectively
'A' button is A
'B' button is B
'Home' button is start
'Z' button is Z on nunchuck
Analog Stick on nuncuck controls character
'Minus' button is L
'Plus' button is R
*/

//To save the the game hold the "C" button on the nunckuck and press the "Home" button on the Wiimote

/*The reason I mapped the Wiimote arrow keys to the 'C' buttons is because
it'd be too awkward to play if they were maped to the N64 controllor arrow buttons*/



Key.Left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
Key.Right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
Key.Up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
Key.Down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)


Key.NUMPAD4 = wiimote1.Left
Key.NUMPAD6 = wiimote1.Right
Key.NUMPAD8 = wiimote1.Up
Key.NUMPAD2 = wiimote1.Down


Key.X = wiimote1.A
Key.Z = Wiimote1.Nunchuk.ZButton
Key.C = Wiimote1.B
Key.A = Wiimote1.Minus
Key.S = Wiimote.Plus


if Wiimote1.Up{
Key.Home = Wiimote1.Up
//debug = "1"
}else{
   Key.Home = ''
}

if Wiimote1.Right{
Key.PageDown = Wiimote1.Right
//ebug = "2"
}else{
   Key.PageDown = ''
}

if Wiimote1.Down{
Key.End = Wiimote1.Down
}else{
   Key.End = ''
}

if Wiimote1.Left{
Key.Delete = Wiimote1.Left
//debug = "4"
}else{
   Key.Delete = ''
}

if wiimote1.nunchuk.CButton && wiimote1.Home{
   Key.F5 = true
}else{
   Key.F5 = false
   Key.Enter = Wiimote1.Home
}

//I added this because the LED's like to light up after connecting the remote
//To BlueTooth and it's distracting.
wiimote.Leds = false
« Last Edit: January 13, 2009, 09:09:21 PM by harmor » Logged
*
Karma: +0/-0
Posts: 6
Offline Offline
View Profile
« Reply #1 on: January 13, 2009, 10:27:15 AM »

This GlovePIE script is for Ken Griffy Jr.'s Slugfest


Code:
/*
Ken Griffy Jr Slugfest
By: Andrew Harmor

*Use Project64 default controls*

--Controls--
Format: Keyboard/Wiimote

Up/Up
Down/Down
Left/Left
Right/Right
C/B
X/A
Enter/Home

Swing the Wiimote to swing the bat
*/


Key.Up = Wiimote1.Up
Key.Left = Wiimote1.Left
Key.Right = Wiimote1.Right
Key.Enter = Wiimote1.Home
Key.Down = Wiimote1.Down
Key.C = Wiimote1.B
Key.A = Wiimote1.Minus
Key.S = Wiimote.Plus

if Wiimote.A then
  Wiimote.Rumble = true
else
  Wiimote.Rumble = false
end if

//debug = Wiimote1.RelAccX

// set these to the offsets when the wiimote is at rest
// will be different for each wiimote
var.x = Wiimote.RawForceX +1.00 //trim to 0
var.threshx = 50



debug = "Var: " + var.x + " Thresh: " + var.threshx

//first sensitivity setting
//xaxis

if var.x > var.threshx{
   //Key.Right = false
   Key.X = true
   var.x = 0
}else{
 Key.X = Wiimote1.A
}



Logged
Guru
*
Karma: +7/-0
Posts: 203
Offline Offline
stoneydumples@hotmail.com stoneydumples View Profile
« Reply #2 on: January 13, 2009, 12:13:13 PM »

Right on!
Logged


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher
*
Karma: +0/-0
Posts: 6
Offline Offline
View Profile
« Reply #3 on: January 13, 2009, 09:10:39 PM »

I modified the script on the first post to save ROM state. Directions on how to save are in the comment block of the script.
Logged
*
Karma: +0/-0
Posts: 1
Offline Offline
View Profile Email
« Reply #4 on: August 22, 2012, 02:19:07 AM »

Hey thanks a lot! This was enough to get me started and refresh me on my C++! Anyways, I took your code and and added some big improvements to it. I wanted game play to be smoother and feel more like Wii controls. I moved the R button on the n64 controller to the c button on the wiimote because R is used fairly often and c is much easier to press than +. Plus was moved to be the Start button to pause games, and if the wiimote is set down it will automatically pause the game. You can use the home button on the wiimote to togel full screen on and off. Pressing the c button and plus will save the game and pressing c, z, and 1 at the same time restores you to your last save. Smiley I also made one just for OoT, but the only difference is that shaking the wiimote with your wrist also works as b.

Code:
/*

!!!!!!!!!!Wiimote on Project 64!!!!!!!!!!
                 v1.2

GlovePIE script by Andrew H.
Optimized by Colin L.
For Project64 (Using default controls)

--Controls On WiiMote---

Left, Up, Right, Down directional pad arrows control the "C" buttons respectively
'A' button is A
'B' button is B
'Home' button or setting the WiiMote down is start
'Z' button is Z on nunchuk
Analog Stick on nunchuk controls character
'C' button is R


--Other Functionality--

To save the game, hold the 'C' button on the nunchuk and press
the '+' button.

To restore your last save, hold the 'C' and 'Z' buttons on the
nunchuk and press '1' on the Wiimote.

To toggle fullscreen on and off, press the home button


--Comments--

The reason I mapped the Wiimote arrow keys to the 'C' buttons is
because it'd be too awkward to play if they were mapped to the N64
controller arrow buttons.
*/



//Joystick Configuration: Andrew H. Original

Key.Left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
Key.Right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
Key.Up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
Key.Down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)


//D-pad Configuration: Andrew H. Original

Key.NUMPAD4 = wiimote1.Left
Key.NUMPAD6 = wiimote1.Right
Key.NUMPAD8 = wiimote1.Up
Key.NUMPAD2 = wiimote1.Down


//Other N64 Controler Configuration: Colin L. Optimized

Key.X = wiimote1.A
Key.Z = Wiimote1.Nunchuk.ZButton
Key.C = Wiimote1.B
Key.S = Wiimote1.nunchuk.CButton
Key.A = Wiimote1.Minus
Key.Enter = Wiimote.Plus


//Key Press Variable: Colin L. Original
//This is to prevent OnTable from being triggered durring gameplay

if(Key.Left or Key.Right or Key.Up or Key.Down or Key.NUMPAD8 or Key.NUMPAD6 or Key.NUMPAD4 or Key.NUMPAD2 or Key.X or Key.Z or Key.C or Key.A or Key.S){

   var.KeyPress = true
   wait(4.3s)

}else{
   var.KeyPress = false
}


//Start/Pause Button Configuration: Colin L. Original

if (var.EnterHit == (false or 0) and var.KeyPress == false){
   Key.Enter = Wiimote.Plus or Wiimote.OnTable

}else{
Key.Enter = Wiimote.Plus
}

if (Key.Enter && var.EnterHit == (false or 0)){
   wait(1s)
   var.EnterHit = true
   wait(1s)

}elseif Key.Enter{
   wait(1s)
   var.EnterHit = false
   wait(1s)
}

if Wiimote.B or Wiimote.DrumBeat{
   var.EnterHit = false
}


//Project 64 Special Function Configuration: Colin L. Optimized

Key.F5 = Wiimote1.nunchuk.CButton && Wiimote1.Plus
Key.F7 = Wiimote1.nunchuk.CButton && Wiimote1.nunchuk.ZButton && Wiimote.One


//Fullscreen Debug Loop: Colin L. Original

var.ControlTwo = 0
while(Pressed(Wiimote1.Home)){
    if var.ControlTwo = 0{
       Key.Alt and Key.Enter = true
       var.ControlTwo++

    }else{
       Key.Alt and Key.Enter = false
    }
}


//Other Debugging: Andrew H. Original

if Wiimote1.Up{
Key.Home = Wiimote1.Up
//debug = "1"
}else{
   Key.Home = ''
}

if Wiimote1.Right{
Key.PageDown = Wiimote1.Right
//debug = "2"
}else{
   Key.PageDown = ''
}

if Wiimote1.Down{
Key.End = Wiimote1.Down
}else{
   Key.End = ''
}

if Wiimote1.Left{
Key.Delete = Wiimote1.Left
//debug = "4"
}else{
   Key.Delete = ''
}




//LED Settings: Colin L. Original

//Controler 1
Wiimote1.Led1 = true
Wiimote1.Led2 = false
Wiimote1.Led3 = false
Wiimote1.Led4 = false

//Controler 2
Wiimote2.Led1 = false
Wiimote2.Led2 = true
Wiimote2.Led3 = false
Wiimote2.Led4 = false

//Controler 3
Wiimote3.Led1 = false
Wiimote3.Led2 = false
Wiimote3.Led3 = true
Wiimote3.Led4 = false

//Controler 4
Wiimote4.Led1 = false
Wiimote4.Led2 = false
Wiimote4.Led3 = false
Wiimote4.Led4 = true
« Last Edit: August 22, 2012, 06:02:23 PM by colin012 » Logged
Pages: [1]
  Print  
 
Jump to:  

Clicky Web Analytics