Advertisement
J0nas1

GlovePie Scratch connection script(29461286)

Oct 12th, 2014
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. //J0nas1's Scratch Wiimote connection script:
  2.  
  3. if clicked(space)
  4. if var.var
  5. var.var = false
  6. else
  7. var.var = true
  8. key.AnyKey = false
  9. endif
  10. endif
  11.  
  12.  
  13. if not var.var
  14. debug = "No remote connected"
  15. else
  16. if wiimote1.Exists
  17. var.Batt = wiimote.Battery / 48
  18. debug = "Battery: " + 100*48*var.Batt/192 + "% (Script is stopped)"
  19. else
  20. debug = "Script is stopped"
  21. endif
  22. endif
  23.  
  24. if wiimote1.Exists and not var.var
  25.  
  26. var.Batt = wiimote.Battery / 48
  27. debug = "Battery: " + 100*48*var.Batt/192 + "%"
  28.  
  29. //gx
  30. if wiimote1.gx < 0
  31. one = true
  32. else
  33. one = false
  34. endif
  35.  
  36. if (wiimote1.gx > 0.55) or (wiimote1.gx < -0.55)
  37. two = true
  38. else
  39. two = false
  40. endif
  41.  
  42. 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)
  43. three = true
  44. else
  45. three = false
  46. endif
  47.  
  48. 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)
  49. four = true
  50. else
  51. four = false
  52. endif
  53.  
  54. 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)
  55. five = true
  56. else
  57. five = false
  58. endif
  59.  
  60. 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)
  61. six = true
  62. else
  63. six = false
  64. endif
  65.  
  66. 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)
  67. seven = true
  68. else
  69. seven = false
  70. endif
  71.  
  72. //gy
  73. if wiimote1.gy < 0
  74. eight = true
  75. else
  76. eight = false
  77. endif
  78.  
  79. if (wiimote1.gy > 0.55) or (wiimote1.gy < -0.55)
  80. nine = true
  81. else
  82. nine = false
  83. endif
  84.  
  85. 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)
  86. zero = true
  87. else
  88. zero = false
  89. endif
  90.  
  91. 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)
  92. q = true
  93. else
  94. q = false
  95. endif
  96.  
  97. 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)
  98. w = true
  99. else
  100. w = false
  101. endif
  102.  
  103. 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)
  104. e = true
  105. else
  106. e = false
  107. endif
  108.  
  109. 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)
  110. r = true
  111. else
  112. r = false
  113. endif
  114.  
  115.  
  116. //gz
  117. if wiimote1.gz < 0
  118. t = true
  119. else
  120. t = false
  121. endif
  122.  
  123. if (wiimote1.gz > 0.55) or (wiimote1.gz < -0.55)
  124. y = true
  125. else
  126. y = false
  127. endif
  128.  
  129. 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)
  130. u = true
  131. else
  132. u = false
  133. endif
  134.  
  135. 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)
  136. i = true
  137. else
  138. i = false
  139. endif
  140.  
  141. 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)
  142. o = true
  143. else
  144. o = false
  145. endif
  146.  
  147. 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)
  148. p = true
  149. else
  150. p = false
  151. endif
  152.  
  153. 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)
  154. a = true
  155. else
  156. a = false
  157. endif
  158.  
  159. //buttons:
  160. s = wiimote1.One
  161. d = wiimote1.Two
  162. f = wiimote1.A
  163. g = wiimote1.B
  164. h = wiimote1.Down
  165. j = wiimote1.Home
  166. k = wiimote1.Left
  167. l = wiimote1.Minus
  168. z = wiimote1.Plus
  169. x = wiimote1.Right
  170. c = wiimote1.Up
  171.  
  172. //Shakiness:
  173. v = wiimote1.Shakiness > 1 and wiimote1.Shakiness < 10
  174. b = wiimote1.Shakiness > 10 and wiimote1.Shakiness < 20
  175. n = wiimote1.Shakiness > 20 and wiimote1.Shakiness < 50
  176. m = wiimote1.Shakiness > 50
  177. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement