Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
- $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler
- $oHTTP.Open("POST", "http:/thesite/turtle/interprete.php", False)
- $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
- Local $joy,$coor,$h,$s,$msg
- $joy = _JoyInit()
- while 1
- $coord=_GetJoy($joy,0)
- Switch $coord[7]
- Case 32
- $oHTTP.Send("a=6")
- Case 16
- $oHTTP.Send("a=5")
- Case 2
- $oHTTP.Send("a=2")
- Case 4
- $oHTTP.Send("a=3")
- Case 1
- $oHTTP.Send("a=1")
- Case 8
- $oHTTP.Send("a=4")
- EndSwitch
- Switch($coord[0])
- Case 65535
- $oHTTP.Send("a=065535")
- Case 0
- $oHTTP.Send("a=00")
- EndSwitch
- Switch $coord[1]
- Case 0
- $oHTTP.Send("a=10")
- Case 65535
- $oHTTP.Send("a=11")
- EndSwitch
- WEnd
- $lpJoy=0
- ;Giu Y:65535
- ;Su Y:0
- ;Sx: X:0
- ;Dx: X:65535
- ;6: Break
- ;5: Deploy
- ;10 = Avanti
- ;065535 = Ruota a Dx
- ;00 = Ruota a Sx
- ;2 = Turtle.Up()
- ;3 = Turtle.Down()
- ;1 = Turtle.digUp()
- ;4 =Turtle.digDown()
- ;32 = turtle.dig()
- ;16 = turtle.place()
- Func _JoyInit()
- Local $joy
- Global $JOYINFOEX_struct = "dword[13]"
- $joy=DllStructCreate($JOYINFOEX_struct)
- if @error Then Return 0
- DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
- DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
- return $joy
- EndFunc
- Func _GetJoy($lpJoy,$iJoy)
- Local $coor,$ret
- Dim $coor[8]
- DllCall("Winmm.dll","int","joyGetPosEx", _
- "int",$iJoy, _
- "ptr",DllStructGetPtr($lpJoy))
- if Not @error Then
- $coor[0] = DllStructGetData($lpJoy,1,3) ; X Axis
- $coor[1] = DllStructGetData($lpJoy,1,4) ; Y Axis
- $coor[2] = DllStructGetData($lpJoy,1,5) ; Z Axis
- $coor[3] = DllStructGetData($lpJoy,1,6) ; R Axis
- $coor[4] = DllStructGetData($lpJoy,1,7) ; U Axis
- $coor[5] = DllStructGetData($lpJoy,1,8) ; V Axis
- $coor[6] = DllStructGetData($lpJoy,1,11); POV Value
- $coor[7] = DllStructGetData($lpJoy,1,9) ; Buttons Mask
- EndIf
- return $coor
- EndFunc
- Func MyErrFunc()
- Run(@ScriptFullPath)
- Endfunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement