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 

First try- Halo Script

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



Joined: 20 Jan 2007
Posts: 11
Location: OHIO

Digg It
PostPosted: Sat Feb 10, 2007 11:50 pm    Post subject: First try- Halo Script

Here's my first try at a script, I wanted a Halo script without using IR
Let me know what you think:

Code:

//so you know which wiimote you have if there are multiple connected
wiimote1.Led1 = true
wiimote2.Led2 = true
wiimote3.Led3 = true
wiimote4.Led4 = true
//use nunchuk joystick for movement keys: WASD
if wiimote.Nunchuk.JoyY > 0.5
   keyboard.S = wiimote.Nunchuk.JoyY
   keyboard.W = 0
   var.s = wiimote.Nunchuk.JoyY
   var.w = 0
else
   keyboard.W = wiimote.Nunchuk.JoyY
   keyboard.S = 0
   var.w = wiimote.Nunchuk.JoyY
   var.s = 0
end if

if wiimote.Nunchuk.JoyX>0.5
   keyboard.D = wiimote.Nunchuk.JoyX
   keyboard.A = 0
   var.d = wiimote.Nunchuk.JoyX
   var.a = 0
else
   keyboard.A = wiimote.Nunchuk.JoyX
   keyboard.D = 0
   var.a = wiimote.Nunchuk.JoyX
   var.d = 0
end if

//use wiimote x,z rotations for camera control, y rotation is unused
var.xOffset = 4
var.yOffset = 0    //unused
var.zOffset = 4
// Change this if you would like your mouse to go faster
var.xspeed = 1100
var.yspeed = 0     //unused
var.zspeed = 1100
// change these to a higher number if your hands are not steady or lower if they are
var.xCutoff = 1
var.yCutoff = 0    //unused
var.zCutoff = 1
//set rotations
var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset
//debug rotation values
debug = 'X:' + var.xRot + ', ' + 'mDIX:' + mouse.DirectInputX + ', ' + 'Z:' + var.zRot + ', ' + 'mDIY:' + mouse.DirectInputY
// This is the code that moves your mouse
if var.xRot > var.xCutoff then mouse.DirectInputX = mouse.DirectInputX - .001 * var.xspeed * (var.xRot - var.xCutoff)
if var.xRot < -var.xCutoff then mouse.DirectInputX = mouse.DirectInputX - .001 * var.xspeed * (var.xRot + var.xCutoff)
if var.zRot > var.zCutoff then mouse.DirectInputY = mouse.DirectInputY - .001 * var.zspeed * (var.zRot - var.zCutoff)
if var.zRot < -var.zCutoff then mouse.DirectInputY = mouse.DirectInputY - .001 * var.zspeed * (var.zRot + var.zCutoff)

//other commands
mouse.LeftButton = wiimote.B                     //fire weapon
mouse.RightButton = wiimote.A                    //throw grenade

keyboard.Tab = wiimote.Up                        //switch weapon
keyboard.R = wiimote.Down                        //reload
keyboard.X = wiimote.Left                        //exchange weapon
keyboard.F = wiimote.Right                       //melee attack


keyboard.Q = wiimote.Minus                       //flashlight
keyboard.Z = wiimote.Plus                        //zoom scope

keyboard.E = wiimote.One                         //action
keyboard.G = wiimote.Two                         //switch grenade

keyboard.LeftAlt = wiimote.Nunchuk.ZButton       //crouch
keyboard.Space = wiimote.Nunchuk.CButton         //jump

var.bat = wiimote.Battery



and a button map:
Back to top
View user's profile Send private message
kunalkunal2



Joined: 13 Dec 2006
Posts: 279

Digg It
PostPosted: Sun Feb 11, 2007 1:50 pm    Post subject:

It alright for it's first try. But you cannot center it, if so then the mouse will keep dragging to the right. This is only possible when you use your right hand
to the far right, and when you tilt the wii remote to get the correct aim. If you can center it, so even the left'y s can enjoy this script this would be a good script.

EDIT:
You should do it like this
EDIT2: Changed it, better Compatibility


Code:
//Halo Mouse Non IR by sebo_theos
//Camrea Control Modified by Kunal
//so you know which wiimote you have if there are multiple connected
wiimote1.Led1 = true
wiimote2.Led2 = true
wiimote3.Led3 = true
wiimote4.Led4 = true
//use nunchuk joystick for movement keys: WASD
if wiimote.Nunchuk.JoyY > 0.5
   keyboard.S = wiimote.Nunchuk.JoyY
   keyboard.W = 0
   var.s = wiimote.Nunchuk.JoyY
   var.w = 0
else
   keyboard.W = wiimote.Nunchuk.JoyY
   keyboard.S = 0
   var.w = wiimote.Nunchuk.JoyY
   var.s = 0
end if

if wiimote.Nunchuk.JoyX>0.5
   keyboard.D = wiimote.Nunchuk.JoyX
   keyboard.A = 0
   var.d = wiimote.Nunchuk.JoyX
   var.a = 0
else
   keyboard.A = wiimote.Nunchuk.JoyX
   keyboard.D = 0
   var.a = wiimote.Nunchuk.JoyX
   var.d = 0
end if



//other commands
mouse.LeftButton = wiimote.B                     //fire weapon
mouse.RightButton = wiimote.A                    //throw grenade

keyboard.Tab = wiimote.Up                        //switch weapon
keyboard.R = wiimote.Down                        //reload
keyboard.X = wiimote.Left                        //exchange weapon
keyboard.F = wiimote.Right                       //melee attack


keyboard.Q = wiimote.Minus                       //flashlight
keyboard.Z = wiimote.Plus                        //zoom scope

keyboard.E = wiimote.One                         //action
keyboard.G = wiimote.Two                         //switch grenade

keyboard.LeftAlt = wiimote.Nunchuk.ZButton       //crouch
keyboard.Space = wiimote.Nunchuk.CButton         //jump

var.bat = wiimote.Battery

//use wiimote x,z rotations for camera control, y rotation is unused
var.xOffset = 11
var.yOffset = 0    //unused
var.zOffset = 11
// Change this if you would like your mouse to go faster
var.xspeed = 1100
var.yspeed = 0     //unused
var.zspeed = 1100
// change these to a higher number if your hands are not steady or lower if they are
var.xCutoff = 1
var.yCutoff = 0    //unused
var.zCutoff = 1
//set rotations
var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset
//debug rotation values
debug = 'X:' + var.xRot + ', ' + 'mDIX:' + mouse.DirectInputX + ', ' + 'Z:' + var.zRot + ', ' + 'mDIY:' + mouse.DirectInputY
// This is the code that moves your mouse
if var.xRot > var.xCutoff then mouse.DirectInputX = mouse.DirectInputX - .001 * var.xspeed * (var.xRot - var.xCutoff)
if var.xRot < -var.xCutoff then mouse.DirectInputX = mouse.DirectInputX - .001 * var.xspeed * (var.xRot + var.xCutoff)
if var.zRot > var.zCutoff then mouse.DirectInputY = mouse.DirectInputY - .001 * var.zspeed * (var.zRot - var.zCutoff)
if var.zRot < -var.zCutoff then mouse.DirectInputY = mouse.DirectInputY - .001 * var.zspeed * (var.zRot + var.zCutoff)

_________________
Check out my collection of my wii script's
freewebs.com/kunalkunal2
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