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 

GlovePIE Wii-Mote Scripts
Goto page Previous  1, 2, 3 ... 37, 38, 39 ... 53, 54, 55  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
Savior X



Joined: 07 Apr 2007
Posts: 13

Digg It
PostPosted: Wed Aug 08, 2007 11:59 pm    Post subject: Completed [The World] Controller Script

Thanks for your help before fortunzfavor.

Here is the completed script for [The World] Wiimote Controller. This is all assuming that you are holding the controller sideways. It has three different modes:

Controller Mode: All the buttons are used for attacking and basic gameplay.

Mouse Mode: Holding down the B Button allows you to control the mouse with the arrow keys and the 1 and 2 buttons are the left and right mouse keys.

Battery Mode: Hold down the Home button for battery life display in the HUD and LEDs.

In case you guys are wondering what [The World] is, here is a link to the main website:

http://cyberconnects.com/Site/portal.php

Code:
//Name: The World - Wiimote Only Script
//Author: Savior X (Matthew Olivo), with much of the work given to the
//        following people:
//        - Mac Guy and his script Wiindows Navigation for the Battery Life LED
//          Script
//        - MGuitarHero and his D-Pad Mouse Script
//        - fortunzfavor for locating the above mentioned script for me
//
//
//
//Wiimote Default Controls:
//
// (THIS IS ASSUMING THE CONTROLLER IS TURNED SIDEWAYS)
//
//    -----------------
//     CONTROLLER MODE
//    -----------------
//
//B Button: Hold down to enter Mouse Mode
//A Button: Keyboard Insert
//Up Button: Keyboard Up
//Down Button: Keyboard Down
//Left Button: Keyboard Left
//Right Button: Keyboard Right
//Minus Button: Keyboard ESC
//Plus Button: Keyboard Enter
//One Button: Keyboard Left Shift
//Two Button: Keyboard Left Control
//Home Button: Battery Life Output on LEDS and in Debug Window
//
//
//
//        --------------
//          Mouse Mode
//        --------------
//
//B Button: Release to enter Controller Mode
//Down Button: Mouse Down
//Up Button: Mouse up
//Left Button: Mouse Left
//Right Button: Mouse Right
//One Button: Left Mouse Button
//Two Button: Right Mouse Button
//
//
//This small subsection is what I have contributed to this script, in addition
//to the tutorials above.

while (Wiimote.Home == false and Wiimote.B == false)
      Wiimote.Led1 = false
      Wiimote.Led2 = true
      Wiimote.Led3 = true
      Wiimote.Led4 = false
endif

//THIS SECTION HERE WOULD BE IF THE CONTROLLER WAS TURNED SIDEWAYS

//Wiimote Buttons

Keyboard.Enter = Wiimote.Plus         //Keyboard Enter

Keyboard.Escape = Wiimote.Minus        //Keyboard ESC

Keyboard.LeftControl = Wiimote.Two         //Keyboard Left Control

Keyboard.LeftShift = Wiimote.One        //Keyboard Left Shift

Keyboard.Up = Wiimote.Right        //Keyboard Up

Keyboard.Down = Wiimote.Left       //Keyboard Down

Keyboard.Left = Wiimote.Up       //Keyboard Left

Keyboard.Right = Wiimote.Down     //Keyboard Right

Keyboard.Insert = Wiimote.A     //Keyboard Insert

debug = "Welcome to [The World] - Controller Mode"

//Below is what came from Mac Guy and his script Wiindows Navigation

while Wiimote.Home == true
   var.Batt = wiimote.Battery / 48

   if true then
      wait 5 seconds
      Wiimote.Report15 = 0x80 | Int(wiimote.Rumble)
   endif
   debug = "Welcome to [The World] - Battery level: " + 100*48*var.Batt/192 + "%"

   if 0 <= var.Batt <= 0.25 then
      Wiimote.Leds = 1
      wait var.Blink
      Wiimote.Leds = 0
      wait var.Blink
   elseif 0.25 < var.Batt<=1 then
      Wiimote.Leds = 1
   elseif 1 < var.Batt<=1.25 then
      Wiimote.Leds = 3
      wait var.Blink
      Wiimote.Leds = 1
      wait var.Blink
   elseif 1.25 < var.Batt<=2 then
      Wiimote.Leds = 3
   elseif 2 < var.Batt<=2.25 then
      Wiimote.Leds = 7
      wait var.Blink
      Wiimote.Leds = 3
      wait var.Blink
   elseif 2.25 < var.Batt<=3 then
      Wiimote.Leds = 7
   elseif 3 < var.Batt<=3.25 then
      Wiimote.Leds = 15
      wait var.Blink
      Wiimote.Leds = 7
      wait var.Blink
   elseif 3.25 < var.Batt<=4 then
      Wiimote.Leds = 15
   else
      Wiimote.Leds = 0
   endif
endif

//Below is part of the D-Pad Mousing Script from MGuitarHero's
//Wiimote D-Pad Mouse

if wiimote1.b {
   var.dmouse = true
   else
   var.dmouse = false
}

if var.dmouse = true {

debug = "Welcome to [The World] - Mouse Mode"
Wiimote1.Led1 = True
Wiimote1.Led2 = False
Wiimote1.Led3 = False
Wiimote1.Led4 = True

if wiimote.Up = true then                  //Mouse Left
Mouse.CursorPosX = Mouse.CursorPosX - 8
end if

if wiimote.Down = true then                //Mouse Right
Mouse.CursorPosX = Mouse.CursorPosX + 8
end if

if wiimote.Right = true then               //Mouse Up
Mouse.CursorPosY = Mouse.CursorPosY - 8
end if

if wiimote.Left = true then                //Mouse Down
Mouse.CursorPosY = Mouse.CursorPosY + 8
end if

Mouse.LeftButton = Wiimote.One             //Left Mouse Button

Mouse.RightButton = Wiimote.Two            //Right Mouse Button
}
[/url]
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
JoeGamer



