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 

Halo script using IR aiming and nunchuch movement

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck
View previous topic :: View next topic  
Author Message
elmerohueso



Joined: 05 Mar 2007
Posts: 8

Digg It
PostPosted: Tue Mar 06, 2007 6:09 pm    Post subject: Halo script using IR aiming and nunchuch movement

This is my new 'almost perfect' script for Halo. I borrowed some code from other scripts, but I tried to give credit in the comments.

Code:
/*Halo: Combat Evolved for GlovePIE and PPjoy compiled by B.Bone
With script inserts written/inspired by J.Coulston, US of Anarchy,
Rmanqueros, and Hezzech
Use the default controls in Halo.
Movement controls are mapped to the joystick either as emulated
WASD keys or as analog axis for more precision (requires a PPjoy
virtual joystick with 2 axis with Analog0 as the X axis and Analog1
as the Y axis))
Button controls are as follows:
A = Throw Grenade
B = Fire Weapon
Switch Grenade = Left or Right
Switch Weapon = Down
Reload = +
Melee Attach = 2
Exchange Weapon = -
Jump = C
Crouch = Z
Flashlight = 1
Scope Zoom = Up
Action = Home
*/

// Movement configuration

// Uncomment the following 2 lines to map the analog stick to PPjoy
PPJoy1.Analog0 = MapRange(Wiimote.Nunchuk.JoyX, -1,1, -1,1)
PPJoy1.Analog1 = MapRange(Wiimote.Nunchuk.JoyY, -1,1, -1,1)

// Uncomment the following 4 lines to make the analog stick emulate WASD
//A = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
//D = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
//W = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
//S = (0.5 < wiimote.Nunchuk.JoyY < 1.2)

// Button Configuration
Space = Wiimote.Nunchuk.CButton
LeftControl = Wiimote.Nunchuk.ZButton
Z = Wiimote.Up
Tab = Wiimote.Down
G = Wiimote.Left
G = Wiimote.Right
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
// Wiimote rumbles when you shoot
Wiimote.Rumble = Wiimote.B
R = Wiimote.Plus
X = Wiimote.Minus
E = Wiimote.Home
Q = Wiimote.One
F = Wiimote.Two

if wiimote.dot2vis then
 // Your cursor turns you character about 365 degrees laterally
 var.posX=round((screen.Width*(1024-(wiimote.dot2x/1024/1.5))))
 var.posY=round(screen.Height*(wiimote.dot2y/768/2))
 var.MouseDxPosX=mouse.DirectInputX
 var.MouseDxPosY=mouse.DirectInputY
 var.incX=(var.posX-var.MouseDxPosX)
 var.incY=(var.posY-var.MouseDxPosY)
 Mouse.DirectInputX=mouse.DirectInputX+var.incX+var.xoff
 Mouse.DirectInputY=mouse.DirectInputY+var.incY
 var.xoff=0
else
 // Once your cursor goes out of view, you will continue rotating
 var.xoff=mouse.DirectInputX+var.incX
 Mouse.DirectInputX=var.xoff
endif

//Wiimote Battery Display
//by J.Coulston
//Modified by Carl Kenner for GlovePIE 0.25

//A full battery gives 0xC0 (192)
var.Batt = wiimote.Battery / 48

if true then
wait 5 seconds
//it sends an instruction that tells the Wiimote to actually
//send the report.
Wiimote.Report15 = 0x80
end if

//Display the battery level of your wiimote using the four LEDs on the bottom.
//Battery level is displayed in four levels increasing to the right, like a cell
//phone battery gauge. As the battery gets close to the next level down, the LED
//for the current level will blink.

//Blink rate
var.Blink = 500ms

debug = "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
Back to top
View user's profile Send private message
rmanqueros



Joined: 02 Feb 2007
Posts: 9

Digg It
PostPosted: Tue Mar 13, 2007 10:59 pm    Post subject:

nice to see someone using my code Razz
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck 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