Author Topic: Need basic mouse and wasd script  (Read 10817 times)

Offline communistpenguin

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
on: May 22, 2013, 07:41:37 PM
Hello all, im a bit new to this, and also pretty bad at scripting.  Im trying to use my wiimotion plus wiimote and nunchuck combo to play games that use the traditional wasd mouse setup. Ideally I would use the nunchucks analog stuck to do the wasd part and the a for left click, b right click, z for jump(spacebar), c for tab, the + button for M and - for ctl.  I found a bunch of scripts online, but I couldnt get any to really work how I wanted them too. Is there a template script where i can just fill in what keys i want to do what function? 

Oh yeah, im running glovepie  0.43 in windows 7



Offline communistpenguin

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Reply #1 on: June 29, 2013, 12:07:20 PM
So I had my brother in law help me out a bit, and we took some other peoples scripts and combined/modified them and ended up with something that mostly works. However, one issue i run into is when I hold down the "riht mouse button" equivalent, it causes the screen to spin around in wow. Typically  you hold the right mouse button down to help adjust where you lookand navigate. So its kinda needed... also when I tried to play civilization 5  with this it just made the screen keep scrolling to the left.... anyway, here is the scrip, if anyone can help out i wold really appreciate it.

// Wiimote mouse script for Windows desktop
// Requires a sensor bar

var.ButtonFreezeTime = 250ms
var.PointerBump = KeepDown(Pressed(wiimote.A),var.ButtonFreezeTime) or KeepDown(Pressed(wiimote.B),var.ButtonFreezeTime)
Wiimote.Led1 = true

// Mouse movement
if wiimote.PointerVisible but not var.PointerBump then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

// Mouse Buttons
mouse.LeftButton = Wiimote.A //and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.RightButton = Wiimote.B //and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.MiddleButton = Wiimote.Home and KeepDown(Wiimote.PointerVisible,0.5s)
keyboard.Space =  Wiimote.Nunchuk.Z
keyboard.Ctrl =  Wiimote.Minus
keyboard.Shift =  Wiimote.Plus
keyboard.Tab = Wiimote.Nunchuk.CButton
keyboard.M = Wiimote.One
keyboard.Enter = Wiimote.Two

Right = 1 > Wiimote1.Nunchuk.JoyX > 0.5
Left = -1 < Wiimote1.Nunchuk.JoyX < -0.5
down = 1 > Wiimote1.Nunchuk.JoyY > 0.5
up = -1 < Wiimote1.Nunchuk.JoyY < -0.5

// Mouse Wheel
if wiimote.Up then
  mouse.WheelUp = true
  wait 30ms
  mouse.WheelUp = false
  wait 30ms
end if
if wiimote.Down then
  mouse.WheelDown = true
  wait 30ms
  mouse.WheelDown = false
  wait 30ms
end if