Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Resident Evil Movement Script //Barley Modded for Broken Age
- //To calibrate, use the nunchuk joystick to move the mouse cursor to each corner of the screen as indicated. Stop just at
- //the corner. Going further will decrease accuracy.
- //Then press the B button and continue calibrating the other corners as instructed.
- //Nunchuk no longer controls mouse after calibration.
- //"Enhanced pointer precision" should be turned off. Found in mouse settings control panel on winXP
- //Using the computer mouse will disrupt the calibration.
- //Press ALT on the keyboard to restart calibration.
- //Mouse Control Script using IR
- //by vkapadia with much assistance from inio
- //####### censored web address
- //
- //Calibration:
- //To calibrate, run this program and put the wiimote1 on a flat surface face-up.
- //Then read the values in the debug line (next to the run button).
- //Change these values until the debug line reads approx. all zeros.
- var.xtrim = 0
- var.ytrim = 0
- var.ztrim = 0
- //display ""
- var.accx = wiimote1.RawForceX + var.xtrim
- var.accy = wiimote1.RawForceY + var.ytrim
- var.accz = wiimote1.RawForceZ + var.ztrim
- //debug = var.accx + "," + var.accy + "," + var.accz
- if wiimote1.dot1vis and wiimote1.dot2vis then //if both led's are visible
- if var.accy > -7 then
- var.orientation = 0
- // display "held in normaly"
- elseif var.accy > -45 then
- if var.accx < 0 then
- var.orientation = 3
- // display "twisted right"
- else
- var.orientation = 1
- // display "twisted left"
- endif
- else
- var.orientation = 2
- //display "upside down"
- endif
- if var.leftpoint = 0 then
- if var.orientation = 0 then
- if wiimote1.dot1x < wiimote1.dot2x then
- var.leftpoint = 1
- // display "coming in to view from left, normal pos"
- else
- var.leftpoint = 2
- // display "coming in to view from right, normal pos"
- endif
- endif
- if var.orientation = 1 then
- if wiimote1.dot1y > wiimote1.dot2y then
- var.leftpoint = 1
- //display "coming in to view from left, twisted left"
- else
- var.leftpoint = 2
- //display "coming in to view from right, twisted left"
- endif
- endif
- if var.orientation = 2 then
- if wiimote1.dot1x > wiimote1.dot2x then
- var.leftpoint = 1
- // display "coming in to view from left, upside down"
- else
- var.leftpoint = 2
- //display "coming in to view from right, upside down"
- endif
- endif
- if var.orientation = 3 then
- if wiimote1.dot1y < wiimote1.dot2y then
- var.leftpoint = 1
- //display "coming in to view from left, twisted right"
- else
- var.leftpoint = 2
- // display "coming in to view from right, twisted right"
- endif
- endif
- endif
- if var.leftpoint = 1 then
- var.fix1x = wiimote1.dot1x
- var.fix1y = wiimote1.dot1y
- var.fix2x = wiimote1.dot2x
- var.fix2y = wiimote1.dot2y
- else
- var.fix1x = wiimote1.dot2x
- var.fix1y = wiimote1.dot2y
- var.fix2x = wiimote1.dot1x
- var.fix2y = wiimote1.dot1y
- endif
- var.dx = var.fix2x - var.fix1x
- var.dy = var.fix2y - var.fix1y
- var.cx = (var.fix1x+var.fix2x)/1024.0 - 1 //gets x distence from centre
- var.cy = (var.fix1y+var.fix2y)/1024.0 - .75 //gets y distence from centre of screen
- var.d = sqrt(var.dx*var.dx+var.dy*var.dy)
- var.dx = var.dx / var.d
- var.dy = var.dy / var.d
- var.ox = -var.dy*var.cy-var.dx*var.cx;
- var.oy = -var.dx*var.cy+var.dy*var.cx;
- var.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
- var.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)
- var.dx = var.ax - mouse.cursorposx
- var.dy = var.ay - mouse.cursorposy
- var.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))
- var.a = 180 / (200 + var.d * var.d * var.d * .001)
- var.a = sqrt(var.a)*sqrt(var.a)
- var.finalx = mouse.cursorposx * var.a + var.ax * (1 - var.a)
- var.finaly = mouse.cursorposy * var.a + var.ay * (1 - var.a)
- //mouse.cursorposx = var.finalx
- //mouse.cursorposy = var.finaly
- else
- var.leftpoint = 0
- endif
- //################################################ RES EVIL movement script by mucka@mucka.tk
- if (keyboard.Alt)
- var.poscalb = false
- var.topleftx = false
- var.toplefty = false
- var.toprightx = false
- var.toprighty = false
- var.bottomleftx = false
- var.bottomlefty = false
- var.bottomrightx = false
- var.bottomrighty = false
- endif
- if (var.poscalb == 0)
- mouse.directinputx = mouse.directinputx + wiimote.nunchuk.joyx*10
- mouse.directinputy = mouse.directinputy + wiimote.nunchuk.joyy*10
- endif
- var.time = ((timestamp - var.calbtime) > 2)
- var.posx = mouse.DirectInputx
- var.posy = mouse.directinputy
- if (var.poscalb == false)
- if (var.topleftx == false)
- display("Shoot top left")
- endif
- if (wiimote.b and var.topleftx == false)
- var.topleftx = mouse.DirectInputx
- var.toplefty = mouse.DirectInputy
- var.calbtime = timestamp
- display("Saved")
- wait 1s
- display("Shoot top right")
- elseif (wiimote.b and var.toprightx == false and ((timestamp - var.calbtime) > 2))
- var.toprightx = mouse.DirectInputx
- var.toprighty = mouse.DirectInputy
- var.calbtime = timestamp
- display("Saved")
- wait 1s
- display("Shoot bottom right")
- elseif (wiimote.b and var.bottomrightx == false and ((timestamp - var.calbtime) > 2))
- var.bottomrightx = mouse.DirectInputx
- var.bottomrighty = mouse.DirectInputy
- var.calbtime = timestamp
- display("Saved")
- wait 1s
- display("Shoot bottom left")
- elseif (wiimote.b and ((timestamp - var.calbtime) > 2))
- var.bottomleftx = mouse.DirectInputx
- var.bottomlefty = mouse.DirectInputy
- /*
- var.leftx = (var.topleftx + var.bottomleftx + var.toprightx + var.bottomrightx + (1536))/4
- var.topy = (var.toplefty + var.toprighty + var.bottomlefty + var.bottomrighty + (2048))/4
- */d
- //screen size in mickeys
- var.left = (var.topleftx + var.bottomleftx)/2
- var.right = (var.toprightx + var.bottomrightx)/2
- var.top = (var.toplefty + var.toprighty)/2
- var.bottom = (var.bottomlefty + var.bottomrighty)/2
- var.screenwidthmickeys = var.right - var.left
- var.screenheightmickeys = var.bottom - var.top
- var.mickeysperpixelx = removeunits(var.screenwidthmickeys) / removeunits(screen.width)
- var.mickeysperpixely = removeunits(var.screenheightmickeys) / removeunits(screen.height)
- var.poscalb = 1
- display("Saved")
- wait 1s
- display("")
- endif
- endif
- if (var.poscalb) and wiimote1.dot1vis and wiimote1.dot2vis
- var.directinputx = removeunits(var.left) + removeunits(var.finalx * var.mickeysperpixelx)
- var.directinputy = removeunits(var.top) + removeunits(var.finaly * var.mickeysperpixely)
- mouse.directinputpos = [var.directinputx, var.directinputy]
- endif
- //Broken Age INPUTS
- mouse.leftbutton = wiimote.A
- Key.Space = Wiimote.Minus
- Key.I = Wiimote.Plus
- Key.Escape = Wiimote.Home
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement