 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
Thien
Joined: 26 Dec 2006 Posts: 2
Digg It |
Posted: Tue Dec 26, 2006 10:23 pm Post subject: |
|
|
I'm looking for a script that can turn down the computer (windows) off with 1 button.. the power button
Would that be possible? |
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Tue Dec 26, 2006 10:33 pm Post subject: |
|
|
| From my understanding the power button on the wiimote isn't mappable. |
|
| Back to top |
|
 |
Marco Ceppi

Joined: 21 Dec 2006 Posts: 51
Digg It |
Posted: Wed Dec 27, 2006 1:50 am Post subject: |
|
|
Hey TylerK, thanks for the script. I've built a script for HL2 and the pointing system I made is realllyyy sensative. Mind if I give your's a try in my script?
Thanks |
|
| Back to top |
|
 |
Arianol
Joined: 26 Dec 2006 Posts: 49
Digg It |
Posted: Wed Dec 27, 2006 7:54 am Post subject: |
|
|
An edit to the old script... This one has a MUCH better look mechanism. I've only tried it in vcod and cod2, but its looking very promising--a great alternative to the tilting crap.
Marco Ceppi, If you are looking for an aiming system, I would recommend giving this one a whirl. If you do, lemme know how it works out!
| Code: | /* Code for playing Call of Duty PC with the Wii-Remote and Nunchuck
Control Arrangement done by Arianol */
/* This PIE requires that you have one IR point to aim the Wiimote at. A lit
teacandle sitting in a small glass works nicely and reduces fire hazard. At
any time you can point the Wiimote away from the dot and Press 1 to revert
back to natural mouse movement. */
/* When configuring xNunchuk please hold the nunchuk flat in your hand and do
not move it. You want to look at the debug output at the top of this
window, and modify the value of xNunchuk until the debug value equals 10.
The debug value will be very jumpy so just get as close as you can. */
var.xNunchuk = 7
/* Aim the Wiimote directly at your IR point and watch the debug. SpeedX and
SpeedY should both equal zero (or close to it). If not, adjust xOffset and
yOffset until they do. */
var.xOffset = 0
var.yOffset = 0
var.speed = 1 // Look Speed (Default 1)
var.zoom = 1/2 // Speed When Aiming Down Sight (Default 1/2)
// Remote Controls
alt = Wiimote.Up // Change Rate-Of Fire
shift = Wiimote.Down // Melee
mouse.WheelUp = Wiimote.Left // Last Weapon
mouse.WheelDown = Wiimote.Right // Next Weapon
mouse.LeftButton = Wiimote.B // Primary Fire
mouse.RightButton = Wiimote.A /* Secondary Fire -> Change RightMouseButton
to Aim Down Sight instead of Toggle For
a more CoD3-like experience */
f = Wiimote.Minus // Use
r = Wiimote.Minus // Reload
Tab = Wiimote.Home // View Score
Escape = Wiimote.Plus // Menu
Windows + M = Wiimote.Two // Windows Key + M - Minimize
If Pressed(Shift) Then // Rumbles wiimote when shift is pressed
Wiimote.Rumble = True
wait 100 ms
Wiimote.Rumble = False
EndIf
// Nunchuck Controls
C = Wiimote.Nunchuk.ZButton // Crouch
If C = True Then
wait 400 ms
If C = True Then
Press Control //Prone
Release Control
EndIf
EndIf
Space = Wiimote.Nunchuk.CButton // Jump
q = Wiimote.Nunchuk.RawForceX + var.xNunchuk > 45 // Lean Left
e = Wiimote.Nunchuk.RawForceX + var.xNunchuk < -25 // Lean Right
// Control Stick Movement
w = Wiimote.Nunchuk.JoyY < -0.4
a = Wiimote.Nunchuk.JoyX < -0.4
s = Wiimote.Nunchuk.JoyY > 0.4
d = Wiimote.Nunchuk.JoyX > 0.4
// LED Lights
Wiimote.Led4 = four
Wiimote.Led3 = three
Wiimote.Led2 = two
Wiimote.Led1 = one
/* Code for Pointing Mechanism
---------------------------
Do Not Modify */
var.smooth = 80 // Master Sensitivity (Default 80) - Change Not Recommended
If wiimote.dot1vis Then // If dot is visible
// Locate Infared Point
var.actualX = (1-(round(Wiimote.dot1x) / 1024)) * Screen.Width
var.actualY = ((round(Wiimote.dot1y) / 768)) * Screen.Height
// Determine Aim Coordinates
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 Speed Multipliers
If abs(var.speedX / 20) > 1 Then var.multX = 1 Else var.multX = abs(var.speedX / 20)
If abs(var.speedY / 20) > 1 Then var.multY = 1 Else var.multY = abs(var.speedY / 20)
// Look Speed When 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 Mouse
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
// Reload (If Minus Fails)
r = Wiimote.One
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
// Revert back to natural mouse movement - Safeguard
If Pressed(Wiimote.One) Then
var.lastX = 0
var.lasty = 0
EndIf
EndIf
// Debug
debug = 'Debug: X: ' + (Wiimote.Nunchuk.RawForceX + var.xNunchuk) + ' SpeedY: ' + var.speedY + ' SpeedX: ' + var.speedX |
Hope ya like!
Last edited by Arianol on Wed Dec 27, 2006 6:42 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sousuke
Joined: 27 Dec 2006 Posts: 4
Digg It |
Posted: Wed Dec 27, 2006 1:53 pm Post subject: |
|
|
This is a script for Trackmania (Nations). I tried to make it rotation-sensitive e.g. if you rotate the WiiMote only a little bit your vehicle should steer a little bit, too. Maybe you can do this easier than I did it but I am satisfied with my solution.
UPDATE:
| Code: | /*Trackmania (Nations) WiiMote Script by Sousuke/Brot
Download Trackmania Nations for free: trackmanianations dot com
Hold your WiiMote sideways so that the expansion port is right.*/
debug = 'Z=' + Wiimote.gz + 'g'
var.led = 0 //1 = Leds on ; 0 = Leds off
var.BaseOn = 30
var.AddOn = 4
var.BaseOff = 20
var.AddOff = 0
var.zBase = 0.20
var.zAdd = 0.04
/*Controls:
A = Enter
1 = Down
2 = Up
Home = Escape
Up = View 1
Right = View 2
Down = Cockpitview
*/
Keyboard.Enter = Wiimote.A
Keyboard.Down = Wiimote.One
Keyboard.Up = Wiimote.Two
Keyboard.Escape = Wiimote.Home
Keyboard.NUMPAD1 = Wiimote.Up
Keyboard.NUMPAD2 = Wiimote.Right
Keyboard.NUMPAD3 = Wiimote.Down
//Controls for steering to the right
if Wiimote.gZ >= var.zBase and < (var.zBase + var.zAdd)
Keyboard.Right = 1
wait (var.baseon ms)
Keyboard.Right = 0
wait (var.baseoff ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd) and < (var.zBase + var.zAdd * 2)
Keyboard.Right = 1
wait (var.baseon + var.addon ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 2) and < (var.zBase + var.zAdd * 3)
Keyboard.Right = 1
wait (var.baseon + var.addon * 2 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 2 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 3) and < (var.zBase + var.zAdd * 4)
Keyboard.Right = 1
wait (var.baseon + var.addon * 3 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 3 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 4) and < (var.zBase + var.zAdd * 5)
Keyboard.Right = 1
wait (var.baseon + var.addon * 4 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 4 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 5) and < (var.zBase + var.zAdd * 6)
Keyboard.Right = 1
wait (var.baseon + var.addon * 5 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 5 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 6) and < (var.zBase + var.zAdd * 7)
Keyboard.Right = 1
wait (var.baseon + var.addon * 6 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 6 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 7) and < (var.zBase + var.zAdd * 8)
Keyboard.Right = 1
wait (var.baseon + var.addon * 7 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 7 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 8) and < (var.zBase + var.zAdd * 9)
Keyboard.Right = 1
wait (var.baseon + var.addon * 8 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 8 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 9) and < (var.zBase + var.zAdd * 10)
Keyboard.Right = 1
wait (var.baseon + var.addon * 9 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 9 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 10) and < (var.zBase + var.zAdd * 11)
Keyboard.Right = 1
wait (var.baseon + var.addon * 10 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 10 ms)
endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 11)
Keyboard.Right = 1
endif
////End of the Controls for steering to the right
//Controls for steering to the left
if Wiimote.gZ <= -(var.zBase) and > -(var.zBase + var.zAdd)
Keyboard.Left = 1
wait (var.baseon ms)
Keyboard.Left = 0
wait (var.baseoff ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd) and > -(var.zBase + var.zAdd * 2)
Keyboard.Left = 1
wait (var.baseon + var.addon ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 2) and > -(var.zBase + var.zAdd * 3)
Keyboard.Left = 1
wait (var.baseon + var.addon * 2 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 2 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 3) and > -(var.zBase + var.zAdd * 4)
Keyboard.Left = 1
wait (var.baseon + var.addon * 3 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 3 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 4) and > -(var.zBase + var.zAdd * 5)
Keyboard.Left = 1
wait (var.baseon + var.addon * 4 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 4 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 5) and > -(var.zBase + var.zAdd * 6)
Keyboard.Left = 1
wait (var.baseon + var.addon * 5 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 5 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 6) and > -(var.zBase + var.zAdd * 7)
Keyboard.Left = 1
wait (var.baseon + var.addon * 6 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 6 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 7) and > -(var.zBase + var.zAdd * 8)
Keyboard.Left = 1
wait (var.baseon + var.addon * 7 ms)
Keyboard.Left = 0
wait 20ms
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 8) and > -(var.zBase + var.zAdd * 9)
Keyboard.Left = 1
wait (var.baseon + var.addon * 8 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 8 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 9) and > -(var.zBase + var.zAdd * 10)
Keyboard.Left = 1
wait (var.baseon + var.addon * 9 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 9 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 10) and > -(var.zBase + var.zAdd * 11)
Keyboard.Left = 1
wait (var.baseon + var.addon * 10 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 10 ms)
endif
if Wiimote.gZ <= -(var.zBase + var.zAdd * 11)
Keyboard.Left = 1
endif
////End of the Controls for steering to the left
//Controls for idling and leds
if Wiimote.gZ > -(var.zBase) and < var.zBase
Keyboard.Left = 0
Keyboard.Right = 0
if var.led = 1
Wiimote.Leds = 6
endif
endif
if var.led = 1 and (Wiimote.gz > 0.20 and < 0.50)
Wiimote.Leds = 3
endif
if var.led = 1 and Wiimote.gz >= 0.50
Wiimote.Leds = 1
endif
if var.led = 1 and (Wiimote.gz < -0.20 and > -0.50)
Wiimote.Leds = 12
endif
if var.led = 1 and Wiimote.gz <= -0.50
Wiimote.Leds = 8
endif |
Last edited by Sousuke on Thu Dec 28, 2006 9:01 am; edited 4 times in total |
|
| Back to top |
|
 |
Marco Ceppi

Joined: 21 Dec 2006 Posts: 51
Digg It |
Posted: Wed Dec 27, 2006 3:33 pm Post subject: |
|
|
Arianol:
Thanks your script works a lot better. However. I noticed it only uses one dotvis. I've set my sensor bar up with two. So when I use the script I have to point to right side of the screen for it to center. Otherwise when I hold it in the center of my screen, it races to the left. However I do like how much smoother it is.
I was using the Mouse IR Relative script in my HL2 script. Which I noticed used both dotvis. Is there a way to adapt your script to use both? I would try myself but I know next to nothing about how the calculations for the mouse postition should work.
Marco |
|
| Back to top |
|
 |
Arianol
Joined: 26 Dec 2006 Posts: 49
Digg It |
Posted: Wed Dec 27, 2006 6:53 pm Post subject: |
|
|
Hmm... I'm just using a candle in the center below my monitor, did have a box of Nerds on the end of my sensor bar before doing that though I guess... it should be possible, but that would uproot the whole first and second steps in the calculations--the two that I still don't fully understand. Whenever I used a script that had two IR points it always became too sensitive, so that's why I settled on this one.
I'll see what I can do, though, and get back to you. |
|
| Back to top |
|
 |
|
|
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
|