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 

Empire at War Nunchuk Script

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
bdr9



Joined: 04 Aug 2008
Posts: 1

Digg It
PostPosted: Mon Aug 04, 2008 3:30 pm    Post subject: Empire at War Nunchuk Script

Code:
//      /-----------------------\
//      |     STAR    WARS      |
//      |                       |
//      |    EMPIRE AT WAR      |
//      |                       |
//      |      GLOVEPIE         |
//      \-----------------------/
//
//      This is a control script for Star Wars:
//      Empire at War by bdr9. This script will
//      not operate without the Nunchuk attached
//      to the Wii Remote.
//
//      Controls:
//
//      Nunchuk joystick to move the mouse
//      A to left click
//      B to right click
//      D-pad directions to pan the map
//      Home for cinematic view
//      + and - to zoom in and out
//      1 to quicksave
//      2 to quickload


var.speed = 60
//Change to higher for higher nunchuk mouse sensetivity.


var.dbg = "Initialized"
if Wiimote.HasNunchuk = false then
var.dbg = "Please attach Nunchuk"
end if
debug = var.dbg

var.jx = Wiimote.Nunchuk.JoyX
var.jy = Wiimote.Nunchuk.JoyY
// set joystick to vars for easier access later
var.jjx = Wiimote.Nunchuk.JoyX
var.jjy = Wiimote.Nunchuk.JoyY



if var.jjx < 0 then
var.jjx = 0-var.jjx
end if

if var.jjy < 0 then
var.jjy = 0-var.jjy
end if
// jjx and jjy will never be less than 0

if Wiimote.HasNunchuk = true then // Only operate when nunchuk is attached

// Move mouse
if var.jx > 0.05 then
Mouse.x = Mouse.x + (var.jjx / (100-var.speed))
end if

if var.jx < -0.05 then
Mouse.x = Mouse.x - (var.jjx / (100-var.speed))
end if

if var.jy > 0.05 then
Mouse.y = Mouse.y + (var.jjy / (100-var.speed))
end if

if var.jy < -0.05 then
Mouse.y = Mouse.y - (var.jjy / (100-var.speed))
end if

//buttons
Mouse.LeftButton =  Wiimote.A
Mouse.RightButton = Wiimote.B
Left = Wiimote.Left
Right = Wiimote.Right
Down = Wiimote.Down
Up = Wiimote.Up
Space = Wiimote.Home
Mouse.WheelUp = Wiimote.Plus
Mouse.WheelDown = Wiimote.Minus
F6 = Wiimote.One
F5 = Wiimote.Two








end if


//For led movement and rumble when nunchuck is attached
if Wiimote.HasNunchuk = false then
wait 150ms
if Wiimote.HasNunchuk = true then
wait 300ms
Wiimote.Rumble = true

Wiimote.led1 = 1
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 1
Wiimote.led3 = 0
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 1
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 1

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 0

Wiimote.Rumble = false
end if
end if


//For led movement and rumble when nunchuck is disconnected
if Wiimote.HasNunchuk = true then
wait 150ms
if Wiimote.HasNunchuk = false then
wait 300ms
Wiimote.Rumble = true

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 1

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 1
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 1
Wiimote.led3 = 0
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 1
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 0

wait 100ms

Wiimote.led1 = 0
Wiimote.led2 = 0
Wiimote.led3 = 0
Wiimote.led4 = 0

Wiimote.Rumble = false
end if
end if

//debug = "x=" + var.jx + "  y=" + var.jy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts All times are GMT
Page 1 of 1

 
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