Mausbewegungs möglichkeiten? Welche?

  • Hey Leute :D
    Ich einmal Wider :D:D
    Wie die meisten wissen ging ich euch die tage auf die Nerven was das auslessen einer gedrückten GamePad taste angeht.
    Da hat mir ja Rodny_le_lude was schönes Hingelegt :D

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;655535

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Xbox 360 Controller", 300, 400)
    $X0 = GUICtrlCreateLabel('', 10, 10, 30, 20)
    $S0 = GUICtrlCreateSlider(40, 05, 250, 20, 0x0010)
    $X1 = GUICtrlCreateLabel('', 10, 30, 30, 20)
    $S1 = GUICtrlCreateSlider(40, 25, 250, 20, 0x0010)
    $X2 = GUICtrlCreateLabel('', 10, 50, 30, 20)
    $S2 = GUICtrlCreateSlider(40, 45, 250, 20, 0x0010)
    $X3 = GUICtrlCreateLabel('', 10, 70, 30, 20)
    $S3 = GUICtrlCreateSlider(40, 65, 250, 20, 0x0010)
    $X4 = GUICtrlCreateLabel('', 10, 90, 30, 20)
    $S4 = GUICtrlCreateSlider(40, 85, 250, 20, 0x0010)
    $X5 = GUICtrlCreateLabel('', 10, 110, 30, 20)
    $X6 = GUICtrlCreateLabel('', 10, 130, 30, 20)
    $X7 = GUICtrlCreateLabel('', 10, 150, 30, 20)
    GUICtrlCreateLabel('Buttons Pressed:', 10, 170, 280, 20)
    $XB = GUICtrlCreateLabel('', 10, 190, 280, 20)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $joy = _JoyInit()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10)
    $msg = GUIGetMsg()
    $j = _GetJoy($joy, 0)
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Get Array values from _GetJoy return and display
    For $a = 0 To 7
    $control = Execute('$X' & $a)
    If GUICtrlRead($control) <> $j[$a] Then GUICtrlSetData($control, $j[$a])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Get buttons pressed and display
    $Spressed = GetPressed($j[7])
    If GUICtrlRead($XB) <> $Spressed Then GUICtrlSetData($XB, $Spressed)

    [/autoit] [autoit][/autoit] [autoit]

    ;Set sliders to correct position
    For $a = 0 To 4
    SetSliders($j[$a], $a)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func GetPressed($Val)
    $SButtons = ''
    If BitAND($Val, 1) Then $SButtons &= '(A)'
    If BitAND($Val, 2) Then $SButtons &= '(B)'
    If BitAND($Val, 4) Then $SButtons &= '(X)'
    If BitAND($Val, 8) Then $SButtons &= '(Y)'
    If BitAND($Val, 16) Then $SButtons &= '(LB)'
    If BitAND($Val, 32) Then $SButtons &= '(RB)'
    If BitAND($Val, 64) Then $SButtons &= '(Back)'
    If BitAND($Val, 128) Then $SButtons &= '(Start)'
    If BitAND($Val, 256) Then $SButtons &= '(LS)'
    If BitAND($Val, 512) Then $SButtons &= '(RS)'
    Return $SButtons
    EndFunc ;==>GetPressed

    [/autoit] [autoit][/autoit] [autoit]

    Func SetSliders($Val, $Slide)
    $control = Execute('$S' & $Slide)
    If $Val = 65535 Then
    GUICtrlSetData($control, 0)
    ElseIf $Val = 0 Then
    GUICtrlSetData($control, 100)
    Else
    GUICtrlSetData($control, ((65535 - $Val) / 65535) * 100)
    EndIf
    EndFunc ;==>SetSliders

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _JoyInit()
    ;======================================
    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 ;==>_JoyInit

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _GetJoy($lpJoy,$iJoy)
    ; $lpJoy Return from _JoyInit()
    ; $iJoy Joystick # 0-15
    ; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
    ; Buttons down
    ;
    ; *POV This is a digital game pad, not analog Joystick
    ; 65535 = Not pressed
    ; 0 = U
    ; 4500 = UR
    ; 9000 = R
    ; Goes around clockwise increasing 4500 for each position
    ;======================================
    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)
    $coor[1] = DllStructGetData($lpJoy, 1, 4)
    $coor[2] = DllStructGetData($lpJoy, 1, 5)
    $coor[3] = DllStructGetData($lpJoy, 1, 6)
    $coor[4] = DllStructGetData($lpJoy, 1, 7)
    $coor[5] = DllStructGetData($lpJoy, 1, 8)
    $coor[6] = DllStructGetData($lpJoy, 1, 11)
    $coor[7] = DllStructGetData($lpJoy, 1, 9)
    EndIf
    Return $coor
    EndFunc ;==>_GetJoy

    [/autoit]


    Das hab ich soweit um geschrieben das ALLES mal eine msgbox ausgibt (Damit ich genau weiss wass was ist :D)
    Wen ihr das sehen wollt sagt es pls :D
    Soweit so gut, Da ich aber vor habe das Ganze so um zu schreiben das es am ende tastatur UND mouse imitiert (Damit will ich sagen, PadSticks = Mouse bewegungen und so)
    nun hab ich da aber ein Problem, ich weiss nicht wie ich das machen soll das wen ich den Linken PadStick nach Oben Drücke, das "Der Mauszeiger" auch nach oben geht.
    Weiss da jmd evt was? bin um jede hilfe Dankbar :D

    Skilkor

  • 2variablen erstellen, 1 für x-achse und 1 für y-achse.
    in ner schleife wird dann überprücht, ob der PadStick nach oben oder unten gedrückt wird, wenn ja dann die variable y-1 (oder y+1) rechnen und mit MouseMove(x,y) die maus dahin bewegen.
    für linke und rechte maustaste dann überprüfen ob der button gedrückt wurde und dann MouseClick("Primary") oder MouseClick("Secondary") ausführen ^^

    autoBert wenn der treiber sowas nicht vorinstalliert hat, dann kann man versuchen es irgendwie anders zu machen, und bei den meissten controllern wird sowas leider nicht unterstützt

    Mfg. PCKing


    Mein PC

    CPU: AMD FX 8350 8x4.00GHz
    Ram: 8GB DDR3
    Grafikkarte: Nvidia Geforce GTX 960 (4GB)
    Festplatten: 500GB SSD 1TB HDD
    Laufwerk: Blueray RW+ Brenner

  • Zitat

    Von autoBert
    Ist dafür nicht eigentlich der Treiber deines Pad's zuständig :?:


    Mit dem pad lässt sich die Maus grundsätzlich nicht Steuern. Nur wen man diese mittel Programme aufnimmt und denen einen Befehl zuteilt, tun die was ^^ (mit Die mein Ich DIE tasten :D)

    Zitat

    PCKing
    2variablen erstellen, 1 für x-achse und 1 für y-achse.
    in ner schleife wird dann überprücht, ob der PadStick nach oben oder unten gedrückt wird, wenn ja dann die variable y-1 (oder y+1) rechnen und mit MouseMove(x,y) die maus dahin bewegen.
    für linke und rechte maustaste dann überprüfen ob der button gedrückt wurde und dann MouseClick("Primary") oder MouseClick("Secondary") ausführen ^^


    EHM 8| WAT :?: ?(
    Davon hab ich jetz grad nur 80% Verstanden, was aber nicht heisst das ich weiss was du meinst :( ;(

    OK, nach 10maligen durchlessen hab ichs kapiert.
    Allso die PadStick variablen sind vorhanden wird erkannt und alles.
    Wie ich eine maus bewegen kann weiss ich auch. nurhab ich da das problem,dass ich dem doch ned einfach sagen kann, das der in die mitte der Oberenrandes gehen soll.so kann man doch im endefeckt kein Spiel das GamePads nicht erkennt Spielen. (OK,es mag bei einigen einen guten grund dafür haben, wegen der Reaktions zeit,aber wer sagt das es = ein Shooter sein muss?? :D)

    Am besten ich geb euch mal das was ich habe (Ich hoffe ihr habt gamepads,sonnst könnt ihrs ned testen)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;655535

    [/autoit] [autoit][/autoit] [autoit]

    ;$Form1 = GUICreate("Pad to Keyboard", 300, 400)
    $X0 = GUICtrlCreateLabel('', 10, 10, 30, 20)
    $S0 = GUICtrlCreateSlider(40, 05, 250, 20, 0x0010)
    $X1 = GUICtrlCreateLabel('', 10, 30, 30, 20)
    $S1 = GUICtrlCreateSlider(40, 25, 250, 20, 0x0010)
    $X2 = GUICtrlCreateLabel('', 10, 50, 30, 20)
    $S2 = GUICtrlCreateSlider(40, 45, 250, 20, 0x0010)
    $X3 = GUICtrlCreateLabel('', 10, 70, 30, 20)
    $S3 = GUICtrlCreateSlider(40, 65, 250, 20, 0x0010)
    $X4 = GUICtrlCreateLabel('', 10, 90, 30, 20)
    $S4 = GUICtrlCreateSlider(40, 85, 250, 20, 0x0010)
    $X5 = GUICtrlCreateLabel('', 10, 110, 30, 20)
    $X6 = GUICtrlCreateLabel('', 10, 130, 30, 20)
    $X7 = GUICtrlCreateLabel('', 10, 150, 30, 20)
    GUICtrlCreateLabel('Buttons Pressed:', 10, 170, 280, 20)
    $XB = GUICtrlCreateLabel('', 10, 190, 280, 20)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $joy = _JoyInit()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10)
    $msg = GUIGetMsg()
    $j = _GetJoy($joy, 0)
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Get Array values from _GetJoy return and display
    For $a = 0 To 7
    $control = Execute('$X' & $a)
    If GUICtrlRead($control) <> $j[$a] Then GUICtrlSetData($control, $j[$a])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Get buttons pressed and display
    $Spressed = GetPressed($j[7])
    If GUICtrlRead($XB) <> $Spressed Then GUICtrlSetData($XB, $Spressed)

    [/autoit] [autoit][/autoit] [autoit]

    ;Set sliders to correct position
    For $a = 0 To 4
    SetSliders($j[$a], $a)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func GetPressed($Val)
    $SButtons = ''
    If BitAND($Val, 1) Then $SButtons &= '(1)' & MsgBox(0,"Pad Taste","1",2)
    If BitAND($Val, 2) Then $SButtons &= '(2)' & MsgBox(0,"Pad Taste","2",2)
    If BitAND($Val, 4) Then $SButtons &= '(3)' & MsgBox(0,"Pad Taste","3",2)
    If BitAND($Val, 8) Then $SButtons &= '(4)' & MsgBox(0,"Pad Taste","4",2)
    If BitAND($Val, 16) Then $SButtons &= '(L1)' & MsgBox(0,"Pad Taste","L1",2)
    If BitAND($Val, 32) Then $SButtons &= '(L2)' & MsgBox(0,"Pad Taste","L2",2)
    If BitAND($Val, 64) Then $SButtons &= '(R1)' & MsgBox(0,"Pad Taste","R1",2)
    If BitAND($Val, 128) Then $SButtons &= '(R2)' & MsgBox(0,"Pad Taste","R2",2)
    If BitAND($Val, 256) Then $SButtons &= '(Select)' & MsgBox(0,"Pad Taste","Select",2)
    If BitAND($Val, 512) Then $SButtons &= '(Start)' & MsgBox(0,"Pad Taste","Start",2)
    If BitAND($Val, 1024) Then $SButtons &= '(L3)' & MsgBox(0,"Pad Taste","L3",2)
    If BitAND($Val, 2048) Then $SButtons &= '(R3)' & MsgBox(0,"Pad Taste","R3",2)
    Return $SButtons
    EndFunc ;==>GetPressed

    [/autoit] [autoit][/autoit] [autoit]

    Func SetSliders($Val, $Slide)
    $control = Execute('$S' & $Slide)
    If $Val = 65535 Then
    GUICtrlSetData($control, 0)
    ElseIf $Val = 0 Then
    GUICtrlSetData($control, 100)
    Else
    GUICtrlSetData($control, ((65535 - $Val) / 65535) * 100)
    EndIf
    EndFunc ;==>SetSliders

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _JoyInit()
    ;======================================
    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 ;==>_JoyInit

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _GetJoy($lpJoy,$iJoy)
    ; $lpJoy Return from _JoyInit()
    ; $iJoy Joystick # 0-15
    ; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
    ; Buttons down
    ;
    ; *POV This is a digital game pad, not analog Joystick
    ; 65535 = Not pressed
    ; 0 = U
    ; 4500 = UR
    ; 9000 = R
    ; Goes around clockwise increasing 4500 for each position
    ;======================================
    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)
    $coor[1] = DllStructGetData($lpJoy, 1, 4)
    $coor[2] = DllStructGetData($lpJoy, 1, 5)
    $coor[3] = DllStructGetData($lpJoy, 1, 6)
    $coor[4] = DllStructGetData($lpJoy, 1, 7)
    $coor[5] = DllStructGetData($lpJoy, 1, 8)
    $coor[6] = DllStructGetData($lpJoy, 1, 11)
    $coor[7] = DllStructGetData($lpJoy, 1, 9)
    EndIf
    ;~ Linker PadStick
    If $coor[0] = 0 Then MsgBox(0,"Pad Stick","Linker Stick = Left",2)
    If $coor[0] = 65535 Then MsgBox(0,"Pad Stick","Linker Stick = Right",2)
    If $coor[1] = 0 Then MsgBox(0,"Pad Stick","Linker Stick = Up",2)
    If $coor[1] = 65535 Then MsgBox(0,"Pad Stick","Linker Stick = Down",2)
    ;~ Rechter PadStick
    If $coor[2] = 0 Then MsgBox(0,"Pad Stick","Rechter Stick = UP",2)
    If $coor[2] = 65535 Then MsgBox(0,"Pad Stick","Rechter Stick = Down",2)
    If $coor[3] = 0 Then MsgBox(0,"Pad Stick","Rechter Stick = Left",2)
    If $coor[3] = 65535 Then MsgBox(0,"Pad Stick","Rechter Stick = Right",2)
    Return $coor
    EndFunc ;==>_GetJoy

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    Wie gesagt, über allem was ich bis jetz gesehen und gefunden habe, hab ich ne MSGBox drangehauen, da ich die Form Deaktiviert habe ^^

    2 Mal editiert, zuletzt von Skilkor (19. August 2010 um 00:52)

  • ich hatte mir auch mal sowas gebastelt, da hatte mir auch jemand so ne funktion gebastelt, mir fällt nur leider nicht mehr ein wer es war...
    naja, ich hatte es auch mein POV eingestellt, hier mal der code

    Quellcode
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $joy = _JoyInit()
    Global $ControllerNummer = 0 ;wenn nur einer angeschlossen ist isses die 0, sonst testen
    Global $mousespeed = 1 ;erhöhern wenns schneller sein soll

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $coord = _GetJoy($joy, $ControllerNummer)
    Select
    Case $coord[6] = 27000
    $pos = MouseGetPos()
    MouseMove($pos[0]-$mousespeed,$pos[1])
    Case $coord[6] = 9000
    $pos = MouseGetPos()
    MouseMove($pos[0]+$mousespeed,$pos[1])
    Case $coord[6] = 0
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]-$mousespeed)
    Case $coord[6] = 18000
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]+$mousespeed)
    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetJoy($lpJoy, $iJoy)
    Local $coor, $ret

    [/autoit] [autoit][/autoit] [autoit]

    Dim $coor[8]
    DllCall("Winmm.dll", "int", "joyGetPosEx", _
    "int", $iJoy, _
    "ptr", DllStructGetPtr($lpJoy))

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    $coor[0] = DllStructGetData($lpJoy, 1, 3);X
    $coor[1] = DllStructGetData($lpJoy, 1, 4);Y
    $coor[2] = DllStructGetData($lpJoy, 1, 5);Z
    $coor[3] = DllStructGetData($lpJoy, 1, 6);R
    $coor[4] = DllStructGetData($lpJoy, 1, 7);U
    $coor[5] = DllStructGetData($lpJoy, 1, 8);V
    $coor[6] = DllStructGetData($lpJoy, 1, 11);POV
    $coor[7] = DllStructGetData($lpJoy, 1, 9);Buttons
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Return $coor
    EndFunc ;==>_GetJoy

    [/autoit] [autoit][/autoit] [autoit]

    Func _JoyInit()
    Local $joy
    Global $JOYINFOEX_struct = "dword[13]"

    [/autoit] [autoit][/autoit] [autoit]

    $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 ;==>_JoyInit

    [/autoit]

    Damit solltest du was anfangen können ^^

    Mfg. PCKing


    Mein PC

    CPU: AMD FX 8350 8x4.00GHz
    Ram: 8GB DDR3
    Grafikkarte: Nvidia Geforce GTX 960 (4GB)
    Festplatten: 500GB SSD 1TB HDD
    Laufwerk: Blueray RW+ Brenner

  • Siht sehr schön aus :D
    Mal sehen ob ich das mit Meinem Kombinieren kann :D da ja deins auch die winmm.dll nuzt :D
    Thx :D
    Ich lass das Thread mal Offen, falls sich noch was ergeben sollte :D

    Edit:1
    Wehuuu, Dank deinem Script hab ich herausgefunden welche Variable für das Mehrweg Kreuz zuständig ist :D
    Ich mach mit jetz mal daran,dass man mit dem PadStick die maus bewegen kann :D

    Einmal editiert, zuletzt von Skilkor (19. August 2010 um 01:28)

  • ok, ich steh vor dem ersten ding :D
    ich hab es erfolgreich umgeschrieben und es funktioniert.
    da ich aber möchte das das script auch andere verwenden, weiss ich nicht genau wie ich den Mauszeiger einheitlich in die Mitte bekomme... egal bei welcher auflösung.
    da ich einen 22° habe,sprich 1680x1050 auflösung, ist bei mir die mitte 840x525.
    da aber ein 17° die auflösung 1280x1024 hat, ist 840x525 natürlich nicht die mitte.
    Wie bekomm ich das den hin??

    (Btw sry für doppelpost,Edits siht man leider nur wen man das Thread öffnet,werden aber nicht angezeigt)

    Hier das Script (Kann nur mit einem GamePad bedient werden)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{ESC}", "Terminate")

    [/autoit] [autoit][/autoit] [autoit]

    Func Terminate()
    Exit 0
    EndFunc
    ;655535

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Pad to Keyboard", 300, 400)
    $X0 = GUICtrlCreateLabel('', 10, 10, 30, 20)
    $S0 = GUICtrlCreateSlider(40, 05, 250, 20, 0x0010)
    $X1 = GUICtrlCreateLabel('', 10, 30, 30, 20)
    $S1 = GUICtrlCreateSlider(40, 25, 250, 20, 0x0010)
    $X2 = GUICtrlCreateLabel('', 10, 50, 30, 20)
    $S2 = GUICtrlCreateSlider(40, 45, 250, 20, 0x0010)
    $X3 = GUICtrlCreateLabel('', 10, 70, 30, 20)
    $S3 = GUICtrlCreateSlider(40, 65, 250, 20, 0x0010)
    $X4 = GUICtrlCreateLabel('', 10, 90, 30, 20)
    $S4 = GUICtrlCreateSlider(40, 85, 250, 20, 0x0010)
    $X5 = GUICtrlCreateLabel('', 10, 110, 30, 20)
    $X6 = GUICtrlCreateLabel('', 10, 130, 30, 20)
    $X7 = GUICtrlCreateLabel('', 10, 150, 30, 20)
    GUICtrlCreateLabel('Buttons Pressed:', 10, 170, 280, 20)
    $XB = GUICtrlCreateLabel('', 10, 190, 280, 20)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    Global $joy = _JoyInit()
    Global $ControllerNummer = 0 ;wenn nur einer angeschlossen ist isses die 0, sonst testen
    Global $mousespeed = 840 ;erhöhern wenns schneller sein soll

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10)
    $msg = GUIGetMsg()
    $j = _GetJoy($joy, 0)
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Get Array values from _GetJoy return and display
    For $a = 0 To 7
    $control = Execute('$X' & $a)
    If GUICtrlRead($control) <> $j[$a] Then GUICtrlSetData($control, $j[$a])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Get buttons pressed and display
    $Spressed = GetPressed($j[7])
    If GUICtrlRead($XB) <> $Spressed Then GUICtrlSetData($XB, $Spressed)

    [/autoit] [autoit][/autoit] [autoit]

    ;Set sliders to correct position
    For $a = 0 To 4
    SetSliders($j[$a], $a)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func GetPressed($Val)
    $SButtons = ''
    If BitAND($Val, 1) Then $SButtons &= '(1)' & MsgBox(0,"Pad Taste","1",2)
    If BitAND($Val, 2) Then $SButtons &= '(2)' & MsgBox(0,"Pad Taste","2",2)
    If BitAND($Val, 4) Then $SButtons &= '(3)' & MsgBox(0,"Pad Taste","3",2)
    If BitAND($Val, 8) Then $SButtons &= '(4)' & MsgBox(0,"Pad Taste","4",2)
    If BitAND($Val, 16) Then $SButtons &= '(L1)' & MsgBox(0,"Pad Taste","L1",2)
    If BitAND($Val, 32) Then $SButtons &= '(L2)' & MsgBox(0,"Pad Taste","L2",2)
    If BitAND($Val, 64) Then $SButtons &= '(R1)' & MsgBox(0,"Pad Taste","R1",2)
    If BitAND($Val, 128) Then $SButtons &= '(R2)' & MsgBox(0,"Pad Taste","R2",2)
    If BitAND($Val, 256) Then $SButtons &= '(Select)' & MsgBox(0,"Pad Taste","Select",2)
    If BitAND($Val, 512) Then $SButtons &= '(Start)' & MsgBox(0,"Pad Taste","Start",2)
    If BitAND($Val, 1024) Then $SButtons &= '(L3)' & MsgBox(0,"Pad Taste","L3",2)
    If BitAND($Val, 2048) Then $SButtons &= '(R3)' & MsgBox(0,"Pad Taste","R3",2)
    Return $SButtons
    EndFunc ;==>GetPressed

    [/autoit] [autoit][/autoit] [autoit]

    Func SetSliders($Val, $Slide)
    $control = Execute('$S' & $Slide)
    If $Val = 65535 Then
    GUICtrlSetData($control, 0)
    ElseIf $Val = 0 Then
    GUICtrlSetData($control, 100)
    Else
    GUICtrlSetData($control, ((65535 - $Val) / 65535) * 100)
    EndIf
    EndFunc ;==>SetSliders

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _JoyInit()
    ;======================================
    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 ;==>_JoyInit

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _GetJoy($lpJoy,$iJoy)
    ; $lpJoy Return from _JoyInit()
    ; $iJoy Joystick # 0-15
    ; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
    ; Buttons down
    ;
    ; *POV This is a digital game pad, not analog Joystick
    ; 65535 = Not pressed
    ; 0 = U
    ; 4500 = UR
    ; 9000 = R
    ; Goes around clockwise increasing 4500 for each position
    ;======================================
    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)
    $coor[1] = DllStructGetData($lpJoy, 1, 4)
    $coor[2] = DllStructGetData($lpJoy, 1, 5)
    $coor[3] = DllStructGetData($lpJoy, 1, 6)
    $coor[4] = DllStructGetData($lpJoy, 1, 7)
    $coor[5] = DllStructGetData($lpJoy, 1, 8)
    $coor[6] = DllStructGetData($lpJoy, 1, 11)
    $coor[7] = DllStructGetData($lpJoy, 1, 9)
    EndIf
    ;~ ==========>PadStick Bewegt Maus
    ;~ Linker PadStick
    If $coor[0] = 0 Then ;Left PadStick Left
    $pos = MouseGetPos()
    MouseMove($pos[0]-$mousespeed,$pos[1])
    EndIf
    If $coor[0] = 32767 Then ;Sezt die Maus wider in die Mitte
    MouseMove(840,525)
    EndIf
    If $coor[0] = 65535 Then ;Left PadStick Right
    $pos = MouseGetPos()
    MouseMove($pos[0]+$mousespeed,$pos[1])
    EndIf

    If $coor[1] = 0 Then ;Left PadStick Up
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]-$mousespeed)
    EndIf
    If $coor[0] = 32767 Then ;Sezt die Maus wider in die Mitte
    MouseMove(840,525)
    EndIf
    If $coor[1] = 65535 Then ;Left PadStick Down
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]+$mousespeed)
    EndIf
    ;~ ==========>
    ;~ Rechter PadStick
    If $coor[2] = 0 Then MsgBox(0,"Pad Stick","Rechter Stick = UP",2)
    If $coor[2] = 65535 Then MsgBox(0,"Pad Stick","Rechter Stick = Down",2)
    If $coor[3] = 0 Then MsgBox(0,"Pad Stick","Rechter Stick = Left",2)
    If $coor[3] = 65535 Then MsgBox(0,"Pad Stick","Rechter Stick = Right",2)
    ;~ ==========>
    ;~ Mehrweg Kreuz Tasten
    If $coor[6] = 27000 Then MsgBox(0,"Mehrwegkreuztaste","Left",2)
    If $coor[6] = 9000 Then MsgBox(0,"Mehrwegkreuztaste","Right",2)
    If $coor[6] = 0 Then MsgBox(0,"Mehrwegkreuztaste","Up",2)
    If $coor[6] = 18000 Then MsgBox(0,"Mehrwegkreuztaste","Down",2)
    Return $coor
    EndFunc ;==>_GetJoy

    [/autoit]

    Skilkor

  • ahh, du meinst im sinne von

    [autoit]

    MouseMove(@DesktopWidth / 2,@DesktopHeight / 2)

    [/autoit]


    :D hätt ich selbst drauf können xD wahr wohl doch schon spät :D
    ich frag mich nur wie ich das nun mit dermehrweg Kreuz Tasten machen soll.
    UP = W
    Left = D
    usw.
    wen ich

    [autoit]

    If $coor[6] = 27000 Then
    send("{a}")
    EndIf

    [/autoit]


    verwenden drückt er 1000e malle die w taste, das verursacht Zuckungen beim Charakter xD sprich, er zuck mm für mm in die richtung xD
    weiss da jmd was?
    mit

    [autoit]

    _isPressed

    [/autoit]


    kenn ich mich nicht so gut aus :S würde ddas was helfen?

  • Zitat von Hilfedatei

    Send("{a down}") ;Hält die Taste A gedrückt
    Send("{a up}") ;Lässt die Taste wieder los

    das sollte was nützen :whistling:

    Mfg. PCKing


    Mein PC

    CPU: AMD FX 8350 8x4.00GHz
    Ram: 8GB DDR3
    Grafikkarte: Nvidia Geforce GTX 960 (4GB)
    Festplatten: 500GB SSD 1TB HDD
    Laufwerk: Blueray RW+ Brenner

  • Zitat

    das sollte was nützen :whistling:


    und das tut es auch, nur hab ich jetz ein prolem
    Ich kann es soweit steuern das er die maus bewegt.
    mit

    Spoiler anzeigen
    [autoit]

    ;~ Rechter PadStick
    If $coor[2] = 0 Then ;Right PadStick Left
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]-$mousespeed)
    EndIf
    If $coor[2] == 32767 Then ;Sezt die Maus wider in die Mitte
    MouseMove(@DesktopWidth / 2,@DesktopHeight / 2)
    EndIf
    If $coor[2] = 65535 Then ;Right PadStick Right
    $pos = MouseGetPos()
    MouseMove($pos[0],$pos[1]+$mousespeed)
    EndIf
    ;~ =========
    If $coor[3] = 0 Then ;Right PadStick Up
    $pos = MouseGetPos()
    MouseMove($pos[0]-$mousespeed,$pos[1])
    EndIf
    If $coor[2] == 32767 Then ;Sezt die Maus wider in die Mitte
    MouseMove(@DesktopWidth / 2,@DesktopHeight / 2)
    EndIf
    If $coor[3] = 65535 Then ;Right PadStick Down
    $pos = MouseGetPos()
    MouseMove($pos[0]+$mousespeed,$pos[1])
    EndIf
    ;~ ==========>

    [/autoit]


    wen ich aber mit

    Spoiler anzeigen
    [autoit]

    If $coor[2] = 16383 Then ;Right PadStick Left
    $pos = MouseGetPos()
    MouseMove($pos[0]/2,$pos[1]/2 -$mousespeed)
    EndIf

    [/autoit]


    Versuche, tut sich nichts, rein garnichts. nicht einmal ein error.
    das heisst für mich eigentlich nur, das der Stick die 16383 nie erreicht. was aber fast nicht möglich ist da
    0 nach Links o. Oben ist
    65535 nach Rechts o. Unten
    Und
    32767 die mitte ist
    weiss da jamd vll was?