Joined: 11 Aug 2007
Posts: 7

Digg It
PostPosted: Sat Aug 11, 2007 1:46 pm    Post subject:

Here are my codes for a "Make it your self" FPS script and a General RTS one
Quote:
/******************************************************
* Script your own FPS
*by: Joseph Bozarth
*ver. 0.1
*Rights:Open to all (obviously) thanks to Marco Ceppi for
*your Analog movement and IR mouse.
*
*
*
*
*
*****************************************************/
var.dummy = wiimote.rawforcex
var.xNunchuk = Wiimote.Nunchuk.JoyX * 100
var.yNunchuk = Wiimote.Nunchuk.JoyY * 100
var.xOff = 7
var.yOff = 7
var.nunchukAccX = 19.0
var.xOffset = 0
var.yOffset = 0
var.irAmount = 2
var.smooth = 80
var.speed = 1
var.zoom = 1/2
var.deadzone = 40

//If you want to change these up a bit feal free. otherwise just replace the
//? with the button you want and if you want to use the C and Z buttons
//simply change Wiimote.? to Wiimote.Nunchuk.CButton or ZButton
key.? = Wiimote.Up
key.? = Wiimote.Right
key.? = Wiimote.Down
key.? = Wiimote.One
key.? = Wiimote.Two
key.? = Wiimote.Plus
key.? = Wiimote.Minus
mouse.WheelUp = Wiimote.?
mouse.WheelDown = Wiimote.?
mouse.RightButton = Wiimote.?
key.escape = Wiimote.Home
mouse.LeftButton = Wiimote.B

//Variables for Nunchuk Rotation. Standard x, y, and z

var.nzRot = Wiimote.Nunchuk.gz
var.nxRot = Wiimote.Nunchuk.gx
var.nyRot = Wiimote.Nunchuk.gy

//Rotations if too sensitive raise the number
//tilt up
if var.nzRot >= 0.5 then
//put what you want it to do here. like key.a
endif
//tilt down
if var.nzRot <= -0.5 then
//your code
endif
//tilt Right
if var.nxRot >= 0.5 then
//
endif
//tilt left
if var.nxRot <= -0.5 then
//
endif
//tilt forward? I don't know I think you just move it forward and back
if var.nyRot >= 0.5 then
//
endif
//same deal except back
if var.nyRot <= -0.5 then
//
endif

//downward nunchuk flick good for reload.
if Wiimote.Nunchuk.RawAccX > var.nunchukAccX or < -var.nunchukAccX then
key.? = true
key.? = false
endif

//wiimote led (just makes the first led light up)
Wiimote.leds = 1

//
// Analog Movements (Taken from Marco Ceppi's HL2 script
//I could have done it myself it was just faster to do this along with the
//IR mouse[I did the IR mouse because I am new to programming and I
//don't quite get that yet])

if var.xNunchuk > var.xOff and var.yNunchuk > var.yOff then
key.w = false
key.a = false
key.s = true
key.d = true
//debug = 'SE'
else if var.xNunchuk > var.xOff and var.yNunchuk < -var.yOff then
key.w = true
key.a = false
key.s = false
key.d = true
//debug = 'NE'
else if var.xNunchuk < -var.xOff and var.yNunchuk < -var.yOff then
key.w = true
key.a = true
key.s = false
key.d = false
//debug = 'NW'
else if var.xNunchuk < -var.xOff and var.yNunchuk > var.yOff then
key.w = false
key.a = true
key.s = true
key.d = false
//debug = 'SW'
else if var.xNunchuk > var.xOff then
key.w = false
key.a = false
key.s = false
key.d = true
//debug = 'Right'
else if var.xNunchuk < -var.xOff then
key.w = false
key.a = true
key.s = false
key.d = false
//debug = 'Left'
else if var.yNunchuk < -var.yOff then
key.w = true
key.a = false
key.s = false
key.d = false
//debug = 'Up'
else if var.yNunchuk > var.yOff then
key.w = false
key.a = false
key.s = true
key.d = false
//debug = 'Down'
else if var.xNunchuk > -var.xOff and < var.xOff and var.yNunchuk < var.yOff and > -var.yOff then
key.w = false
key.a = false
key.s = false
key.d = false
//debug = 'Khai sucks'
else
key.w = false
key.a = false
key.s = false
key.d = false
//debug = 'Khai sucks'
endif

// IR Mouse
//
If var.irAmount = 2 Then
var.xPos = (Wiimote.dot1x + Wiimote.dot2x) / 2
var.yPos = (Wiimote.dot1y + Wiimote.dot2y) / 2
Else
var.xPos = Wiimote.dot1x
var.yPos = Wiimote.dot1y
EndIf

If Wiimote.dot1vis Then
// Locate Inrared Point Coordinates
var.actualX = (1-(round(var.xPos) / 1024)) * Screen.Width
var.actualY = ((round(var.yPos) / 768)) * Screen.Height
// Determine Look Speed
var.speedX = (((var.actualX / (Screen.Width / 2)) - 1) * var.smooth) + var.xOffset
var.speedY = (((var.actualY / (Screen.Height / 2)) - 1) * var.smooth) + var.yOffset
// Calculate Point-Range Multipliers
If abs(var.speedX / var.deadzone) > 1 Then var.multX = 1 Else var.multX = abs(var.speedX / var.deadzone)
If abs(var.speedY / var.deadzone) > 1 Then var.multY = 1 Else var.multY = abs(var.speedY / var.deadzone)
// Scoped And Normal Multipliers
If Wiimote.A = True Then
var.speedX = var.speedX * var.zoom
var.speedY = var.speedY * var.zoom
Else
var.speedX = var.speedX * var.speed
var.speedY = var.speedY * var.speed
EndIf
// Move Cursor
If abs(var.speedX) > 0 Then Mouse.CursorPosX = Mouse.CursorPosX + (var.speedX * var.multX)
If abs(var.speedY) > 0 Then Mouse.CursorPosY = Mouse.CursorPosY + (var.speedY * var.multY)
// Backup Last Motions
var.lastX = var.speedX
var.lasty = var.speedY
Else // If dot is not visible use last known value
If abs(var.lastX) > 1 Then Mouse.CursorPosX = Mouse.CursorPosX + var.lastX
If abs(var.lastY) > 1 Then Mouse.CursorPosY = Mouse.CursorPosY + var.lastY
EndIf
debug = 'Debug: SpeedY: ' + var.speedY + ' SpeedX: ' + var.speedX

there is the FPS here is the RTS
Quote:
//RTS games

var.xNunchuk = Wiimote.Nunchuk.JoyX * 100
var.yNunchuk = Wiimote.Nunchuk.JoyY * 100
var.xOff = 7
var.yOff = 7
var.nunchukAccX = 19.0
var.xOffset = 0
var.yOffset = 0
var.irAmount = 2
var.smooth = 80
var.speed = 1
var.zoom = 1/2
var.deadzone = 40

//buttons

mouse.LeftButton = Wiimote.A
mouse.RightButton = Wiimote.B
mouse.WheelUp = Wiimote.Up
mouse.WheelDown = Wiimote.Down
key.escape = Wiimote.Home
volume.up = Wiimote.Plus
volume.down = Wiimote.Minus
key.control = Wiimote.Nunchuk.CButton
key.shift = Wiimote.Nunchuk.ZButton


if var.xNunchuk > var.xOff and var.yNunchuk > var.yOff then
key.one = false
key.two = true
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = false
else if var.xNunchuk > var.xOff and var.yNunchuk < -var.yOff then
key.one = false
key.two = false
key.three = false
key.four = true
key.five = false
key.six = false
key.seven = false
key.eight = false
else if var.xNunchuk < -var.xOff and var.yNunchuk < -var.yOff then
key.one = false
key.two = false
key.three = false
key.four = false
key.five = false
key.six = true
key.seven = false
key.eight = false
else if var.xNunchuk < -var.xOff and var.yNunchuk > var.yOff then
key.one = false
key.two = false
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = true
else if var.xNunchuk > var.xOff then
key.one = false
key.two = false
key.three = true
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = false
else if var.xNunchuk < -var.xOff then
key.one = false
key.two = false
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = true
key.eight = false
else if var.yNunchuk > var.yOff then
key.one = true
key.two = false
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = false
else if var.yNunchuk < -var.yOff then
key.one = false
key.two = false
key.three = false
key.four = false
key.five = true
key.six = false
key.seven = false
key.eight = false
else if var.xNunchuk > -var.xOff and < var.xOff and var.yNunchuk > -var.yOff and < var.yOff then
key.one = false
key.two = false
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = false
else
key.one = false
key.two = false
key.three = false
key.four = false
key.five = false
key.six = false
key.seven = false
key.eight = false
endif

var.nzRot = Wiimote.Nunchuk.gz
var.nxRot = Wiimote.Nunchuk.gx
var.nyRot = Wiimote.Nunchuk.gy

if var.xRot >= 0.3 then
key.right = true
endif
if var.xRot <= -0.3 then
key.left = true
endif
if var.yRot >= 0.2 then
key.up = true
endif
if var.yRot <= -0.2 then
key.down = true
endif

//
// IR Mouse
//
If var.irAmount = 2 Then
var.xPos = (Wiimote.dot1x + Wiimote.dot2x) / 2
var.yPos = (Wiimote.dot1y + Wiimote.dot2y) / 2
Else
var.xPos = Wiimote.dot1x
var.yPos = Wiimote.dot1y
EndIf

If Wiimote.dot1vis Then
// Locate Inrared Point Coordinates
var.actualX = (1-(round(var.xPos) / 1024)) * Screen.Width
var.actualY = ((round(var.yPos) / 768)) * Screen.Height
// Determine Look Speed
var.speedX = (((var.actualX / (Screen.Width / 2)) - 1) * var.smooth) + var.xOffset
var.speedY = (((var.actualY / (Screen.Height / 2)) - 1) * var.smooth) + var.yOffset
// Calculate Point-Range Multipliers
If abs(var.speedX / var.deadzone) > 1 Then var.multX = 1 Else var.multX = abs(var.speedX / var.deadzone)
If abs(var.speedY / var.deadzone) > 1 Then var.multY = 1 Else var.multY = abs(var.speedY / var.deadzone)
// Scoped And Normal Multipliers
If Wiimote.A = True Then
var.speedX = var.speedX * var.zoom
var.speedY = var.speedY * var.zoom
Else
var.speedX = var.speedX * var.speed
var.speedY = var.speedY * var.speed
EndIf
// Move Cursor
If abs(var.speedX) > 0 Then Mouse.CursorPosX = Mouse.CursorPosX + (var.speedX * var.multX)
If abs(var.speedY) > 0 Then Mouse.CursorPosY = Mouse.CursorPosY + (var.speedY * var.multY)
// Backup Last Motions
var.lastX = var.speedX
var.lasty = var.speedY
Else // If dot is not visible use last known value
If abs(var.lastX) > 1 Then Mouse.CursorPosX = Mouse.CursorPosX + var.lastX
If abs(var.lastY) > 1 Then Mouse.CursorPosY = Mouse.CursorPosY + var.lastY
EndIf
debug = 'Debug: SpeedY: ' + var.speedY + ' SpeedX: ' + var.speedX
Back to top
View user's profile Send private message
gamexprt1



Joined: 23 Apr 2007
Posts: 54
Location: Washington

Digg It
PostPosted: Sat Aug 11, 2007 8:15 pm    Post subject:

Ultimate Gaming:
Code:
// Ultimate Gaming Script (Version 1.3)
` By Keenan (AKA Gamexprt1), Email me at Gamexprt1@Gmail.com
` Some requires Nunchuk and a Wiimote
` For FCE, ZSNES, Fusion, MAME32 and Project64

// Now you no longer have to constantly switch through various scripts.
 ` All it takes now is a touch of a key and you can play your favorite
 ` games with the Wiimote and/or Nunchuk.

 /// Instructions
  * Control Modes:
   ` By pressing Numpad 9 or Numpad 3 on your Wiimote, you will
   ` switch through Control Modes. Pressing Numpad 9 will cycle
   ` upwards, and pressing Numpad 3 will cycle downwards.
   ` Control Modes are scripted based on the
   ` descriptions below. The LEDs on the Wiimote indicate which
   ` Control Mode you are currently on.

  * Extra
   -- MAME and Half-Life
   ` Numpad 0 = No Wii-Mouse
   ` Numpad 1 = Tilt Wii-Mouse
   ` Numpad 7 = Infa-Red Wii-Mouse

   -- NES
   ` You may need to setup the controls on your emulator to match mine
   ` if you have the latest version of FCE.

 /// Control Mode 1 \\\
   * Nintendo (NES) Control (W + N)
    ` Plus = Start
    ` Minus = Select
    ` B Button = B Button
    ` A Button = A Button
    ` Up = Screenshot
    ` Down (Hold) = Reset
    ` Left = Save State 0
    ` Right = Save State 1
    ` One = Save
    ` Two = Load
    ` Z Button = Turbo B
    ` C Button = Turbo A
    ` Analog-Stick = D-Pad

 /// Control Mode 2 \\\
   * Super Nintendo (SNES) Control
    ` Plus = Start
    ` Minus = Select
    ` Right = A Button
    ` Down = B Button
    ` Up = X Button
    ` Left = Y Button
    ` B Button = Right Trigger
    ` One = Save
    ` Two = Load
    ` Z Button = Left Trigger
    ` Analog-Stick = D-Pad

 /// Control Mode 3 \\\
   * Nintendo Sixty-Four (N64) Control
    ` D-Pad = D-Pad
    ` A Button = A Button
    ` B Button = B Button
    ` Home = Start
    ` Plus = Right Trigger
    ` Minus = Left Trigger
    ` One = Save
    ` Two = Load
    ` Analog-Stick = Analog Stick
    ` Z Button = Z Button
    ` C Button + Analog-Stick = C Buttons

/// Control Mode 4 \\\
   * Two Player NES (W + N) Control
   -- Use FCE Controller Setup or Manually Configure
   -- P1 Hold Wiimote sideways and P2 hold Nunchuk
    // Player 1
    ` D-Pad = D-Pad
    ` Minus = Select
    ` Plus = Start
    ` 1 = B Button
    ` 2 = A Button

    // Player 2
    ` Analog-Stick = D-Pad
    ` C Button = A
    ` Z Button = B

/// Control Mode 5 \\\
   * Nintendo (NES) Control (Just Wiimote)
    ` D-Pad = D-Pad
    ` Plus = Start
    ` Minus = Select
    ` One = B
    ` Two = A
    ` A = Save
    ` B = Load

/// Control Mode 6 \\\
   * Game-Boy Control
    ` Analog Stick = D-Pad
    ` A = A
    ` B = B
    ` Plus = Start
    ` Minus = Select
    ` One = Save
    ` Two = Load

/// Control Mode 7 \\\
   * Game-Boy Advanced Control
    ` Analog Stick = D-Pad
    ` A = A
    ` B = B
    ` Plus = Start
    ` Minus = Select
    ` One = Save
    ` Two = Load
    ` Nunchuk C = Left Trigger
    ` Nunchuk Z = Right Trigger

/// Control Mode 8 \\\
   * Sega Master System (SMS) Control
    ` Analog Stick = D-Pad
    ` A = 1
    ` B = 2
    ` Home = Start
    ` One = Save
    ` Two = Load

/// Control Mode 9 \\\
   * Sega Genesis, Sega Genesis 2 & Game Gear (SG) Control
    ` Analog Stick = D-Pad
    ` A = A
    ` B = B
    ` C = C
    ` Home = Start
    ` One = Save
    ` Two = Load

/// Control Mode 10 \\\
   * Sega Genesis 3 (SG3) Control
    ` Analog Stick = D-Pad
    ` A = Up
    ` B = Down
    ` C = A
    ` X =
    ` Plus = Start
    ` Minus = Mode
    ` One = Save
    ` Two = Load

