Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //J0nas1's Scratch Wiimote connection script:
- if clicked(space)
- if var.var
- var.var = false
- else
- var.var = true
- key.AnyKey = false
- endif
- endif
- if not var.var
- debug = "No remote connected"
- else
- if wiimote1.Exists
- var.Batt = wiimote.Battery / 48
- debug = "Battery: " + 100*48*var.Batt/192 + "% (Script is stopped)"
- else
- debug = "Script is stopped"
- endif
- endif
- if wiimote1.Exists and not var.var
- var.Batt = wiimote.Battery / 48
- debug = "Battery: " + 100*48*var.Batt/192 + "%"
- //gx
- if wiimote1.gx < 0
- one = true
- else
- one = false
- endif
- if (wiimote1.gx > 0.55) or (wiimote1.gx < -0.55)
- two = true
- else
- two = false
- endif
- if (wiimote1.gx < -0.04 and wiimote1.gx > -0.15) or (wiimote1.gx > 0.04 and wiimote1.gx < 0.15) or (wiimote1.gx < -0.54 and wiimote1.gx > -0.65) or (wiimote1.gx > 0.54 and wiimote1.gx < 0.65)
- three = true
- else
- three = false
- endif
- if (wiimote1.gx < -0.14 and wiimote1.gx > -0.25) or (wiimote1.gx > 0.14 and wiimote1.gx < 0.25) or (wiimote1.gx < -0.64 and wiimote1.gx > -0.75) or (wiimote1.gx > 0.64 and wiimote1.gx < 0.75)
- four = true
- else
- four = false
- endif
- if (wiimote1.gx < -0.24 and wiimote1.gx > -0.35) or (wiimote1.gx > 0.24 and wiimote1.gx < 0.35) or (wiimote1.gx < -0.74 and wiimote1.gx > -0.85) or (wiimote1.gx > 0.74 and wiimote1.gx < 0.85)
- five = true
- else
- five = false
- endif
- if (wiimote1.gx < -0.34 and wiimote1.gx > -0.45) or (wiimote1.gx > 0.34 and wiimote1.gx < 0.45) or (wiimote1.gx < -0.84 and wiimote1.gx > -0.95) or (wiimote1.gx > 0.84 and wiimote1.gx < 0.95)
- six = true
- else
- six = false
- endif
- if (wiimote1.gx < -0.44 and wiimote1.gx > -0.55) or (wiimote1.gx > 0.44 and wiimote1.gx < 0.55) or (wiimote1.gx < -0.94) or (wiimote1.gx > 0.94)
- seven = true
- else
- seven = false
- endif
- //gy
- if wiimote1.gy < 0
- eight = true
- else
- eight = false
- endif
- if (wiimote1.gy > 0.55) or (wiimote1.gy < -0.55)
- nine = true
- else
- nine = false
- endif
- if (wiimote1.gy < -0.04 and wiimote1.gy > -0.15) or (wiimote1.gy > 0.04 and wiimote1.gy < 0.15) or (wiimote1.gy < -0.54 and wiimote1.gy > -0.65) or (wiimote1.gy > 0.54 and wiimote1.gy < 0.65)
- zero = true
- else
- zero = false
- endif
- if (wiimote1.gy < -0.14 and wiimote1.gy > -0.25) or (wiimote1.gy > 0.14 and wiimote1.gy < 0.25) or (wiimote1.gy < -0.64 and wiimote1.gy > -0.75) or (wiimote1.gy > 0.64 and wiimote1.gy < 0.75)
- q = true
- else
- q = false
- endif
- if (wiimote1.gy < -0.24 and wiimote1.gy > -0.35) or (wiimote1.gy > 0.24 and wiimote1.gy < 0.35) or (wiimote1.gy < -0.74 and wiimote1.gy > -0.85) or (wiimote1.gy > 0.74 and wiimote1.gy < 0.85)
- w = true
- else
- w = false
- endif
- if (wiimote1.gy < -0.34 and wiimote1.gy > -0.45) or (wiimote1.gy > 0.34 and wiimote1.gy < 0.45) or (wiimote1.gy < -0.84 and wiimote1.gy > -0.95) or (wiimote1.gy > 0.84 and wiimote1.gy < 0.95)
- e = true
- else
- e = false
- endif
- if (wiimote1.gy < -0.44 and wiimote1.gy > -0.55) or (wiimote1.gy > 0.44 and wiimote1.gy < 0.55) or (wiimote1.gy < -0.94) or (wiimote1.gy > 0.94)
- r = true
- else
- r = false
- endif
- //gz
- if wiimote1.gz < 0
- t = true
- else
- t = false
- endif
- if (wiimote1.gz > 0.55) or (wiimote1.gz < -0.55)
- y = true
- else
- y = false
- endif
- if (wiimote1.gz < -0.04 and wiimote1.gz > -0.15) or (wiimote1.gz > 0.04 and wiimote1.gz < 0.15) or (wiimote1.gz < -0.54 and wiimote1.gz > -0.65) or (wiimote1.gz > 0.54 and wiimote1.gz < 0.65)
- u = true
- else
- u = false
- endif
- if (wiimote1.gz < -0.14 and wiimote1.gz > -0.25) or (wiimote1.gz > 0.14 and wiimote1.gz < 0.25) or (wiimote1.gz < -0.64 and wiimote1.gz > -0.75) or (wiimote1.gz > 0.64 and wiimote1.gz < 0.75)
- i = true
- else
- i = false
- endif
- if (wiimote1.gz < -0.24 and wiimote1.gz > -0.35) or (wiimote1.gz > 0.24 and wiimote1.gz < 0.35) or (wiimote1.gz < -0.74 and wiimote1.gz > -0.85) or (wiimote1.gz > 0.74 and wiimote1.gz < 0.85)
- o = true
- else
- o = false
- endif
- if (wiimote1.gz < -0.34 and wiimote1.gz > -0.45) or (wiimote1.gz > 0.34 and wiimote1.gz < 0.45) or (wiimote1.gz < -0.84 and wiimote1.gz > -0.95) or (wiimote1.gz > 0.84 and wiimote1.gz < 0.95)
- p = true
- else
- p = false
- endif
- if (wiimote1.gz < -0.44 and wiimote1.gz > -0.55) or (wiimote1.gz > 0.44 and wiimote1.gz < 0.55) or (wiimote1.gz < -0.94) or (wiimote1.gz > 0.94)
- a = true
- else
- a = false
- endif
- //buttons:
- s = wiimote1.One
- d = wiimote1.Two
- f = wiimote1.A
- g = wiimote1.B
- h = wiimote1.Down
- j = wiimote1.Home
- k = wiimote1.Left
- l = wiimote1.Minus
- z = wiimote1.Plus
- x = wiimote1.Right
- c = wiimote1.Up
- //Shakiness:
- v = wiimote1.Shakiness > 1 and wiimote1.Shakiness < 10
- b = wiimote1.Shakiness > 10 and wiimote1.Shakiness < 20
- n = wiimote1.Shakiness > 20 and wiimote1.Shakiness < 50
- m = wiimote1.Shakiness > 50
- endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement