1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Keyle

Beiträge von Keyle

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 21. Dezember 2008 um 15:57

    Ich habs selbst geschafft :D

    Hier mal die Lösung wenns einen interessiert:

    Spoiler anzeigen
    [autoit]


    $joy = _JoyInit()
    While 1
    $coord = _GetJoy($joy, 0)
    $coordX = Round($coord[0] / 255, 0)
    $coordY = Round($coord[1] / 255, 0)

    ;~ MsgBox(0,"",$coordX&","&$coordY)
    If $coordX > 110 And $coordX < 150 And $coordY > 110 And $coordY < 150 Then
    ;~ MsgBox(0,"","nix")
    Send("{LEFT UP}")
    Send("{UP UP}")
    Send("{RIGHT UP}")
    Send("{DOWN UP}")
    EndIf
    If $coordX < 90 And $coordY > 110 And $coordY < 180 Then
    ;~ MsgBox(0,"","Links")
    Send("{LEFT DOWN}")
    Send("{UP UP}")
    Send("{RIGHT UP}")
    Send("{DOWN UP}")
    EndIf
    If $coordX = 0 Or $coordX < 40 And $coordY > 220 Then
    ;~ MsgBox(0,"","Links-Unten")
    Send("{LEFT DOWN}")
    Send("{UP UP}")
    Send("{RIGHT UP}")
    Send("{DOWN DOWN}")
    EndIf
    If $coordX > 80 And $coordX < 170 And $coordY > 250 Then
    ;~ MsgBox(0,"","Unten")
    Send("{LEFT UP}")
    Send("{UP UP}")
    Send("{RIGHT UP}")
    Send("{DOWN DOWN}")
    EndIf
    If $coordX > 160 And $coordY > 200 Then
    ;~ MsgBox(0,"","Unten-Rechts")
    Send("{LEFT UP}")
    Send("{UP UP}")
    Send("{RIGHT DOWN}")
    Send("{DOWN DOWN}")
    EndIf
    If $coordX > 240 And $coordY > 110 And $coordY < 200 Then
    ;~ MsgBox(0,"","Rechts")
    Send("{LEFT UP}")
    Send("{UP UP}")
    Send("{RIGHT DOWN}")
    Send("{DOWN UP}")
    EndIf
    If $coordX > 180 And $coordY < 90 Then
    ;~ MsgBox(0,"","Oben-Rechts")
    Send("{LEFT UP}")
    Send("{UP DOWN}")
    Send("{RIGHT DOWN}")
    Send("{DOWN UP}")
    EndIf
    If $coordX > 80 And $coordX < 150 And $coordY < 60 Then
    ;~ MsgBox(0,"","Oben")
    Send("{LEFT UP}")
    Send("{UP DOWN}")
    Send("{RIGHT UP}")
    Send("{DOWN UP}")
    EndIf
    If $coordX < 60 And $coordX < 120 And $coordY < 110 Then
    ;~ MsgBox(0,"","Oben-Links")
    Send("{LEFT DOWN}")
    Send("{UP DOWN}")
    Send("{RIGHT UP}")
    Send("{DOWN UP}")
    EndIf
    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)
    $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

    [/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]


    Bin für verbesserungen noch offen :D

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 20. Dezember 2008 um 22:36

    Hier mal nen Pic, Photoshop lässt grüßen:

    [Blockierte Grafik: http://www.abload.de/thumb/pspc1gn.jpg]

    Also alle Angaben sind ungefähr und von mir manuell getestet:

    Oben Links ≈ X0,Y0
    Oben ≈ X40000,Y0
    Oben Rechts ≈X65500,Y0
    Rechts ≈X6550,Y36000
    Unten Rechts ≈X65500,Y58000 Unten ≈X41000,Y65000
    Unten Links ≈X5000,Y65000
    Links ≈X0,Y35000

    Edit: ich hab überall versucht genau die Mitte zu treffen also genau zwischen 2 Strichen
    Edit2: da muss man aber schon große Wertebereiche nehmen damit dass funz sonst trifft man die Stellen gar nicht

    Edit3: Wäre es einfacher mit Zahlen von 0 - 255 zu rechnen oder es in grad zu wandeln???

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 20. Dezember 2008 um 21:37

    Aso,

    Danke für deine Antwort,
    jetzt muss ich nur noch herausfinden wo das steht.

    EDIT: Ich finds einfach nich wo steht das??? :P

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 20. Dezember 2008 um 20:55

    Also ich benutzte als Gamepad meine PSP.

    Das Gamepad bzw. die PSP hat:
    -2 Achsen
    -9 Buttons
    -1 POV

    Mittelposition ist: X=35996 , Y=35996
    Beide Werte sind 0 wenn ich den den Knüppel nach Oben-links schiebe
    Mit diesem Script komme ich an die Daten fals das hilft:

    Spoiler anzeigen
    [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)
    $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

    [/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]

    Was meinst du mit linear und nichtlinear ich kann mir darunter jetzt nichts vorstellen

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 20. Dezember 2008 um 19:51

    Nein keinen Mausersatz sondern ich möchte das als Steuerung für ein Spiel benutzten

  • X/Y Koordinaten in Send Befehle

    • Keyle
    • 20. Dezember 2008 um 18:41

    Hallo zusammen,

    WOW mein 1. Post :P

    Also ich möchte gerne Koordinaten (X/Y) die von einem Gamepad kommen (funktioniert schon) als SEND Befehle in die richtige Richtung(unten,oben,rechts,links) ausführen.

    Nur wie? Mit umwandeln oder so??

    also z.B.

    [autoit]

    $X = 35974
    $Y = 23478
    ; => Hier irgendwie umwandlen (oder auch nicht wenn man die werte direkt verarbeiten kann)
    [Punkte(...) durch die Werte ersetzten]
    If $X_Umgewandelt < ... And $X_Umgewandelt > ... And $Y_Umgewandelt < ... And $Y_Umgewandelt > ... Then
    Send("{LEFT DOWN}")
    EndIf

    [/autoit]

    Ich hoffe mal ihr versteht wie ich es machen will ;)

    Danke schon mal für eure anworten

    Mfg Keyle

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™