/// Control Mode 11 \\\
   * MAME (MAME) Control
    ` MAME Control 1 = Tilt Wiimote
    ` MAME Control 2 = Infa-Red Wiimote
    ` A Button = Use Light-Gun
    ` Analog-Stick = Joy-Stick
    ` Up = Put in Coin
    ` Plus = Start
    ` Minus = Pause
    ` One = Save
    ` Two = Load
    ` Z Button = Screen Shot

/// Control Mode 12 \\\
   * Half-Life (HL) Control
    ` Home = Escape
    ` Up or C Button = Jump
    ` Down = Crouch
    ` Plus = Activate/Interact
    ` Minus = Turn Flashlight on/off
    ` Analog = Move
    ` Shake Nunchuk = Reload
    ` Right = Cycle through weapons right
    ` Left = Cycle through weapons left
    ` B Button = Primary Attack
    ` A Button = Secondary Attack
    ` Z Button = Take Snapshot
    ` 1 = Save
    ` 2 = Load

// NES Script
If (Var.Control = 1) Then
 Var.C = "NES * 1"
 Var.M = 0
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 Key.One = Wiimote.Left
 Key.Zero = Wiimote.Right
 Backspace = Wiimote.Minus
 Enter = Wiimote.Plus
 Z = Wiimote.B
 X = Wiimote.A
 F5 = Helddown(Wiimote.One, Var.TimeS)
 F7 = Helddown(Wiimote.Two, Var.TimeS)
 A = Wiimote.Nunchuk.ZButton
 S = Wiimote.Nunchuk.CButton
 (Alt + Printscreen) = Wiimote.Up
 F10 = Helddown(Wiimote.Down, Var.TimeS)
Endif

// SNES Script
If (Var.Control = 2) Then
 Var.C = "SNES"
 Enter = Wiimote.Plus
 RightShift = Wiimote.Minus
 X = Wiimote.Right
 Z = Wiimote.Down
 S = Wiimote.Up
 A = Wiimote.Left
 D = Wiimote.B
 C = Wiimote.Nunchuk.ZButton
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 F2 = Helddown(Wiimote.One, Var.TimeS)
 F4 = Helddown(Wiimote.Two, Var.TimeS)
Endif

// N64 Script
If (Var.Control = 3) Then
 Var.C = "N64"
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 X = Wiimote.A
 C = Wiimote.B
 Enter = Wiimote.Home
 A = Wiimote.Minus
 S = Wiimote.Plus
 Z = Wiimote.Nunchuk.ZButton
 Numpad8 = Wiimote.Up
 Numpad2 = Wiimote.Down
 Numpad4 = Wiimote.Left
 Numpad6 = Wiimote.Right
 F5 = Wiimote.One
 F7 = Wiimote.Two
 If (Wiimote.Nunchuk.CButton) Then
   Up = False
   Down = False
   Left = False
   Right = False
  Delete = (Var.Left)
  PageDown = (Var.Right)
  Home = (Var.Up)
  End = (Var.Down)
 Endif
Endif

// NES Two-Player Script
If (Var.Control = 4) Then
 Var.C = "NES 2*2"
 Right = Wiimote.Down
 Left = Wiimote.Up
 Up = Wiimote.Right
 Down = Wiimote.Left
 Backspace = Wiimote.Minus
 Enter = Wiimote.Plus
 Z = Wiimote.One
 X = Wiimote.Two
 F5 = Helddown(Wiimote.A, Var.TimeS)
 F7 = Helddown(Wiimote.B, Var.TimeS)
 G = (Wiimote.Nunchuk.JoyX <= -0.5)
 J = (Var.Right)
 Y = (Wiimote.Nunchuk.JoyY <= -0.5)
 H = (Var.Down)
 O = Wiimote.Nunchuk.ZButton
 P = Wiimote.Nunchuk.CButton
Endif

// Old-Skool NES Script
If (Var.Control = 5) Then
 Var.C = "NES * 2"
 Up = Wiimote.Right
 Down = Wiimote.Left
 Left = Wiimote.Up
 Right = Wiimote.Down
 Backspace = Wiimote.Minus
 Enter = Wiimote.Plus
 Z = Wiimote.One
 X = Wiimote.Two
 F5 = Helddown(Wiimote.A, Var.TimeS)
 F7 = Helddown(Wiimote.B, Var.TimeS)
Endif

// Gameboy Script
If (Var.Control = 6) Then
 Var.C = "GB"
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 Enter = Wiimote.Plus
 BackSpace = Wiimote.Minus
 X = Wiimote.B
 Z = Wiimote.A
 F1 = Helddown(Wiimote.Two, Var.TimeS)
(Shift + F1) = Helddown(Wiimote.One, Var.TimeS)
Endif

// Gameboy Advanced Script
If (Var.Control = 7) Then
 Var.C = "GBA"
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 Enter = Wiimote.Plus
 BackSpace = Wiimote.Minus
 X = Wiimote.B
 Z = Wiimote.A
 A = Wiimote.Nunchuk.CButton
 S = Wiimote.Nunchuk.ZButton
 F1 = Helddown(Wiimote.Two, Var.TimeS)
(Shift + F1) = Helddown(Wiimote.One, Var.TimeS)
Endif

// Sega Master System Script
If (Var.Control = 8) Then
 Var.C = "SMS"
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 F5 = Wiimote.One
 F8 = Wiimote.Two
 Enter = Wiimote.Home
 A = Wiimote.A
 S = Wiimote.B
Endif

// Sega Genisis Script
If (Var.Control = 9) Then
 Var.C = "SG"
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 Enter = Wiimote.Home
 A = Wiimote.A
 S = Wiimote.B
 D = Wiimote.Nunchuk.CButton
 F5 = Wiimote.One
 F8 = Wiimote.Two
Endif

// Sega Genisis 3 Script
If (Var.Control = 10) Then
 Var.C = "SG3"
 Var.M = 0
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 F5 = Wiimote.One
 F8 = Wiimote.Two
 Enter = Wiimote.Plus
 Shift = Wiimote.Minus
 A = Wiimote.Up
 S = Wiimote.Down
 D = Wiimote.A
 Z = Wiimote.B
 X = Wiimote.Nunchuk.CButton
 C = Wiimote.Nunchuk.ZButton
Endif

// MAME Script
If (Var.Control = 11) Then
 Var.C = "MAME " + Round(Var.M)
 Mouse.LeftButton = Wiimote.B
 P = Wiimote.Minus
 Right = (Var.Right)
 Left = (Var.Left)
 Up = (Var.Up)
 Down = (Var.Down)
 Five = Helddown(Wiimote.Up, .1 S)
 One = Wiimote.Plus
 (Shift + F7) = Helddown(Wiimote.1, .2 S)
 F7 = Helddown(Wiimote.2, .2 S)
 F12 = Wiimote.Nunchuk.ZButton
Endif

// Half-Life Script
If (Var.Control = 12) Then
 Var.C = "HL " + Var.WM
 Escape = Wiimote.Home
 Space = (Wiimote.Up Or Wiimote.Nunchuk.CButton)
 Control = Wiimote.Down
 E = Wiimote.Plus
 F = Wiimote.Minus
 R = (Wiimote.Nunchuk.RawAccY >= 20)
 D = (Wiimote.Nunchuk.JoyX >= .3)
 A = (Wiimote.Nunchuk.JoyX <= -.3)
 W = (Wiimote.Nunchuk.JoyY <= -.3)
 S = (Wiimote.Nunchuk.JoyY >= .3)
 F6 = Helddown(Wiimote.One, .2 S)
 F7 = Helddown(Wiimote.Two, .2 S)

 If Wiimote.Right Then
  Mouse.WheelDown = True
  Wait .2 S
 Endif

 If Wiimote.Left Then
  Mouse.WheelUp = True
  Wait .2 S
 Endif

 If (Wiimote.B = True) Then
  Mouse.LeftButton = True
  Else
  Mouse.LeftButton = False
 Endif

 If (Wiimote.A = True) Then
  Mouse.RightButton = True
  Else
  Mouse.RightButton = False
 Endif
Endif

// Control Sceme Change Script
If (Key.NUMPAD9) Then
 If (Var.Control < 13)
  Var.Control = (Var.Control + 1)
  Wait Var.TimeS
  Else
  Var.Control = 1
 Endif
Endif

If (Key.Numpad3) Then
 If (Var.Control > 0)
  Var.Control = (Var.Control - 1)
  Wait Var.TimeS
  Else
  Var.Control = 12
 Endif
Endif

// Wii-Mouse Control Scheme Change Script
If ((Var.Control = 11) Or (Var.Control = 12)) Then
 If (Numpad0 = True) Then
  Var.M = 0
 Endif

 If (Numpad1 = True) Then
  Var.M = 1
 Endif

 If (Numpad7 = True) Then
  Var.M = 2
 Endif
Endif

If (Var.M = 1) Then
Var.WM = "Tilt"
Var.X = (Wiimote.RawForceX + 6) -- Trim to 0
Var.Y = (Wiimote.RawForceY - 31) -- Trim to 0
Var.Z = (Wiimote.RawForceZ + 6) -- Trim to 0

Var.Sense0 = 500
Var.Thresh0X = 5
Var.Thresh0Y = 2

Var.Sense = 300
Var.ThreshX = 10
Var.ThreshY = 5

Var.Sense2 = 100
Var.Thresh2x = 15
Var.Thresh2y = 8

Var.Sense3 = 50
Var.Thresh3X = 20
Var.Thresh3Y = 12

If (Var.X >= Var.Thresh0X)
  Mouse.X = (Mouse.X - 1 / Var.Sense0)
Endif
If (Var.X <= -Var.Thresh0X)
  Mouse.X = (Mouse.X + 1 / Var.Sense0)
Endif

If (Var.Z >= Var.ThreshY)
  Mouse.Y = (Mouse.Y - 1 / Var.Sense0)
Endif
If (Var.Z <= -Var.Thresh0Y)
  Mouse.Y = (Mouse.Y + 1 / Var.Sense0)
Endif

If (Var.X >= Var.ThreshX)
  Mouse.X = (Mouse.X - 1 / Var.Sense)
Endif
If (Var.X <= -Var.ThreshX)
  Mouse.X = (Mouse.X + 1 / Var.Sense)
Endif

If (Var.Z >= Var.ThreshY)
  Mouse.Y = (Mouse.Y - 1 / Var.Sense)
Endif
If (Var.Z <= -Var.ThreshY)
  Mouse.Y = (Mouse.Y + 1 / Var.Sense)
Endif

If (Var.X >= Var.Thresh2X)
  Mouse.X = (Mouse.X - 1 / Var.Sense2)
Endif
If (Var.X <= -Var.Thresh2X)
  Mouse.X = (Mouse.X + 1 / Var.Sense2)
Endif

If (Var.Z >= Var.Thresh2Y)
  Mouse.Y = (Mouse.Y - 1 / Var.Sense2)
Endif
If (Var.Z <= -Var.Thresh2Y)
  Mouse.Y = (Mouse.Y + 1 / Var.Sense2)
Endif

If (Var.X >= Var.Thresh3X)
  Mouse.X = (Mouse.X - 1 / Var.Sense3)
Endif
If (Var.X <= -Var.Thresh3X)
  Mouse.X = (Mouse.X + 1 / Var.Sense3)
Endif

If (Var.Z >= Var.Thresh3Y)
  Mouse.Y = (Mouse.Y - 1 / Var.Sense3)
Endif
If (Var.Z <= -Var.Thresh3Y)
  Mouse.Y = (Mouse.Y + 1 / Var.Sense3)
Endif
Endif

If (Var.M = 2) Then
 Var.WM = "Infa-Red"
 Var.xspeed = 1
 Var.yspeed = 1
 If ((Wiimote.dot1vis = True) And (Wiimote.dot2vis = True)) // check for visible dots
  Var.mx = ((Wiimote.dot1x + Wiimote.dot2x) / 2)  // medium dot X
  Var.my = ((Wiimote.dot1y + Wiimote.dot2y) / 2)  // medium dot Y
  Var.dx = ((Wiimote.dot2x - Wiimote.dot1x) / 2)  // distance of medium dot
  Var.dy = ((Wiimote.dot2y - Wiimote.dot1y) / 2)  // distance of medium dot
  Elseif ((Wiimote.dot1vis = True) And (Wiimote.dot2vis = False)) // screen border, only dot #1 visible
  Var.mx = (Wiimote.dot1x + Var.dx)
  Var.my = (Wiimote.dot1y + Var.dy)
  Elseif ((Wiimote.dot1vis = False) And (Wiimote.dot2vis = True)) // screen border, only dot #2 visible
  Var.mx = (Wiimote.dot2x - Var.dx)
  Var.my = (Wiimote.dot2y - Var.dy)
 Endif
 If ((Wiimote.dot1vis = True) Or (Wiimote.dot2vis = True)) // someone of the dot are visible
  Wiimote.Leds = 1
  mouse.x = MapRange(Var.mx, 1 / Var.xspeed * Var.W, Var.W - 1 / Var.xspeed * Var.W, 0, 1)
  mouse.y = MapRange(Var.my, 1 / Var.yspeed * Var.H, Var.H - 1 / Var.yspeed * Var.H, 1 , 0)
 Endif
Endif

// Variables
 Var.TimeS = .2 S
 Var.W = 1152
 Var.H = 864
 Var.Right = Wiimote.Nunchuk.JoyX >= .5
 Var.Left = Wiimote.Nunchuk.JoyX <= -.5
 Var.Up = Wiimote.Nunchuk.JoyY <= -.5
 Var.Down = Wiimote.Nunchuk.JoyY >= .5

// Other
 Smooth(Pie.FrameRate) = 100 Hz
 Debug =  '(Control Mode: ' + Var.C + ')  (Battery 1: ' + Smooth(Wiimote.Battery * .52833) + '%)  (Battery 2: ' + Smooth(Wiimote2.Battery * .52833) + '%)'
 Wiimote.LEDs = Var.Control

I'm working on this one. You can help too if you guys want. I'm thinking of more things I can add (such as the classic controller scripts); but I would have to give up the idea of LEDs aligning to the Control Mode because there are too many scripts.
_________________
If (Post = Read) Then
Dignity = False
Endif
Back to top
View user's profile Send private message Visit poster's website AIM Address
HaRiC



Joined: 30 Aug 2007
Posts: 1

Digg It
PostPosted: Thu Aug 30, 2007 11:39 am    Post subject: Ratatouille PC Game control with Wiimote+Nunchuk (no req.IR)

I created a script for Ratatouille PC Game.

Enjoy it! Wink

Code:

// Ratatouille juego PC controlado con Wiimote + Nunchuk (no req. sensor IR)
// Creado por HaRiC 30/08/2007 con ayuda de:
// "WindoWii Scripts Creator" + script zelda para movimiento horizontal del wiimote

// Ratatouille PC Game control with Wiimote + Nunchuk (no req.IR sensor)
// Created bY HaRiC 08/30/2007 with help of:
// "WindoWii Scripts Creator" + zelda script for horizontal movement of the wiimote

//teclas asociadas:
//
// A = saltar
// B = correr
// cruz abajo = salir
// cruz izquierda = cancelar
// home = pausa
// + = cámara arriba, (en los minijuegos) acción derecha
// - = (en los minijuegos) acción izquierda
// 1 = soltar
// 2 = Odorvisión
// Boton C del nunchuck = centrar cámara
// Boton Z del nunchuck = información de la misión
//
// movimiento joystick del nunchuck = movimiento del personaje
// rotación izquierda del nunchuck = giro de cámara a la izquierda
// rotación derecha del nunchuck = giro de cámara a la derecha
// movimiento horizontal del wiimote = acción

// keys associates:
//
// A = jump
// B = run
// cruz down = exit
// cruz left = cancel
// home = pause
// + = up camara, (in the minigames) right action
// - = (in the minigames) left action
// 1 = to loosen the object
// 2 = Odorvision
// Boton C of nunchuck = center camara
// Boton Z of nunchuck = information of mission
//
// move joystick of nunchuck = move personage
// left rotate of nunchuck = move camara to left
// right rotate of nunchuck = move camara to right
// horizontal movement of wiimote = action

key.SPACE = wiimote.A

key.H = wiimote.B


key.DELETE = wiimote.DOWN


key.BACKSPACE = wiimote.LEFT

key.ENTER = wiimote.HOME

key.I = wiimote.PLUS

key.U = wiimote.MINUS

key.T = wiimote.1

key.E = wiimote.2

key.O = wiimote.NUNCHUK.CBUTTON

key.TAB = wiimote.NUNCHUK.ZBUTTON

if -1 < Wiimote1.Nunchuk.JoyY < -0.5 then
W = true
wait 1 ms
W = false
endif

if 2 > Wiimote1.Nunchuk.JoyY > 0.5 then
S = true
wait 1 ms
S = false
endif

if -1 < Wiimote1.Nunchuk.JoyX < -0.5 then
A = true
wait 1 ms
A = false
endif

if 2 > Wiimote1.Nunchuk.JoyX > 0.5 then
D = true
wait 1 ms
D = false
endif


// giro a la izquierda o a la derecha del nunchuk = giro a la izquierda o la derecha de la cámara
// left or right rotate of nunchuk = left or right move of camara
key.J = Wiimote.Nunchuk.Roll > 45 degrees

key.L = Wiimote.Nunchuk.Roll < -45 degrees

// movimiento horizontal del wiimote = tecla de acción y vibración
// horizontal movement of wiimote = key action + vibration
//
G and wiimote.Rumble = (wiimote.RawForceX >= 25)
// movimiento vertical del wiimote = Tecla de salto + vibración
// (no es práctico. Desactivado)
// vertical movement of wiimote = key jump + vibration
// (It is not practical.Deactivated)
//SPACE = (wiimote.RawForceZ >= 10)

// Full battery outputs 100, Dead battery outputs 4
// Cuando se ejecuta el script muestra en GlovePIE el estado de la bateria del wiimote
var.1 = wiimote.Battery / 2 + 4
debug = var.1 and("%")
Back to top
View user's profile Send private message
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Tue Sep 11, 2007 12:12 pm    Post subject: new midi script for musicians

I don't know how many musicians use this forum for new scripts, but here's a performer's script i've laboured over for a couple of days - adapted from Rhys Legault's excellent UltimateFlickScript.
Purpose: left or right flicks trigger quasi-random midinotes from the Cmaj pentatonic scale, while Wiimote.Pitch angle dictates the register of the pitch collection (low pitch angle=low notes, high pitch angle = higher notes). Do feel free to comment/improve
Quote:

/*
C MAJOR PENTATONIC SCALE, TRIGGERED BY LEFT/RIGHT FLICKS
LOW WIIMOTE ANGLE (<-20degrees)= C3 D3 E3 G3
MID ANGLE (-15 to +35) = A3 C4 D4 E4
HIGH ANGLE (>+40)= G4 A4 C5 D5
adapted from Rhys Legault's UltimateFlickScript
*/
midi.DeviceOut=2 //select your own midiout
PIE.SeqReadGap=50ms//smooths the reading of the flick sequence
debug=Wiimote.Pitch
Wiimote.Pitch=EnsureMapRange(Wiimote.Pitch, -90,90,-90,90)

if not Wiimote.B//volume control
midi.Volume=5
elseif pressed(Wiimote.B)
wait 100ms
midi.Volume=0.3
endif

if (Wiimote.Pitch<-20) && (Wiimote.Pitch>-90)then //low angle midi notes
var.note=RandomRange(36,43)
if (var.note==37) or (var.note==39) or (var.note==42)//exceptions ensure pentatonic scale
var.note++
elseif (var.note==41) or (var.note==44)
var.note--
endif
endif

if (Wiimote.Pitch>-15) && (Wiimote.Pitch<35) then //mid angle midi notes
var.note=RandomRange(45,52)
if (var.note==51) or (var.note==47) or (var.note==49)
var.note++
elseif (var.note==46) or (var.note==53)
var.note--
endif
endif

if (Wiimote.Pitch>40) && (Wiimote.Pitch<90) then //high angle midi notes
var.note=RandomRange(55,62)
if (var.note==59) or (var.note==54) or (var.note==56)
var.note++
elseif (var.note==58) or (var.note==61)
var.note--
endif
endif

if (var.right=false) && (var.left=false) //flick triggers; thanks to Rhys Legault
if (Wiimote.gx >0.6, Wiimote.gx < -1.2)
var.right = true
midi.FirstNote=-1
midi.FirstNote=var.note
wait 50ms
var.right = false
elseif (Wiimote.gx <-0.6, Wiimote.gx >1.2)
var.right = true
midi.FirstNote=-1
midi.FirstNote=var.note
wait 50ms
var.right = false
endif
endif

Brendan McCloskey
Back to top
View user's profile Send private message
gamexprt1



Joined: 23 Apr 2007
Posts: 54
Location: Washington

Digg It
PostPosted: Wed Sep 12, 2007 9:50 pm    Post subject:

Anyone know if theres a script that can tell when I am pressing the 'stop' button (in GlovePIE)?
_________________
If (Post = Read) Then
Dignity = False
Endif
Back to top
View user's profile Send private message Visit poster's website AIM Address
jjcomet



Joined: 23 Apr 2007
Posts: 87

Digg It
PostPosted: Thu Sep 13, 2007 10:40 am    Post subject:

not quite sure what you mean by this; but the stop button in glovepie corresponds with the F9 key; for example
Quote:


key.F9=Wiimote.Home

if pressed (Wiimote.Home)
Wiimote.Leds=15
endif


will stop GlovePIE and light the leds when you press Home on the Wiimote.

Is this what you're after?
Brendan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie All times are GMT
Goto page Previous  1, 2, 3 ... 37, 38, 39 ... 53, 54, 55  Next
Page 38 of 55

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group