Advertisement
Guest User

Untitled

a guest
May 19th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
  2. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler
  3. $oHTTP.Open("POST", "http:/thesite/turtle/interprete.php", False)
  4. $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
  5.  
  6. Local $joy,$coor,$h,$s,$msg
  7. $joy = _JoyInit()
  8.  
  9. while 1
  10. $coord=_GetJoy($joy,0)
  11. Switch $coord[7]
  12. Case 32
  13. $oHTTP.Send("a=6")
  14. Case 16
  15. $oHTTP.Send("a=5")
  16. Case 2
  17. $oHTTP.Send("a=2")
  18. Case 4
  19. $oHTTP.Send("a=3")
  20. Case 1
  21. $oHTTP.Send("a=1")
  22. Case 8
  23. $oHTTP.Send("a=4")
  24. EndSwitch
  25. Switch($coord[0])
  26. Case 65535
  27. $oHTTP.Send("a=065535")
  28. Case 0
  29. $oHTTP.Send("a=00")
  30. EndSwitch
  31. Switch $coord[1]
  32. Case 0
  33. $oHTTP.Send("a=10")
  34. Case 65535
  35. $oHTTP.Send("a=11")
  36. EndSwitch
  37. WEnd
  38. $lpJoy=0
  39.  
  40. ;Giu Y:65535
  41. ;Su Y:0
  42. ;Sx: X:0
  43. ;Dx: X:65535
  44. ;6: Break
  45. ;5: Deploy
  46.  
  47. ;10 = Avanti
  48. ;065535 = Ruota a Dx
  49. ;00 = Ruota a Sx
  50. ;2 = Turtle.Up()
  51. ;3 = Turtle.Down()
  52. ;1 = Turtle.digUp()
  53. ;4 =Turtle.digDown()
  54. ;32 = turtle.dig()
  55. ;16 = turtle.place()
  56. Func _JoyInit()
  57. Local $joy
  58. Global $JOYINFOEX_struct = "dword[13]"
  59. $joy=DllStructCreate($JOYINFOEX_struct)
  60. if @error Then Return 0
  61. DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
  62. DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
  63. return $joy
  64. EndFunc
  65.  
  66. Func _GetJoy($lpJoy,$iJoy)
  67. Local $coor,$ret
  68. Dim $coor[8]
  69. DllCall("Winmm.dll","int","joyGetPosEx", _
  70. "int",$iJoy, _
  71. "ptr",DllStructGetPtr($lpJoy))
  72. if Not @error Then
  73. $coor[0] = DllStructGetData($lpJoy,1,3) ; X Axis
  74. $coor[1] = DllStructGetData($lpJoy,1,4) ; Y Axis
  75. $coor[2] = DllStructGetData($lpJoy,1,5) ; Z Axis
  76. $coor[3] = DllStructGetData($lpJoy,1,6) ; R Axis
  77. $coor[4] = DllStructGetData($lpJoy,1,7) ; U Axis
  78. $coor[5] = DllStructGetData($lpJoy,1,8) ; V Axis
  79. $coor[6] = DllStructGetData($lpJoy,1,11); POV Value
  80. $coor[7] = DllStructGetData($lpJoy,1,9) ; Buttons Mask
  81. EndIf
  82. return $coor
  83. EndFunc
  84. Func MyErrFunc()
  85. Run(@ScriptFullPath)
  86. Endfunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement