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

Beiträge von teamnoobPDB

  • GDI+ ... wie ich es liebe!

    • teamnoobPDB
    • 6. Januar 2013 um 21:30

    Okay danke Andy :D
    Ich hoffe, dass das hilft den Fehler zu finden :)

    So hier das Zip-Archiv mit allen Dateien:

    Dateien

    TA.zip 154,27 kB – 271 Downloads
  • GDI+ ... wie ich es liebe!

    • teamnoobPDB
    • 6. Januar 2013 um 12:38

    Also ich habe es jetzt geschafft das alles gezeichnet wird.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.8.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    ID-Liste

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

    -9 => @Error
    -3 => Monster 3
    -2 => Monster 2
    -1 => Monster 1
    0 => Leeres Feld/Gras
    1 => Spieler Position
    2 => Wand/Fels/Berg
    3 => Spieler Upgrade
    4 => Item
    5 => Quest

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

    #ce ----------------------------------------------------------------------------
    #include <GuiConstants.au3>
    #include <GDIPlus.au3>
    #include <Array.au3>

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

    Global $Map_Line1,$Map_Line2,$Map_Line3,$Map_Line4,$Map_Line5,$Map_Line6,$Map_Line7
    Global $player, $stein, $gras

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

    $GuiWidth = 400
    $GuiHeight = 500
    $Width = 100
    $Height = 100
    $PlayerPosX = 10
    $PlayerPosY = 10

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

    Dim $aMap[$Width][$Height]
    Dim $Show[7][7]

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

    If FileExists(@ScriptDir & "\Map_X.ini") == 1 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = IniRead("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",0)
    Next
    Next
    Else
    If FileExists(@ScriptDir & "\Map_X.ini") == 0 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = 0
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",$aMap[$i][$i2])
    Next
    Next
    For $i = 0 To $Width - 1 Step 1
    $aMap[$i][0] = 2
    $aMap[$i][$Height - 1] = 2
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][0]",$aMap[$i][0])
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $Height - 1 & "]",$aMap[$i][$Height - 1])
    Next
    For $i = 0 To $Height - 1 Step 1
    $aMap[0][$i] = 2
    $aMap[$Width - 1][$i] = 2
    IniWrite("Map_X.ini","Map","$aMap[0][" & $i & "]",$aMap[0][$i])
    IniWrite("Map_X.ini","Map","$aMap[" & $Width - 1 & "][" & $i & "]",$aMap[$Width - 1][$i])
    Next
    EndIf
    EndIf

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

    $aMap[$PlayerPosX][$PlayerPosY] = 1

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

    _GDIPlus_Startup()

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

    $hGui = GUICreate("MyGui",$GuiWidth,$GuiHeight)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

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

    $Bitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphics)
    $Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

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

    $hBtn_W = GUICtrlCreateButton(ChrW(8593),190,400,30,30)
    $hBtn_A = GUICtrlCreateButton(ChrW(8592),160,430,30,30)
    $hBtn_S = GUICtrlCreateButton(ChrW(8595),190,460,30,30)
    $hBtn_D = GUICtrlCreateButton(ChrW(8594),220,430,30,30)

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

    $hLabel_Main = GUICtrlCreateLabel("test",10,10,380,290)
    GUICtrlSetState($hLabel_Main,$GUI_HIDE)

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

    GUISetState(@SW_SHOW)

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

    $gras = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\gras.png")
    $stein = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\stein.png")
    $player = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\player.png")

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

    _Draw($hGraphics)

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

    While Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][0])
    _GDIPlus_ImageDispose($Show[$i][1])
    _GDIPlus_ImageDispose($Show[$i][2])
    _GDIPlus_ImageDispose($Show[$i][3])
    _GDIPlus_ImageDispose($Show[$i][4])
    _GDIPlus_ImageDispose($Show[$i][5])
    _GDIPlus_ImageDispose($Show[$i][6])
    Next
    _GDIPlus_GraphicsClear($hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($Bitmap)
    _GDIPlus_Shutdown()
    Exit
    Case $hBtn_A
    _Btn_A()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_D
    _Btn_D()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_S
    _Btn_S()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_W
    _Btn_W()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    EndSwitch
    ToolTip("X:" & $PlayerPosX & @CRLF & "Y:" & $PlayerPosY & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & $aMap[$PlayerPosX][$PlayerPosY - 1] & $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY] & $aMap[$PlayerPosX][$PlayerPosY] & $aMap[$PlayerPosX + 1][$PlayerPosY] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & $aMap[$PlayerPosX][$PlayerPosY + 1] & $aMap[$PlayerPosX + 1][$PlayerPosY + 1])
    WEnd

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

    Func _Draw($hGraphic)
    Local $Str2, $X = 0, $Y = 0
    _Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    For $i2 = 0 To 6 Step 1
    Switch $i2
    Case 0
    $Y = 25
    Case 1
    $Y = 75
    Case 2
    $Y = 125
    Case 3
    $Y = 175
    Case 4
    $Y = 225
    Case 5
    $Y = 275
    Case 6
    $Y = 325
    EndSwitch
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][$i2])
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Str2 = -9
    Else
    If $PlayerPosY - 3 + $i2 < 0 Or $PlayerPosY - 3 + $i2 > $Height - 1 Then
    $Str2 = -9
    Else
    $Str2 = $aMap[$PlayerPosX - 3 + $i][$PlayerPosY - 3 + $i2]
    EndIf
    EndIf
    Switch $i
    Case 0
    $X = 25
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 1
    $X = 75
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 2
    $X = 125
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 3
    $X = 175
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 4
    $X = 225
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 5
    $X = 275
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 6
    $X = 325
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    EndSwitch
    Next
    Next
    _GDIPlus_GraphicsDrawImage($hGraphics,$Bitmap,0,0)
    EndFunc

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

    Func _Draw_Image($hG, $s, $var, $x, $y)
    If $s == 0 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$gras,$x,$y,50,50)
    Else
    If $s == 1 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$player,$x,$y,50,50)
    Else
    If $s == 2 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$stein,$x,$y,50,50)
    EndIf
    EndIf
    EndIf
    EndFunc

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

    Func _Btn_W()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_S()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_D()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_A()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Check_Button($Bt1, $Bt2, $Bt3, $Bt4)
    If $PlayerPosX == 1 Then
    GUICtrlSetState($Bt2,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt2,$GUI_ENABLE)
    EndIf
    If $PlayerPosX == $Width - 2 Then
    GUICtrlSetState($Bt4,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt4,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == 1 Then
    GUICtrlSetState($Bt1,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt1,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == $Height - 2 Then
    GUICtrlSetState($Bt3,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt3,$GUI_ENABLE)
    EndIf
    If $PlayerPosY - 3 < 0 Then
    $Map_Line1 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line1 = $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3]
    EndIf
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY - 2 < 0 Then
    $Map_Line2 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line2 = $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2]
    EndIf
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line3 = $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1]
    EndIf
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line4 = $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0]
    EndIf
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line5 = $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1]
    EndIf
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    EndIf
    If $PlayerPosY + 2 > $Height - 1 Then
    $Map_Line6 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line6 = $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2]
    EndIf
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY + 3 > $Height - 1 Then
    $Map_Line7 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line7 = $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3]
    EndIf
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    EndIf
    EndIf
    GUICtrlSetData($hLabel_Main,$Map_Line1 & @CRLF & _
    $Map_Line2 & @CRLF & _
    $Map_Line3 & @CRLF & _
    $Map_Line4 & @CRLF & _
    $Map_Line5 & @CRLF & _
    $Map_Line6 & @CRLF & _
    $Map_Line7 & @CRLF)
    EndFunc

    [/autoit]


    Nun hab ich aber 2 Probleme:
    1. Die Grafik flackert trotz Buffer.
    2. Das Skript stürzt gerne ab oder hängt sich auf wenn ich es beenden will oder mich manchmal einer Wand nähere.

    Könnt ihr mir vlt. da helfen?

  • GDI+ ... wie ich es liebe!

    • teamnoobPDB
    • 5. Januar 2013 um 22:54

    Klappe die 2.!

    Ich habe jetzt folgendes Skript relativ weit gebracht.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.8.1
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    ID-Liste

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

    -3 => Monster 3
    -2 => Monster 2
    -1 => Monster 1
    0 => Leeres Feld/Gras
    1 => Spieler Position
    2 => Wand/Fels/Berg
    3 => Spieler Upgrade
    4 => Item
    5 => Quest

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

    #ce ----------------------------------------------------------------------------
    #include <GuiConstants.au3>
    #include <GDIPlus.au3>

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

    Global $Map_Line1,$Map_Line2,$Map_Line3,$Map_Line4,$Map_Line5,$Map_Line6,$Map_Line7
    Global $player, $stein, $gras

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

    $GuiWidth = 400
    $GuiHeight = 500
    $Width = 100
    $Height = 100
    $PlayerPosX = 49
    $PlayerPosY = 49

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

    Dim $aMap[$Width][$Height]
    Dim $Show[7][7]

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

    If FileExists(@ScriptDir & "\Map_X.ini") == 1 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = IniRead("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",0)
    Next
    Next
    Else
    If FileExists(@ScriptDir & "\Map_X.ini") == 0 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = 0
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",$aMap[$i][$i2])
    Next
    Next
    For $i = 0 To $Width - 1 Step 1
    $aMap[$i][0] = 2
    $aMap[$i][$Height - 1] = 2
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][0]",$aMap[$i][0])
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $Height - 1 & "]",$aMap[$i][$Height - 1])
    Next
    For $i = 0 To $Height - 1 Step 1
    $aMap[0][$i] = 2
    $aMap[$Width - 1][$i] = 2
    IniWrite("Map_X.ini","Map","$aMap[0][" & $i & "]",$aMap[0][$i])
    IniWrite("Map_X.ini","Map","$aMap[" & $Width - 1 & "][" & $i & "]",$aMap[$Width - 1][$i])
    Next
    EndIf
    EndIf

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

    $aMap[$PlayerPosX][$PlayerPosY] = 1

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

    _GDIPlus_Startup()

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

    $hGui = GUICreate("MyGui",$GuiWidth,$GuiHeight)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

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

    ;$Bitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphics)
    ;$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

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

    $hBtn_W = GUICtrlCreateButton(ChrW(8593),190,400,30,30)
    $hBtn_A = GUICtrlCreateButton(ChrW(8592),160,430,30,30)
    $hBtn_S = GUICtrlCreateButton(ChrW(8595),190,460,30,30)
    $hBtn_D = GUICtrlCreateButton(ChrW(8594),220,430,30,30)

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

    $hLabel_Main = GUICtrlCreateLabel("test",10,10,380,290)
    ;GUICtrlSetState($hLabel_Main,$GUI_HIDE)

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

    GUISetState(@SW_SHOW)

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

    $gras = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\gras.png")
    $stein = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\stein.png")
    $player = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\player.png")

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

    _Draw($hGraphics)

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

    While Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsClear($hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics)
    ;_GDIPlus_BitmapDispose($Bitmap)
    _GDIPlus_Shutdown()
    Exit
    Case $hBtn_A
    _Btn_A()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_D
    _Btn_D()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_S
    _Btn_S()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_W
    _Btn_W()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    EndSwitch
    ToolTip("X:" & $PlayerPosX & @CRLF & "Y:" & $PlayerPosY & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & $aMap[$PlayerPosX][$PlayerPosY - 1] & $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY] & $aMap[$PlayerPosX][$PlayerPosY] & $aMap[$PlayerPosX + 1][$PlayerPosY] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & $aMap[$PlayerPosX][$PlayerPosY + 1] & $aMap[$PlayerPosX + 1][$PlayerPosY + 1])
    WEnd

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

    Func _Draw($hGraphic)
    Local $Str, $Str2
    _Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][0])
    $Str = StringTrimLeft($Map_Line1,$i)
    $Str2 = StringTrimRight($Str, 6 - $i)
    If StringLen($Str2) > 1 Then Return -1
    Switch $i
    Case 0
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,25,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,25,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,25,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 1
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,75,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,75,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,75,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 2
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,125,25,50,50)
    MsgBox(0,"",$i & " gras")
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,125,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,125,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 3
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,175,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,175,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,175,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 4
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,225,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,225,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,225,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 5
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,275,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,275,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,275,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 6
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,325,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,325,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,325,25,50,50)
    EndIf
    EndIf
    EndIf
    EndSwitch
    Next
    ;_GDIPlus_GraphicsDrawImage($hGraphics,$Buffer,0,0)
    EndFunc

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

    Func _Btn_W()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_S()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_D()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Btn_A()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

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

    Func _Check_Button($Bt1, $Bt2, $Bt3, $Bt4)
    If $PlayerPosX == 1 Then
    GUICtrlSetState($Bt2,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt2,$GUI_ENABLE)
    EndIf
    If $PlayerPosX == $Width - 2 Then
    GUICtrlSetState($Bt4,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt4,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == 1 Then
    GUICtrlSetState($Bt1,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt1,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == $Height - 2 Then
    GUICtrlSetState($Bt3,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt3,$GUI_ENABLE)
    EndIf
    If $PlayerPosY - 3 < 0 Then
    $Map_Line1 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line1 = $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3]
    EndIf
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY - 2 < 0 Then
    $Map_Line2 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line2 = $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2]
    EndIf
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line3 = $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1]
    EndIf
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line4 = $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0]
    EndIf
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line5 = $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1]
    EndIf
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    EndIf
    If $PlayerPosY + 2 > $Height - 1 Then
    $Map_Line6 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line6 = $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2]
    EndIf
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY + 3 > $Height - 1 Then
    $Map_Line7 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line7 = $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3]
    EndIf
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    EndIf
    EndIf
    GUICtrlSetData($hLabel_Main,$Map_Line1 & @CRLF & _
    $Map_Line2 & @CRLF & _
    $Map_Line3 & @CRLF & _
    $Map_Line4 & @CRLF & _
    $Map_Line5 & @CRLF & _
    $Map_Line6 & @CRLF & _
    $Map_Line7 & @CRLF)
    EndFunc

    [/autoit]


    Nun hab ich aber das Problem, dass wenn ich eine Button drücke möchte ich dass die Aktuelle Map mit allen "Hindernissen" dargestellt wird.
    Wenn ich einen Button drücke führe ich die Funktion _Draw() aus um anhand der _CheckButtons Funktion, die die Map 7 Punkte um den Spieler "Berechnet", alle "Hindernisse" herauszufinden und dann darstellen zu lassen. Ich habe das jetzt nur für die erste Reihe der 7x7 fläche gemacht, sprich die als X markierte Stellen:
    XXXXXXX
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    Nur wird das alles nicht auf die Grafik gezeichnet. Ich weiß nicht woran es liegen könnte.

    VIelen Dank für alle Hilfe.

  • GDIPlus und Sonderzeichen...

    • teamnoobPDB
    • 5. Januar 2013 um 21:39

    Oh ja hab ich am Ende vergessen :D

    Hab mein Pc mal neu gestartet jetz funktionierts komischerweise :D

    Aber trotzdem danke ;)

  • GDIPlus und Sonderzeichen...

    • teamnoobPDB
    • 5. Januar 2013 um 21:29

    Halli Hallo,
    ich habe folgendes Skript entwickelt, in dem ich vorher kein GDIPlus verwendete. Dann habe ich GDIPlus eingefügt und seitdem funktionieren die Sonderzeichen auf den Buttons nicht mehr. Kann das an GDIPlus liegen? Wenn ja gibt es alternativen?

    [autoit]


    #include <GuiConstants.au3>
    #include <GDIPlus.au3>

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

    $GuiWidth = 400
    $GuiHeight = 400

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

    _GDIPlus_Startup()

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

    $hGui = GUICreate("Test",$GuiWidth,$GuiHeight)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)

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

    $Bitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphic)
    $Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

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

    $hBtn_W = GUICtrlCreateButton(ChrW(8593),190,300,30,30)
    $hBtn_A = GUICtrlCreateButton(ChrW(8592),160,330,30,30)
    $hBtn_S = GUICtrlCreateButton(ChrW(8595),190,360,30,30)
    $hBtn_D = GUICtrlCreateButton(ChrW(8594),220,330,30,30)

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

    $hLabel_Main = GUICtrlCreateLabel("test",10,10,380,290)
    GUICtrlSetState($hLabel_Main,$GUI_HIDE)

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

    GUISetState(@SW_SHOW)

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

    While Sleep(10)
    Switch GuigetMsg()
    Case $GUI_EVENT_CLOSE
    _GDIPlus_Shutdown()
    Exit
    EndSwitch
    Wend

    [/autoit]
  • Weihnachten Script Hilfe

    • teamnoobPDB
    • 7. Dezember 2012 um 23:58

    Hey remora,

    if you want to change the background you should try it with this here:

    [autoit]

    $Wallpaper = "...\blabla.jpg" ; for example
    $Stile = "Fit" ; yeah .. fit should say enough
    Select
    Case $Stile="Center"
    $Stile="0"
    $Stile2="0"
    Case $Stile="Fit"
    $Stile="1"
    $Stile2="0"
    Case $Stile="Stretch"
    $Stile="2"
    $Stile2="0"
    Case $Stile="Fill"
    $Stile="-1"
    $Stile2="0"
    Case $Stile="Tile"
    $Stile="0"
    $Stile2="1"
    EndSelect

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

    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $Stile)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $Stile2)
    DllCall("user32.dll", "int", "SystemParametersInfo","uint",20,"uint",0,"str",$Wallpaper,"uint",3)

    [/autoit]
  • GUI-Inhalt an GUI Anpassen

    • teamnoobPDB
    • 11. November 2012 um 00:10

    Habs gerade mal ausprobiert aber funktioniert nicht.
    Vlt. bin ich einfach nur zu doof ums richtig einzubauen ;)
    Aber trotzdem danke für die Hilfe :D
    EDIT: Okay ich war zu doof :D Habs jetzt hinbekommen.

  • GUI-Inhalt an GUI Anpassen

    • teamnoobPDB
    • 11. November 2012 um 00:00

    Hallo,
    ich habe folgendes Problem:
    Ich habe mir eine GUI angefertigt:

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GuiConstants.au3>

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

    $hGui = GUICreate("Test",100,175,-1,-1,$WS_POPUP)
    WinSetTrans($hGui,"",0)
    GUISetState(@SW_SHOW)

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

    For $i = 0 To 525 Step 1
    $i2 = $i
    If $i2 > 255 Then
    $i2 = 255
    EndIf
    WinSetTrans($hGui,"",$i2)
    WinMove($hGui,"",@DesktopWIdth / 2 - 50 - $i * 0.35,@DesktopHeight / 2 - 87.5 - $i * 0.5,100 + $i * 0.75,175 + $i)
    Next

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

    while Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    For $i = 525 To 0 Step -1
    $i2 = $i
    If $i2 > 255 Then
    $i2 = 255
    EndIf
    WinSetTrans($hGui,"",$i2)
    WinMove($hGui,"",@DesktopWIdth / 2 - 50 - $i * 0.35,@DesktopHeight / 2 - 87.5 - $i * 0.5,100 + $i * 0.75,175 + $i)
    Next
    Exit
    EndSwitch
    WEnd

    [/autoit]


    Nun möchte ich das auf dieser Gui mehrere Buttons dargestell werden und vlt. noch ein Input etc.
    Auf jeden fall gibt es da die möglichkeit alles per hand zu machen. Aber da ich zu faul bin das alles zu machen wollte ich mal fragen wie man es viel eleganter machen könnte dass die Buttons und das Inputfeld sich der Animation "anpassen".
    Sprich wenn die GUI angezeigt wird sollen die Buttons schon zu sehen sein aber sich dann der Endgültigen größe anpassen.

  • ModernMunu.au3 & Hintergrund ändern mit DLL's

    • teamnoobPDB
    • 20. Oktober 2012 um 20:50

    Hallo liebe Freunde,

    ich habe folgendes Problem:
    ich habe mir mit der ModernMenu UDF ein Traymenü erstellt aus dem ich meine Aero Farbe und mein Hintergrund ändern kann.
    Erstes funktioniert auch Prima! Nur den Hintergrund kann ich irgendwie nicht ändern :/
    Hier mein Code:

    Spoiler anzeigen
    [autoit]

    #include <GuiConstants.au3>
    #include <TreeViewConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <Constants.au3>
    #include <Misc.au3>
    #include <ModernMenu.au3>

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

    Opt("TrayIconHide",1)
    Opt("TrayAutoPause",0)
    Opt("TrayMenuMode",1)

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

    Global Const $hDwmApiDll = DllOpen("dwmapi.dll")
    Global Const $version = "v.1.0026"
    Global Const $tagCOLORIZATIONPARAMS = 'dword Color;dword AftGlow;uint Intensity;uint AftGlowBal;uint BlurBal;uint GlassReflInt; uint Opaque'

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

    $traymenu = _TrayIconCreate("Mooody's Stimmungs-Anpasser " & $version, @ScriptDir & "\Icons\Images.ico")
    _TrayIconSetClick(-1, 16)
    _TrayIconSetState() ; Show the tray icon

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

    $nTrayMenu1 = _TrayCreateContextMenu() ; is the same like _TrayCreateContextMenu(-1) or _TrayCreateContextMenu($nTrayIcon1)
    $nSideItem3 = _CreateSideMenu($nTrayMenu1)

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

    $traymenu1_00 = _TrayCreateMenu("Stimmungen")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\dark-mood.ico")
    ;-----------------------------------------------------------------------
    $traymenu2_00 = _TrayCreateMenu("Bildposition")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\fichier-images-PNG-v2.ico")
    ;-----------------------------------------------------------------------
    $traymenu2_01 = _TrayCreateItem("Gestreckt",$traymenu2_00)
    $traymenu2_02 = _TrayCreateItem("Gefüllt",$traymenu2_00)
    $traymenu2_03 = _TrayCreateItem("Angepasst",$traymenu2_00)
    $traymenu2_04 = _TrayCreateItem("Nebeneinander",$traymenu2_00)
    $traymenu2_05 = _TrayCreateItem("Zentriert",$traymenu2_00)

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

    ;-----------------------------------------------------------------------
    _TrayCreateItem("")
    ;-----------------------------------------------------------------------
    $traymenu3_00 = _TrayCreateItem("Standard Wiederherstellen")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Folders-OS-System-Restore-Metro.ico")
    $traymenu4_00 = _TrayCreateItem("Über")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Actions-help-about.ico")
    ;-----------------------------------------------------------------------
    _TrayCreateItem("")
    ;-----------------------------------------------------------------------
    $traymenu5_00 = _TrayCreateItem("Optionen")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\options.ico")
    ;-----------------------------------------------------------------------
    _TrayCreateItem("")
    ;-----------------------------------------------------------------------
    $traymenu6_00 = _TrayCreateItem("Beenden")
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Actions-window-close.ico")
    ;-----------------------------------------------------------------------
    $traymenu1_01 = _TrayCreateItem("Standard",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Adobe-Acrobat-Standard.ico")
    $traymenu1_02 = _TrayCreateItem("Traurig",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Emotes-face-sad.ico")
    $traymenu1_03 = _TrayCreateItem("Fröhlich",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Emotes-face-smile-big.ico")
    $traymenu1_04 = _TrayCreateItem("Verliebt",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\love-heart.ico")
    $traymenu1_05 = _TrayCreateItem("Verletzt",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\You-make-me-hurt.ico")
    $traymenu1_06 = _TrayCreateItem("Windows-7",$traymenu1_00)
    _TrayItemSetIcon(-1,@ScriptDir & "\Icons\Windows.ico")

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

    _Load_Color()

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

    $Art = "Stretch"

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

    while Sleep(10)
    Switch GUIGetMsg()
    Case $traymenu1_01
    _SetStyle($Color_Standard)
    $Picture = $Pic_Standard
    _BildPos($Picture,$Art)
    Case $traymenu1_02
    _SetStyle($Color_Traurig)
    $Picture = $Pic_Traurig
    _BildPos($Picture,$Art)
    Case $traymenu1_03
    _SetStyle($Color_Frohlich)
    $Picture = $Pic_Frohlich
    _BildPos($Picture,$Art)
    Case $traymenu1_04
    _SetStyle($Color_Verliebt)
    $Picture = $Pic_Verliebt
    _BildPos($Picture,$Art)
    Case $traymenu1_05
    _SetStyle($Color_Verletzt)
    $Picture = $Pic_Verletzt
    _BildPos($Picture,$Art)
    Case $traymenu1_06
    _SetStyle($Color_Windows)
    $Picture = $Pic_Windows
    _BildPos($Picture,$Art)
    Case $traymenu2_01
    _BildPos($Picture,"Stretch")
    $Art = "Stretch"
    Case $traymenu2_02
    _BildPos($Picture,"Fill")
    $Art = "Fill"
    Case $traymenu2_03
    _BildPos($Picture,"Fit")
    $Art = "Fit"
    Case $traymenu2_04
    _BildPos($Picture,"Tile")
    $Art = "Tile"
    Case $traymenu2_05
    _BildPos($Picture,"Center")
    $Art = "Center"
    Case $traymenu3_00
    _Reset()
    Case $traymenu4_00
    _Uber()
    Case $traymenu5_00
    _Optionen()
    Case $traymenu6_00
    Exit
    EndSwitch
    WEnd

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

    Func _BildPos($Picture,$Stile)
    Select
    Case $Stile="Center"
    $Stile="0"
    $Stile2="0"
    Case $Stile="Fit"
    $Stile="1"
    $Stile2="0"
    Case $Stile="Stretch"
    $Stile="2"
    $Stile2="0"
    Case $Stile="Fill"
    $Stile="-1"
    $Stile2="0"
    Case $Stile="Tile"
    $Stile="0"
    $Stile2="1"
    EndSelect

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

    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $Stile)
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $Stile2)
    DllCall("user32.dll", "int", "SystemParametersInfo","uint",20,"uint",0,"str",$Picture,"uint",3)
    EndFunc
    Func _SetStyle($Color)
    $tCP = DllStructCreate($tagCOLORIZATIONPARAMS)
    $Ret = DllCall('dwmapi.dll', 'uint', 127, 'ptr', DllStructGetPtr($tCP))

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

    DllStructSetData($tCP, 'Color', $Color) ; Set a new color
    DllStructSetData($tCP, 'Intensity', -1) ; Set a new Intensity
    DllStructSetData($tCP, 'Opaque', 0) ; Set a new Opaque
    $Ret = DllCall('dwmapi.dll', 'uint', 131, 'ptr', DllStructGetPtr($tCP), 'uint', 0)
    EndFunc

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

    Func _Load_Color()
    Global $Color_Standard = IniRead("settings.ini","Color","$Color_Standard","0xFFFFFF")
    Global $Color_Traurig = IniRead("settings.ini","Color","$Color_Traurig","0xFEFEFE")
    Global $Color_Frohlich = IniRead("settings.ini","Color","$Color_Frohlich","0xFF9999")
    Global $Color_Verliebt = IniRead("settings.ini","Color","$Color_Verliebt","0xCC3300")
    Global $Color_Verletzt = IniRead("settings.ini","Color","$Color_Verletzt","0x000000")
    Global $Color_Windows = IniRead("settings.ini","Color","$Color_Windows","0x0066FF")

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

    Global $Pic_Standard = IniRead("settings.ini","Pic","$Pic_Standard","")
    Global $Pic_Traurig = IniRead("settings.ini","Pic","$Pic_Traurig","")
    Global $Pic_Frohlich = IniRead("settings.ini","Pic","$Pic_Frohlich","")
    Global $Pic_Verliebt = IniRead("settings.ini","Pic","$Pic_Verliebt","")
    Global $Pic_Verletzt = IniRead("settings.ini","Pic","$Pic_Verletzt","")
    Global $Pic_Windows = IniRead("settings.ini","Pic","$Pic_Windows","")

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

    Global $Stile = IniRead("settings.ini","Pic","$Stile","Center")
    EndFunc

    [/autoit]

    Vielen Dank schonmal für die Hilfe ;)

  • ComboBox probleme :(

    • teamnoobPDB
    • 6. Oktober 2012 um 22:45

    Vielen Dank Beep(1000 1000)
    Du hast mir geholfen ;)

  • ComboBox probleme :(

    • teamnoobPDB
    • 6. Oktober 2012 um 18:35

    Halli Hallo,

    ich habe da so ein Problem mit den ComboBoxen ... und zwar möchte ich eine ComboBox erstellen (noch kein Problem) dann habe ich da z.b. 3 Items in der ComboBox ("Item1|Item2|Item3")
    nun möchte ich dass eine zweite ComboBox etwas Darstellt wenn ich z.b. das Item2 Ausgewählt habe, wenn aber Item1 oder 3 Ausgewählt wird dann soll die zweite ComboBox wieder entleert und "Gesperrt" werden.
    Aber wie?

    Mein Versuch:

    [autoit]

    #include <GuiConstants.au3>
    #Include <GuiComboBoxEx.au3>

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

    Global $Markt_List, $Markt_List_2

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

    $hGui = GUICreate("GUI",800,500)
    GUISetState(@SW_SHOW)

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

    $Markt_List = GUICtrlCreateCombo("Bitte wähle ...",20,60,250,20)
    GUICtrlSetData($Markt_List,"Item1|Item2|Item3")
    $Markt_List_2 = GUICtrlCreateCombo("Bitte Wähle zuerst aus der Ersten ComboBox ...",280,60,250,20)

    $Group = GUICtrlCreateGroup("Blabla",10,40,780,450)

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

    $ListDel = 0

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

    While Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    If GUICtrlRead($Markt_List) = "Item1" Then
    If $ListDel = 0 Then
    GUICtrlSetState($Markt_List_2,$GUI_DISABLE)
    For $i = 1 To 5 Step 1
    _GUICtrlComboBoxEx_DeleteString($Markt_List_2,$i)
    Next
    $ListDel = 1
    EndIf
    Else
    If GUICtrlRead($Markt_List) = "Item3" Then
    If $ListDel = 0 Then
    GUICtrlSetState($Markt_List_2,$GUI_DISABLE)
    For $i = 1 To 5 Step 1
    _GUICtrlComboBoxEx_DeleteString($Markt_List_2,$i)
    Next
    $ListDel = 1
    EndIf
    Else
    If GUICtrlRead($Markt_List) = "Item2" Then
    GUICtrlSetState($Markt_List_2,$GUI_ENABLE)
    GUICtrlSetData($Markt_List_2,"Item1.1|Item1.2|Item1.3","Item1.1)")
    $ListDel = 0
    EndIf
    EndIf
    EndIf
    EndSwitch
    WEnd

    [/autoit]
  • 2D-Array mit Werten "befüllen"

    • teamnoobPDB
    • 16. September 2012 um 20:32

    Ich will einen Array $aMap[$Breite][$Hoehe]

    [autoit]

    Dim $aMap[$Breite][$Hoehe]

    [/autoit]


    komplett mit dem Wert 0 befüllen

    [autoit]

    For $i = 1 To $Breite Step 1
    For $i2 = 1 To $Hoehe Step 1
    $aMap[$i][$i2] = "0"
    Next
    Next

    [/autoit]


    Aber das Funktioniert nicht ...
    Später will ich den Array dann an bestimmten Stellen mit dem Wert 1 befüllen ...

    Need help please...

    Danke schonmal im Vorraus für die Hilfe

  • Array bereitet Probleme :/

    • teamnoobPDB
    • 14. September 2012 um 15:16

    Ich habe es jetzt geschafft den Array so aufzusplitten wie ich ihn brauche:

    [autoit]


    Dim $aArray[15]
    Dim $Koffer_Werte[15]
    Dim $Koffer_Gewichte[15]
    ;Einlesen der 15 Zeilen der .txt Datei in einem Array
    For $i = 0 To 14 Step 1
    ;In dem ersten Array sind alle Werte durcheinander...
    $aArray[$i] = FileReadLine("Eingabe15.txt",$i + 2)
    ;...Im 2. Array werden alle Werte der Koffer gesammelt...
    $Koffer_Werte[$i] = StringTrimRight($aArray[$i],3)
    ;...Im 3. Array werden die Gewichte aller Koffer gesammelt.
    $Koffer_Gewichte[$i] = StringTrimLeft($aArray[$i],Stringlen($aArray[$i] - 2))
    Next

    [/autoit]

    Und dann suche ich mir eine zufällige Kombination des Arrays

    [autoit]

    $Koffer_Werte[$i]

    [/autoit]


    ...für jede möglichkeit ... also wenn ich einen Kombiniere dann 2 dann 3 usw... mit...

    [autoit]


    $i2 = Random(0,14,1)
    $arWerte = _ArrayCombinations($Koffer_Werte,$i2,"+")
    $Random = Random(1,Ubound($arWerte))
    MsgBox(64,"",$arWerte[$Random])

    [/autoit]

    Jetzt möchte ich aber wenn der sich einen zufallswert ausgesucht hat das er den Zufalls wert den der Array enthält z.B.:
    96000+126000+115000
    jeweils einer Variablen zuordnet ... Sprich:
    96000 soll $1 zugeordnet werden
    126000 soll $2 zugeordnet werden
    115000 soll $3 zugeordnet werden

    Die Werte wurden ja nur aus einem Array entnommen und dann durcheinandergewürfelt und ich will nur erkennen welche Werte er genommen hat da manche Werte zweimal vorkommen und hier ist das problem...

  • Array bereitet Probleme :/

    • teamnoobPDB
    • 13. September 2012 um 21:54

    Nächste Frage:

    Kann man auch die Kombinationsmöglichkeiten summieren??

  • Array bereitet Probleme :/

    • teamnoobPDB
    • 13. September 2012 um 21:28

    Halli Hallo,

    ich habe folgendes Problem:

    Ich habe einen Array $aArray[15]

    [autoit]


    Dim $aArray[15]
    For $i = 0 To 14 Step 1
    $aArray[$i] = FileReadLine("Eingabe15.txt",$i + 2)
    Next

    [/autoit]

    Der Array ist Ordenlich mit Folgendem gefüllt:

    Spoiler anzeigen


    [0]|96000
    [1]|126000
    [2]|115000
    [3]|125000
    [4]|123000
    [5]|123000
    [6]|112000
    [7]|111000
    [8]|110000
    [9]|110000
    [10]|120000
    [11]|98000
    [12]|130000
    [13]|87000
    [14]|97000

    Wenn ich jetzt mit _ArrayCombinations() Versuche verschiedene Kombinationen des Arrays herauszufinden,
    dann kommt nur folgendes heraus bei _ArrayDisplay():
    [0] 0
    [1] 9600126000115000125000123000123000112000111000110000110000120000980001300008700097000

    Ich möchte aber herausfinden welche Kominationsmöglichkeiten es gibt der oben angegebenen Werte.

    Bitte um Hilfe
    Danke

  • TrayIcon Postition bestimmen

    • teamnoobPDB
    • 2. Juli 2012 um 16:53

    Jetzt habe ich es so gemacht :

    [autoit]


    $x = _SysTrayIconPos(@AutoItPID,1)
    $y = _SysTrayIconPos(@AutoItPID,1)

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

    MouseMove($x[0],$y[1])

    [/autoit]

    So gibt er auch Koordinaten raus aber nicht die wo das Icon liegt ...
    Ich vermute das die UDF da was falsches macht ...

  • TrayIcon Postition bestimmen

    • teamnoobPDB
    • 28. Juni 2012 um 19:02

    Ich habe mich mal da durchgelesen und habe es entweder nicht verstanden wie diese UDF funktioniert oder die UDF ist fehlerhaft und gibt keine richtigen werte aus ... Könnte mir mal jemand helfen habe das hier gemacht:

    [autoit]


    $x2 = _SysTrayIconIndex("AutoIt3",0,1); Weil der Prozess ja AutoIt3 heißt wenn ich in Autoit auf F5 drücke nicht so wie ich das Festgelegt habe ...

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

    $x = _SysTrayIconPos($x2,1)
    $y = _SysTrayIconPos($x2,1)

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

    MouseMove($x,$y)

    [/autoit]

    habe ich da was falsch gemacht? ?(?(

  • TrayIcon Postition bestimmen

    • teamnoobPDB
    • 28. Juni 2012 um 17:20

    Hallo habe da eine Frage:

    Ist es möglich ein TrayIcon zu "Lokalisieren" sprich die X und Y Coordinaten herauszufinden ... Zwecks eines Tutorials das beim ersten start des Programms automatisch ein Paar Punkte vorzeigen soll, doch dafür muss ich die Coordinaten herausfinden. Nun ist nicht jeder Monitor gleich groß und das TrayIcon ist nicht immer an derselben Stelle.

    Danke im Vorraus :rock:

  • Stimmungs-Anpasser

    • teamnoobPDB
    • 25. Juni 2012 um 15:48

    Moin Alina,
    Der Quellcode ist in der .zip enthalten :D

    In der Zip ist enthalten:
    1.Der Quellcode
    2.Der Quellcode für das Autostart Skript
    3.Der Compilierte Quellcode
    4.Der Compilierte Quellcode für das Autostart Skript
    5.Die Wallpaper
    6.Die Icons
    7.Die .ini Saves
    8.Die ModernMenu.au3

  • Stimmungs-Anpasser

    • teamnoobPDB
    • 24. Juni 2012 um 21:13

    Hier nun ein Übersichtlicher Thread zu meinem Stimmungs Anpasser.
    Ich habe das Programm etwas überarbeit (hauptsächlich Optisch), es ist aber bei der Aero Farbauswahl noch etwas Buggy nur ich kann den Fehler noch nicht finden. Trotzdem läuft das Progeramm Stabil und tut das was es machen soll.
    Wenn ihr andere Bugs finden solltet sagt mir bitte bescheid.

    Version 1.01001 Download

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™