GRiiD
From WiiLi
//GRiiD [by marsuten @gmail.com]
* Play GRID with you wiimote, with this script
* you dont need to be near your keyboard. It uses
* the accelerate and brake buttons like analogs to
* make soft the driving, you can configure them
* with the Visual Test help. ENJOY!
//--Instructions (need PPJoy)
*| 1. In GlovePIE, go to CP-Settings > PPJoy .
*| 2. Click on Add, then select "Constoller 1".
*| 3. Select "PPJoy Virtual Joystick 1" and click Mapping .
*| 4. Choose "Set (-or modify) a custom mapping.." and click Next .
*| 5. Select 3 Axes, Axis 1: X Rotation ..(Drive)
*| Axis 2: X Axis ..(Accelerate)
*| Axis 3: Y Axis ..(Brake)
*| 6. Click Next .. to finish
*| 7. On GRID you need to configure the keys and analogs,
*| I recommend use this script mapping.
*| 8. When you have all configured write
*| True on var.configured to enable Menu and Relecture.
//--Variables
var.configured = false //Activate once you have configured the GRID keys
var.trimz = -9 //Use debug
var.accel = 0,7 s //Getting Max acceleration
var.accel0 = 0,7 s //Getting Min acceleration
var.brake = 0,6 s //Getting Max brake
var.brake0 = 0,4 s //Getting Min brake
wiimote.Leds = 1 //Leds
//--Mapping
*Actions
ppjoy.analog0 = MapRange(var.z,-27,27,-1, 1) //Drive
ppjoy.analog1 = -var.acc //Accelerate (Two
ppjoy.analog2 = -var.fre //Brake (A ,One)
key.space = Wiimote.B //Handbrake
* //Change gear
key.C = wiimote.Minus //Change camera
key.left = wiimote.Up //Look left
key.right = wiimote.Down //Look right
key.up = wiimote.Right //Look up
* //Look down
key.down = wiimote.Left //Look back
key.Escape = wiimote.home //Pause-Back
key.Escape = wiimote.b and wiimote.one //Pause-Back
key.R = wiimote.Plus //Relecture inst
if var.configured
*Relecture instance
key.f2=wiimote.Up //Change camera
key.f3=wiimote.Down //Change camera
key.f8=wiimote.left //Rewind
key.f7=wiimote.Right //Avance
key.f1=wiimote.a //Play/Pause
key.F12=wiimote.two //Restart
*Menu : Enter, Escape(home), control and shift
key.enter = wiimote.two
key.LeftShift = wiimote.plus
key.LeftControl = wiimote.minus
endif
//--Analogs buttons miniscript
if wiimote.two then var.acc=var.acc+((1/var.accel)/removeunits(pie.realframerate)) else var.acc=var.acc-((1/var.accel0)/removeunits(pie.realframerate))
if var.acc>1 then var.acc=1 elseif var.acc<0 then var.acc=0
if wiimote.A or wiimote.one then var.bra=var.bra+((1/var.brake)/removeunits(pie.realframerate)) else var.bra=var.bra-((1/var.brake0)/removeunits(pie.realframerate))
if var.bra>1 then var.bra=1 elseif var.bra<0 then var.bra=0
//--Debug
var.z = Wiimote.RawForceZ - var.trimz
debug = "[wiimote face up: var.trimz= " + wiimote1.RawForceZ+" ]"
//--VISUAL TEST [delete /* to activate it]
/*
var.acc3d=(maprange(var.acc, 0 , 1 , 5 , 100))
obj1.y = -50+(var.acc3d/2) cm
obj1.x = -90 cm
obj1.size = [20, var.acc3d , 0] cm
obj1.colour = 0x001ab5
var.bra3d=(maprange(var.bra, 0 , 1 , 5 , 100))
obj2.y = -50+(var.bra3d/2) cm
obj2.x = 90 cm
obj2.size = [20, var.bra3d , 0] cm
obj2.colour = 0xb50000
var.tur3d=(maprange(ppjoy.analog0, -1 , 1 , -90 , 90))
obj3.y = 0 cm
obj3.x = 0 cm
obj3.size = [90, 70 , 0] cm
obj3.roll=smooth(var.tur3d,4)
obj3.colour = 0x91b500
*/

