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. L3viathan

Beiträge von L3viathan

  • Text-only Counterstrike :D

    • L3viathan
    • 25. November 2009 um 21:22

    So, hier ein Text-only Counterstrike Game, aus Spaß an der Freude.
    KI noch nicht vorhanden --> Gegner bewegt sich nicht.
    Kommandos:

    Code
    go north|south|east|west
    jump north|south|east|west
    turn north|south|east|west
    shoot


    Jetzt mit (Nicht-) KI: einfach zufällige Aktion aus Go, Turn, Shoot

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiEdit.au3>
    #include <ScrollBarConstants.au3>
    #Region VAR
    Global $IAmNr=0
    Dim $players[2][4]=[[0,0,"s",100],[9,9,"n",100]];x,y,blick(nswo),leben,
    Dim $board[10][10];[x][Y]; werte: ""=nix,"M"=Mauer","1/2"=player
    _clearBoard()
    #EndRegion VAR
    #Region GUI
    $Form1 = GUICreate("txtCS", 635, 448, 192, 119)
    $Input = GUICtrlCreateInput("", 0, 424, 633, 21)
    $Output = GUICtrlCreateEdit("Willkommen bei Text-only Counterstrike" & @CRLF, 0, 0, 633, 425)
    $Enter = GUICtrlCreateDummy()
    GUICtrlSetData(-1, "Edit1")
    GUISetState(@SW_SHOW)
    Dim $accelerators[1][2]=[["{ENTER}",$Enter]]
    GUISetAccelerators($accelerators)
    #EndRegion GUI
    ;besetze Felder:
    _setHumansToBoard()
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Enter
    _input(GUICtrlRead($Input))
    GUICtrlSetData($Input,"")
    _opponentMoves()
    EndSwitch
    WEnd
    Func _output($what)
    _GUICtrlEdit_AppendText($Output,$what & @CRLF)
    _GUICtrlEdit_Scroll($Output,$SB_LINEDOWN)
    EndFunc
    Func _input($what)
    ;~ commands: go, shoot, turn, jump, cheat, help
    If _beginsWith($what,"go ") Then
    _tryGo(StringTrimLeft($what,3))
    ElseIf _beginsWith($what,"shoot") Then
    _tryShoot()
    ElseIf _beginsWith($what,"turn ") Then
    _tryTurn(StringTrimLeft($what,5))
    ElseIf _beginsWith($what,"jump ") Then
    _tryJump(StringTrimLeft($what,5))
    ElseIf $what = "help" Then
    _help()
    ElseIf _beginsWith($what,"cheat") Then
    $players[$IAmNr][0]=InputBox("X-Position","")
    $players[$IAmNr][1]=InputBox("Y-Position","")
    _clearBoard()
    _setHumansToBoard()
    Else
    _output("Befehl falsch geschrieben oder nicht vorhanden.")
    EndIf
    EndFunc
    Func _beginsWith($hay,$needle)
    If StringInStr($hay,$needle) = 1 Then return True
    return False
    EndFunc
    Func _tryGo($where,$who=$IAmNr)
    $xpos=$players[$who][0]
    $ypos=$players[$who][1]
    Switch $where
    Case "north"
    If $ypos=0 Then return _output("Kann nicht nach Norden gehen, Kartenrand erreicht.")
    If $board[$xpos][$ypos-1]<>"" Then return _output("Kann nicht nach Norden gehen, Mensch steht gegenüber.")
    $board[$xpos][$ypos-1]="M"
    $board[$xpos][$ypos]=""
    $players[$who][1]=$ypos-1
    _output("Gehe ein Feld nach Norden...")
    _output("Bin jetzt auf " & $players[$who][0] & ":" & $players[$who][1])
    Case "south"
    If $ypos=9 Then return _output("Kann nicht nach Süden gehen, Kartenrand erreicht.")
    If $board[$xpos][$ypos+1]<>"" Then return _output("Kann nicht nach Süden gehen, Mensch steht gegenüber.")
    $board[$xpos][$ypos+1]="M"
    $board[$xpos][$ypos]=""
    $players[$who][1]=$ypos+1
    _output("Gehe ein Feld nach Süden...")
    _output("Bin jetzt auf " & $players[$who][0] & ":" & $players[$who][1])
    Case "east"
    If $xpos=9 Then return _output("Kann nicht nach Osten gehen, Kartenrand erreicht.")
    If $board[$xpos+1][$ypos]<>"" Then return _output("Kann nicht nach Osten gehen, Mensch steht gegenüber.")
    $board[$xpos+1][$ypos]="M"
    $board[$xpos][$ypos]=""
    $players[$who][0]=$xpos+1
    _output("Gehe ein Feld nach Osten...")
    _output("Bin jetzt auf " & $players[$who][0] & ":" & $players[$who][1])
    Case "west"
    If $xpos=0 Then return _output("Kann nicht nach Westen gehen, Kartenrand erreicht.")
    If $board[$xpos-1][$ypos]<>"" Then return _output("Kann nicht nach Westen gehen, Mensch steht gegenüber.")
    $board[$xpos-1][$ypos]="M"
    $board[$xpos][$ypos]=""
    $players[$who][0]=$xpos-1
    _output("Gehe ein Feld nach Westen...")
    _output("Bin jetzt auf " & $players[$who][0] & ":" & $players[$who][1])
    Case Else
    _output("falsche Eingabe. go [north|south|east|west]")
    EndSwitch
    _look()
    EndFunc
    Func _tryJump($where)
    $xpos=$players[$IAmNr][0]
    $ypos=$players[$IAmNr][1]
    Switch $where
    Case "north"
    If $ypos<=1 Then return _output("Kann nicht nach Norden springen, Kartenrand erreicht.")
    If $board[$xpos][$ypos-2]<>"" Then return _output("Kann nicht nach Norden springen, Mensch steht auf dem Zielfeld")
    $board[$xpos][$ypos-2]="M"
    $board[$xpos][$ypos]=""
    $players[$IAmNr][1]=$ypos-2
    _output("Springe zwei Felder nach Norden...")
    _output("Bin jetzt auf " & $players[$IAmNr][0] & ":" & $players[$IAmNr][1])
    Case "south"
    If $ypos>=8 Then return _output("Kann nicht nach Süden springen, Kartenrand erreicht.")
    If $board[$xpos][$ypos+2]<>"" Then return _output("Kann nicht nach Süden springen, Mensch steht gegenüber.")
    $board[$xpos][$ypos+2]="M"
    $board[$xpos][$ypos]=""
    $players[$IAmNr][1]=$ypos+2
    _output("Springe zwei Felder nach Süden...")
    _output("Bin jetzt auf " & $players[$IAmNr][0] & ":" & $players[$IAmNr][1])
    Case "east"
    If $xpos>=8 Then return _output("Kann nicht nach Osten springen, Kartenrand erreicht.")
    If $board[$xpos+2][$ypos]<>"" Then return _output("Kann nicht nach Osten springen, Mensch steht gegenüber.")
    $board[$xpos+2][$ypos]="M"
    $board[$xpos][$ypos]=""
    $players[$IAmNr][0]=$xpos+2
    _output("Springe zwei Felder nach Osten...")
    _output("Bin jetzt auf " & $players[$IAmNr][0] & ":" & $players[$IAmNr][1])
    Case "west"
    If $xpos<=1 Then return _output("Kann nicht nach Westen springen, Kartenrand erreicht.")
    If $board[$xpos-2][$ypos]<>"" Then return _output("Kann nicht nach Westen springen, Mensch steht gegenüber.")
    $board[$xpos-2][$ypos]="M"
    $board[$xpos][$ypos]=""
    $players[$IAmNr][0]=$xpos-2
    _output("Springe zwei Felder nach Westen...")
    _output("Bin jetzt auf " & $players[$IAmNr][0] & ":" & $players[$IAmNr][1])
    Case Else
    _output("falsche Eingabe. go [north|south|east|west]")
    EndSwitch
    _look()
    EndFunc
    Func _tryShoot($who=$IAmNr)
    $dir=$players[$who][2]
    $xpos=$players[$who][0]
    $ypos=$players[$who][1]
    Switch $dir
    Case "n"
    For $i=0 To UBound($players,1)-1
    If $i=$who Then ContinueLoop
    If $players[$i][0]=$xpos And $players[$i][1] < $ypos Then
    $damage=20- ($ypos - $players[$i][1]); 20 could be the weapon
    $players[$i][3] -= $damage
    If $players[$i][3] > 0 Then
    _output("Spieler " & $who & ": Spieler getroffen und ihm " & $damage & " Schadenspunkte zugefügt. (Noch " & $players[$i][3] & " Lebenspunkte)")
    Else
    If $who=$IAmNr Then
    _output("Spieler getötet. Spiel gewonnen.")
    _Win()
    Else
    _loose()
    EndIf

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

    EndIf
    EndIf
    Next
    Case "s"
    For $i=0 To UBound($players,1)-1
    If $i=$IAmNr Then ContinueLoop
    If $players[$i][0]=$xpos And $players[$i][1] > $ypos Then
    $damage=20- ($players[$i][1] - $ypos)
    $players[$i][3] -= $damage
    If $players[$i][3] > 0 Then
    _output("Spieler getroffen und ihm " & $damage & " Schadenspunkte zugefügt. (Noch " & $players[$i][3] & " Lebenspunkte)")
    Else
    If $who=$IAmNr Then
    _output("Spieler getötet. Spiel gewonnen.")
    _Win()
    Else
    _loose()
    EndIf
    EndIf
    EndIf
    Next
    Case "w"
    For $i=0 To UBound($players,1)-1
    If $i=$IAmNr Then ContinueLoop
    If $players[$i][1]=$ypos And $players[$i][0] < $ypos Then
    $damage=20- ($xpos - $players[$i][0])
    $players[$i][3] -= $damage
    If $players[$i][3] > 0 Then
    _output("Spieler getroffen und ihm " & $damage & " Schadenspunkte zugefügt. (Noch " & $players[$i][3] & " Lebenspunkte)")
    Else
    If $who=$IAmNr Then
    _output("Spieler getötet. Spiel gewonnen.")
    _Win()
    Else
    _loose()
    EndIf
    EndIf
    EndIf
    Next
    Case "e"
    For $i=0 To UBound($players,1)-1
    If $i=$IAmNr Then ContinueLoop
    If $players[$i][1]=$ypos And $players[$i][0] > $ypos Then
    $damage=20- ($players[$i][0] - $ypos)
    $players[$i][3] -= $damage
    If $players[$i][3] > 0 Then
    _output("Spieler getroffen und ihm " & $damage & " Schadenspunkte zugefügt. (Noch " & $players[$i][3] & " Lebenspunkte)")
    Else
    If $who=$IAmNr Then
    _output("Spieler getötet. Spiel gewonnen.")
    _Win()
    Else
    _loose()
    EndIf
    EndIf
    EndIf
    Next
    EndSwitch
    EndFunc
    Func _tryTurn($where,$who=$IAmNr)
    local $dir=""
    Switch $where
    Case "north"
    $dir="n"
    Case "south"
    $dir="s"
    Case "east"
    $dir="e"
    Case "west"
    $dir="w"
    Case Else
    Return _output("Keine gültige Himmelsrichtung. turn [norht|south|east|west]")
    EndSwitch
    $players[$who][2]=$dir
    _look()
    EndFunc
    Func _setHumansToBoard()
    For $i=0 To UBound($players,1)-1
    $board[$players[$i][0]][$players[$i][1]]="M"
    Next
    EndFunc
    Func _look()
    $dir=$players[$IAmNr][2]
    $xpos=$players[$IAmNr][0]
    $ypos=$players[$IAmNr][1]
    Switch $dir
    Case "n"
    If $ypos = 0 Then Return
    If $board[$xpos][$ypos-1]<>"M" Then return
    case "s"
    If $ypos = 9 Then Return
    If $board[$xpos][$ypos+1]<>"M" Then return
    Case "e"
    If $xpos = 9 Then Return
    If $board[$xpos+1][$ypos]<>"M" Then return
    Case "w"
    If $xpos = 0 Then Return
    If $board[$xpos-1][$ypos]<>"M" Then return
    EndSwitch
    _output("Ein Mensch steht dir gegenüber.")
    EndFunc
    Func _Win()
    MsgBox(64,"Super","Du hast gewonnen")
    EndFunc
    Func _clearBoard()
    For $i=0 To 9
    For $j=0 To 9
    $board[$i][$j]=""
    Next
    Next
    EndFunc
    Func _help()
    _output("Mögliche Befehle: go, shoot, turn, jump, help")
    _output("go|turn|jump [himmelsrichtung englisch]: Läuft/Dreht/Springt in die Richtung")
    _output("shoot: Schießt")
    EndFunc
    Func _opponentMoves()
    Dim $directions[4]=["north","south","east","west"]
    Switch Random(1,3,1)
    Case 1
    _tryShoot($IAmNr+1)
    Case 2
    _tryTurn($directions[Random(0,3,1)],$IAmNr+1)
    Case 3
    _tryGo($directions[Random(0,3,1)],$IAmNr+1)
    EndSwitch
    EndFunc
    func _loose()
    MsgBox(0,"","You loose")
    EndFunc

    [/autoit]

    Inspiriert von:
    [Blockierte Grafik: http://imgs.xkcd.com/comics/pwned.png]

  • Outlook verscripten

    • L3viathan
    • 25. November 2009 um 12:22

    Richtig.
    Vielleicht hilft dir die Outlook-UDF, ansonsten kannst du Outlook per

    [autoit]

    ControlClick
    ControlCommand

    [/autoit]

    steuern

  • Outlook verscripten

    • L3viathan
    • 25. November 2009 um 12:01

    Als erstes:
    Es existiert eine vom deutschen AutoIt-Forum übersetzte Hilfedatei: http://translation.autoit.de/autoitinfo/hil…nd-16_09_09.zip
    Dort sind alle AutoIt-Befehle erklärt. Wenn du das mit Mausklicks machen möchtest, dann also

    [autoit]

    MouseClick
    MouseMove
    ; etc...

    [/autoit]

    edit: @Mods: bitte verschieben

  • Automatischer Logon bei XP

    • L3viathan
    • 25. November 2009 um 11:58

    das ganze mal als Blockbild:

    Dateien

    blockbild.jpg 97,74 kB – 0 Downloads
  • Automatischer Logon bei XP

    • L3viathan
    • 24. November 2009 um 23:13

    Nein, geht so nicht.

    Folgende Lösung:
    AutoIt-Skript startet, wird remote gesteuert. Stellt Registrykey ein, verannlasst neustart, stellt sich vorher in AutoStart.
    Neustart, skript nimmt registry-key raus, löscht sich aus autostart und macht, was es soll..

  • Pixel in cm?

    • L3viathan
    • 24. November 2009 um 22:43

    Die dpi-Zahl wird doch ermittelt!

  • [Suche]Namen für Counter Strike Source Clan/Server

    • L3viathan
    • 23. November 2009 um 18:01

    BKS
    Böse Killerspiele-Spieler

  • Kleine Toolsammlung

    • L3viathan
    • 22. November 2009 um 21:26

    Dafür gibt es ja die Überschrift "Skripte". Das ist m.E. nach eindeutig genug.

  • AutChat - Chat für Autoit'ler

    • L3viathan
    • 21. November 2009 um 19:29

    Jautois: Kommst du an die PHP-Einstellungen ran? Da müsstest du das umwandeln von < und > abstellen können.
    Ansonsten nur Maskierung: < = &lt; ...

  • Soundlänge aktualisieren

    • L3viathan
    • 21. November 2009 um 14:06

    Dann bitte auf gelöst stellen:)

  • Namenloses Spiel

    • L3viathan
    • 21. November 2009 um 13:50

    Noch was: Lagere die Level doch in irgendeiner Form aus, in externe Dateien.

  • [spiel] Autoit.de kann nicht bis 100 zählen

    • L3viathan
    • 21. November 2009 um 00:09

    Die 18 wurde zweimal geschrieben :P
    ______________________________________
    1

  • Drag & Drop für Musik-Player + GUI tranparent?

    • L3viathan
    • 20. November 2009 um 21:08

    Willkommen im Forum!
    Drag and drop:

    [autoit]

    Case $GUI_EVENT_DROPPED
    SoundPlay(@GUI_DRAGFILE)

    [/autoit]


    Transparenz:
    Die einzige Möglichkeit, die mir spontan einfällt, ist per WinGetPos und MouseGetPos ständig die Positionen zu vergleichen.

  • MsgBox - Eigene Beschriftung

    • L3viathan
    • 19. November 2009 um 23:32

    Oder so:

    Spoiler anzeigen
    [autoit]


    _MsgBox("Titel","Test","der MsgBox","Okaaay","Erbrechen")

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

    Func _MsgBox($title="",$TExt1="",$Textl2="",$BtText1="",$BtText2="")
    ;Rückgabewerte: -1=Auf X gedrückt, 1=Erster Button,2=Zweiter Button
    ;L3viathan2142
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate($title, 221, 119, 465, 342)
    $Label1 = GUICtrlCreateLabel($TExt1, 16, 24, 141, 17)
    $Label2 = GUICtrlCreateLabel($TExt2, 16, 48, 184, 17)
    $Button1 = GUICtrlCreateButton($BtTExt1, 16, 80, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton($BTTExt2, 128, 80, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Return -1
    Case $Button1
    Return 1
    Case $Button2
    Return 2
    EndSwitch
    WEnd
    EndFunc

    [/autoit]
  • MsgBox - Eigene Beschriftung

    • L3viathan
    • 19. November 2009 um 23:04

    Da musst du dir die MsgBox durch eine eigene GUI ersetzen.

  • IE.au3 - SWF steuern

    • L3viathan
    • 18. November 2009 um 20:47

    Nur mit MouseClick...

  • gettext from cmd

    • L3viathan
    • 17. November 2009 um 21:20

    vielleicht wird die konsole ja nicht vom autoit gestartet?

  • Um x Uhr Skript starten. Wie?

    • L3viathan
    • 16. November 2009 um 20:48
    [autoit]


    Dim $h = 5, $m = 30 ;5 Uhr 30
    While True
    If @hour=$h And @Min=$m Then Exitloop
    sleep(10000)
    WEnd
    ;...Rest des Programms

    [/autoit]
  • Destop-Teddybär

    • L3viathan
    • 16. November 2009 um 19:22

    Damit er auch auf inaktiven Fenstern laufen kann, brauchst du also eine Funktion à la _WinTitleBarVisible()...
    Jemand ne Idee? isVisible gibts doch glaub ich, muss nur noch die Sichrbarkeit der Titelleiste ermittelt werden...

  • Ispress Wort pc runterfahren

    • L3viathan
    • 13. November 2009 um 14:44
    Spoiler anzeigen
    [autoit]

    ; Authors: Manadar, GarryFrost
    ; Contributor: WideBoyDixon
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    #include-once
    Dim $hHook
    Dim $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
    Dim $hmod = _WinAPI_GetModuleHandle(0)
    Dim $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)
    Dim $buffer = ""
    Dim $hotstrings[1]
    Dim $hotfuncs[1]
    Dim $hWnd = GUICreate("")
    GUIRegisterMsg($WM_KEYDOWN, "_GUIKeyProc")
    ;; ========================== ;
    ; This is your actual script.
    ;; ========================== ;
    #include <HotString.au3>
    HotStringSet("runterfahren","shutdownme")
    While 1
    Sleep(10)
    WEnd
    Func shutdownme()
    Shutdown(8)
    EndFunc
    ;; ==========================
    ;; End of actual script.
    ;; The part above the start of the actual script
    ;; and below this comment
    ;; script can be put in another
    ;; file and included.
    ;; ==========================
    Func HotStringSet($hotstring, $func)
    _ArrayAdd($hotstrings, $hotstring)
    _ArrayAdd($hotfuncs, $func)
    EndFunc
    Func EvaluateKey($keycode)
    If (($keycode > 64) And ($keycode < 91)) _ ; A - Z
    Or (($keycode > 47) And ($keycode < 58)) Then ; 0 - 9
    $buffer &= Chr($keycode)
    Print($buffer)
    $a = _ArraySearch($hotstrings, $buffer)
    If ( $a >= 0 ) Then
    Call($hotfuncs[$a])
    EndIf
    ElseIf ($keycode > 159) And ($keycode < 164) Then
    Return
    Else
    $buffer = ""
    EndIf
    EndFunc ;==>EvaluateKey
    Func _GUIKeyProc($hWnd, $Msg, $wParam, $lParam)
    EvaluateKey(Number($wParam))
    EndFunc
    ;===========================================================
    ; callback function. This function must return as quickly as possible or it will stall and block user input ;===========================================================
    Func _KeyProc($nCode, $wParam, $lParam)
    Local $tKEYHOOKS
    $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
    If $nCode < 0 Then
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    EndIf
    If $wParam = $WM_KEYDOWN Then
    $vkKey = DllStructGetData($tKEYHOOKS, "vkCode")
    _WinAPI_PostMessage($hWnd, $WM_KEYDOWN, $vkKey, 0)
    EndIf
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    EndFunc ;==>_KeyProc
    Func Print($s)
    ConsoleWrite($s & @CRLF)
    EndFunc
    Func OnAutoItExit()
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hStub_KeyProc)
    EndFunc ;==>OnAutoItExit

    [/autoit]

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™