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

Beiträge von Nakroma

  • FF.au3 kann nicht verbinden?

    • Nakroma
    • 5. Mai 2015 um 13:44

    Hey,

    Ich hab kürzlich mal versucht was mit der FF.au3 zu machen.
    Allerdings kann sie irgendwie nicht zu Firefox verbinden. MozRepl habe ich dabei über F10 -> Extras gestartet.
    FFOpen funktioniert wunderbar, allerdings hab ich danach eine If Abfrage mit _FFIsConnected und 2 Msg Boxen zum überprüfen eingebaut.
    Nach einer ewig langen Zeit, sagt es mir dann false, also das es nicht zu FF verbunden ist. Andere Befehle gehen logischerweise auch nicht.

    Mfg

  • Bilder bearbeiten und abspeichern (Simpel, nur Text)

    • Nakroma
    • 20. August 2014 um 15:37

    Perfekt, genausowas hab ich gesucht :) Danke

  • Bilder bearbeiten und abspeichern (Simpel, nur Text)

    • Nakroma
    • 19. August 2014 um 23:37

    Sooo da Google nix vernünftiges ausspuckt (oder evtl mach ichs auch nur wieder falsch).
    Ich habe vor mit ein paar Freunden aus komplett Deutschland ne DnD Gruppe aufzumachen, da alle Charakterbögengenerator Schrott sind die ich bisher gefunden hab, und ich eh mal wieder was programmieren will, hab ich mir doch gedacht das geht doch bestimmt einfach selber.

    Nun, gibt es eine Möglichkeit Bilder relativ simpel zu bearbeiten und neu abzuspeichern?

    Mfg

  • Matrix Rotation funktioniert nicht

    • Nakroma
    • 4. April 2013 um 14:04

    Hmm ich hab jemanden gefragt und der meinte man muss keinen Buffer sondern eben ein Handle rotieren :/
    Naja ok Danke,

  • Matrix Rotation funktioniert nicht

    • Nakroma
    • 4. April 2013 um 13:04

    Hey,
    Als allererstes, ich will nicht hören wie Bugschleuderig oder unsauber programmiert diese "Engine" ist, das weiß ich selber nun sehr gut^^
    Nun zu meinem eigentlichen Problem, ich will ein kleines Quadrat rotieren lassen.
    Mit dem Frontbuffer funktioniert es wunderbar, nur nicht mit dem Quadrat, ich habe versucht das Handle von ImageLoadFromFile zu rotieren, also ein Einzelgriff, quasi, das funktioniert schonmal nicht. In der aktuellen Version sieht es so aus, das ich jedes gezeichnete Rechteck rotiere, das klappt leider auch nicht. Also es wird einfach nicht rotiert, ein Fehler kommt nicht.

    Bugschleuder Engine

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <Array.au3>
    #include <File.au3>
    #include <WinAPI.au3>

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

    ; #INDEX# =======================================================================================================================
    ; Title .........: CrystalEngine - BugSchleuder Version
    ; AutoIt Version : 3.3.6.1
    ; Language ......: English
    ; Description ...: 2D Game Engine
    ; Author(s) .....: Nakroma
    ; ===============================================================================================================================

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

    Global Const $iVersion = 1.0
    Global Const $iPI = ACos(-1)

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalStart
    ; Description ...: Creates a window and startup Crystal
    ; Syntax.........: _CrystalStart($sName[, $iMaxObj[, bFullscreen[, $iWidth[, $iHeight[, $_BGColor]]]]])
    ; Parameters ....: $sName - Name of the GUI
    ; $iMaxObj - Maximum number of graphical objects
    ; $bFullscreen - [optional] Fullscreen or simple GUI
    ; $iWidth - [optional] Width of the window
    ; $iHeight - [optional] Height of the window
    ; $_BGColor - [optional] Back color of the window
    ; Return values .: Success - Array with the GUI Handle and the backbuffer
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalStart($sName, $iMaxObj = 999, $bFullscreen = False, $iWidth = 800, $iHeight = 600, $_BGColor = 0x000000)
    Global $aObj[$iMaxObj][8]
    For $i = 0 To UBound($aObj) - 1
    $aObj[$i][0] = False ; Shows if object slot is taken
    $aObj[$i][1] = "" ; Handle of the image
    $aObj[$i][2] = 0 ; X axis
    $aObj[$i][3] = 0 ; Y axis
    $aObj[$i][4] = 0 ; Width
    $aObj[$i][5] = 0 ; Height
    $aObj[$i][6] = True ; Solid
    $aObj[$i][7] = 90 ; Rotation
    Next
    If $bFullscreen = True Then
    Global $iGUI_Width = @DesktopWidth
    Global $iGUI_Height = @DesktopHeight
    $iWidth = @DesktopWidth
    $iHeight = @DesktopHeight
    GUISetCursor(16, 1)
    Else
    Global $iGUI_Height = $iHeight
    Global $iGUI_Width = $iWidth
    EndIf
    Global $hGui = GUICreate($sName, $iWidth, $iHeight, 0, 0)
    If @error Then Return -1
    GUISetBkColor($_BGColor)
    GUISetState(@SW_SHOW)
    If $bFullscreen = True Then GUISetStyle($WS_MAXIMIZEBOX + $WS_MAXIMIZE, -1, $hGui)
    Global $_GuiBackColor = $_BGColor
    _GDIPlus_Startup()
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $hMatrix = _GDIPlus_MatrixCreate()

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

    Local $aReturn[2] = [$hGui, $hBackbuffer]
    Return $aReturn
    EndFunc ;==>_CrystalStart

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalInitialize
    ; Description ...: Draw all images
    ; Syntax.........: _CrystalInitialize($iDegree)
    ; Parameters ....: $iDegree - Rotation
    ; Return values .: Success -
    ; Failure -
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalInitialize()
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = True Then
    _GDIPlus_MatrixRotate($hMatrix, $aObj[$i][7])
    Local $hRect = _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $aObj[$i][1], $aObj[$i][2], $aObj[$i][3], $aObj[$i][4], $aObj[$i][5])
    _GDIPlus_GraphicsSetTransform($hRect, $hMatrix)
    EndIf
    Next
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
    _GDIPlus_GraphicsClear($hBackbuffer, $_GuiBackColor)
    EndFunc ;==>_CrystalInitialize

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalCreateChar
    ; Description ...: Creates a player controlable NPC
    ; Syntax.........: _CrystalCreateChar($sPath, $iX, $iY, $iWidth, $iHeight)
    ; Parameters ....: $sPath - Path to the image
    ; $iX - X axis where the image has to be loaded
    ; $iY - Y axis where the image has to be loaded
    ; $iWidth - Width of the image
    ; $iHeight - Height of the image
    ; Return values .: Success - GDI+ image handle
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalCreateChar($sPath, $iX, $iY, $iWidth, $iHeight)
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = False Then
    $aObj[$i][0] = True
    $aObj[$i][1] = _GDIPlus_ImageLoadFromFile($sPath)
    $aObj[$i][2] = $iX
    $aObj[$i][3] = $iY
    $aObj[$i][4] = $iWidth
    $aObj[$i][5] = $iHeight
    $aObj[$i][6] = True
    $aObj[$i][7] = 90
    Return $aObj[$i][1]
    ExitLoop
    EndIf
    Next
    Return -1
    EndFunc ;==>_CrystalCreateChar

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalCreateNPC
    ; Description ...: Creates an NPC
    ; Syntax.........: _CrystalCreateNPC($sPath, $iX, $iY, $iWidth, $iHeight)
    ; Parameters ....: $sPath - Path to the image
    ; $iX - X axis where the image has to be loaded
    ; $iY - Y axis where the image has to be loaded
    ; $iWidth - Width of the image
    ; $iHeight - Height of the image
    ; Return values .: Success - GDI+ image handle
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalCreateNPC($sPath, $iX, $iY, $iWidth, $iHeight)
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = False Then
    $aObj[$i][0] = True
    $aObj[$i][1] = _GDIPlus_ImageLoadFromFile($sPath)
    $aObj[$i][2] = $iX
    $aObj[$i][3] = $iY
    $aObj[$i][4] = $iWidth
    $aObj[$i][5] = $iHeight
    $aObj[$i][6] = True
    $aObj[$i][7] = 90
    Return $aObj[$i][1]
    ExitLoop
    EndIf
    Next
    Return -1
    EndFunc ;==>_CrystalCreateNPC

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalMoveChar
    ; Description ...: Moves a player controlable NPC
    ; Syntax.........: _CrystalMoveChar($hGDI, $iDegree[, $iSpeed])
    ; Parameters ....: $hGDI - GDI handle returned from _CrystalCreateChar
    ; $iDegree - Rotation in degree
    ; $iSpeed - [optional] Speed of the NPC
    ; Return values .: Success -
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalMoveChar($hGDI, $iDegree, $iSpeed = 2)
    For $i = 0 To UBound($aObj) - 1
    If $hGDI = $aObj[$i][1] Then
    $iBogen = ($iDegree * $iPI) / 180
    $aObj[$i][2] += Cos($iBogen) * $iSpeed
    $aObj[$i][3] += Sin($iBogen) * $iSpeed
    For $j=0 To UBound($aObj) - 1
    If (_CrystalCollisionSqSq($aObj[$i][2], $aObj[$i][3], $aObj[$i][4], $aObj[$i][5], $aObj[$j][2], $aObj[$j][3], $aObj[$j][4], $aObj[$j][5])) AND ($aObj[$j][6]=True) AND ($aObj[$j][1]<>$hGDI) Then
    $aObj[$i][2] -= Cos($iBogen) * $iSpeed
    $aObj[$i][3] -= Sin($iBogen) * $iSpeed
    EndIf
    Next
    If $aObj[$i][2] < 0 Then $aObj[$i][2] = 0
    If $aObj[$i][2] > $iGUI_Width - _GDIPlus_ImageGetWidth($hGDI) Then $aObj[$i][2] = $iGUI_Width - _GDIPlus_ImageGetWidth($hGDI)
    If $aObj[$i][3] < 0 Then $aObj[$i][3] = 0
    If $aObj[$i][3] > $iGUI_Height - _GDIPlus_ImageGetHeight($hGDI) Then $aObj[$i][3] = $iGUI_Height - _GDIPlus_ImageGetHeight($hGDI)
    EndIf
    Next
    EndFunc ;==>_CrystalMoveChar

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalRotateNPC
    ; Description ...: Rotates an NPC
    ; Syntax.........: _CrystalRotateNPC($hGDI, $iDegree)
    ; Parameters ....: $hGDI - GDI handle returned from _CrystalCreateChar/NPC
    ; $iDegree - Degree of rotation
    ; Return values .: Success -
    ; Failure -
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalRotateNPC($hGDI, $iDegree)
    For $i = 0 To UBound($aObj) - 1
    If $hGDI = $aObj[$i][1] Then
    $aObj[$i][7] = $iDegree
    EndIf
    Next
    EndFunc ;==>_CrystalRotateNPC

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalCreateRandomMap
    ; Description ...: Creates a random map
    ; Syntax.........: _CrystalCreateRandomMap($sGroundPath)
    ; Parameters ....: $sGroundPath - Path to the ground image
    ; Return values .: Success -
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalCreateRandomMap($sGroundPath)
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = False Then
    $aObj[$i][0] = True
    $aObj[$i][1] = _GDIPlus_ImageLoadFromFile($sGroundPath)
    $aObj[$i][2] = 0
    $aObj[$i][3] = 0
    $aObj[$i][4] = $iGUI_Width
    $aObj[$i][5] = $iGUI_Height
    $aObj[$i][6] = False
    $aObj[$i][7] = 90
    ExitLoop
    EndIf
    Next
    ;_CrystalCreateRandomEnviroment("./src/img/env_sprites/", $iMapSquare)
    EndFunc ;==>_CrystalCreateRandomMap

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalCollisionSqSq
    ; Description ...: Checks if two squares collide
    ; Syntax.........: _CrystalCollisionSqSq($iX1, $iY1, $iW1, $iH1, $iX2, $iY2, $iW2, $iH2)
    ; Parameters ....: $iX - X axis
    ; $iY - Y axis
    ; $iW - Width
    ; $iH - Height
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalCollisionSqSq($iX1, $iY1, $iW1, $iH1, $iX2, $iY2, $iW2, $iH2)
    If ($iX1 + $iW1 > $iX2 And $iY1 + $iH1 > $iY2 And $iX1 < $iX2 + $iW2 And $iY1 < $iY2 + $iH2) Then
    Return True
    Else
    Return False
    EndIf
    EndFunc ;==>_CrystalCollisionSqSq

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalCreateRandomEnviroment
    ; Description ...: Creates random enviroment over the map
    ; Syntax.........: _CrystalCreateRandomMap($sSpritePath, $iMapSize[, $iNumber])
    ; Parameters ....: $sSpritePath - Path to all enviroment sprites
    ; $iMapSize - Size of map
    ; $iNumber - [optional] Number of enviroment sprites
    ; Return values .: Success -
    ; Failure - -1
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    #cs
    Func _CrystalCreateRandomEnviroment($sSpritePath, $iMapSize, $iNumber = 4)
    Local $iStartNumber = 0
    Local $iSize = $iMapSize * 0.2
    For $i = 0 To 99
    $bF = False
    $iRX = Random(0, $iMapSize - $iSize, 1)
    $iRY = Random(0, $iMapSize - $iSize, 1)
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = True Then
    If (_CrystalCollisionSqSq($iRX, $iRY, $iSize, $iSize, $aObj[$i][2], $aObj[$i][3], $aObj[$i][4], $aObj[$i][5]) = False) OR ($aObj[$i][6] = False) Then
    $bF = True
    ExitLoop
    EndIf
    EndIf
    Next
    If $bF = True Then
    $aFiles = _FileListToArray($sSpritePath, "*", 1)
    For $i = 0 To UBound($aObj) - 1
    $iRF = Random(1, $aFiles[0], 1)
    If $aObj[$i][0] = False Then
    $aObj[$i][0] = True
    $aObj[$i][1] = _GDIPlus_ImageLoadFromFile($sSpritePath & $aFiles[$iRF])
    $aObj[$i][2] = $iRX
    $aObj[$i][3] = $iRY
    $aObj[$i][4] = $iMapSize * 0.2
    $aObj[$i][5] = $iMapSize * 0.2
    $aObj[$i][6] = True
    $aObj[$i][7] = 90
    $iStartNumber += 1
    $bF = False
    ExitLoop
    EndIf
    Next
    EndIf
    If $iStartNumber >= $iNumber Then ExitLoop
    Next
    EndFunc ;==>_CrystalCreateRandomEnviroment
    #ce

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalClose
    ; Description ...: Closes the gui and Crystal
    ; Syntax.........: _CrystalClose()
    ; Parameters ....:
    ; Return values .: Success -
    ; Failure -
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalClose()
    For $i = 0 To UBound($aObj) - 1
    If $aObj[$i][0] = True Then
    _GDIPlus_ImageDispose($aObj[$i][1])
    EndIf
    Next
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_Shutdown()
    GUIDelete($hGui)
    EndFunc ;==>_CrystalClose

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _CrystalHideMouse
    ; Description ...: Hides the mouse cursor
    ; Syntax.........: _CrystalHideMouse()
    ; Parameters ....:
    ; Return values .: Success -
    ; Failure -
    ; Author ........: Nakroma (http://www.schmierdeinbrot.de)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: No
    ; ===============================================================================================================================
    Func _CrystalHideMouse()
    MouseMove(@DesktopWidth + 500, @DesktopHeight + 500, 1)
    _WinAPI_ShowCursor(False)
    EndFunc

    [/autoit]

    Mainscript

    Spoiler anzeigen
    [autoit]


    #include <CrystalEngine.au3>
    #include <GuiConstants.au3>
    #include <Misc.au3>
    Opt("GUIOnEventMode", 1)
    HotKeySet("{ESC}", "_Exit")

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

    $iDegree = 90

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

    $iGUI_Width = @DesktopWidth
    $iGUI_Height = @DesktopHeight

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

    _CrystalStart("Test", 999, True)
    If @Error Then _Exit()
    _CrystalCreateRandomMap("./src/img/ground.gif")
    $hChar = _CrystalCreateChar("./src/img/env_sprites/sprite_1.gif", $iGUI_Width/2 - 10, 20, 25, 25)
    _CrystalCreateNPC("./src/img/env_sprites/sprite_2.gif", 100, 20, 25, 25)

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

    While 1
    _CrystalInitialize()
    _CrystalHideMouse()
    If _IsPressed("57") Then _CrystalMoveChar($hChar, $iDegree)
    If _IsPressed("44") Then
    $iDegree += 10
    _CrystalRotateNPC($hChar, $iDegree)
    EndIf
    If _IsPressed("41") Then
    $iDegree -= 10
    _CrystalRotateNPC($hChar, $iDegree)
    EndIf
    WEnd

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

    Func _Exit()
    _CrystalClose()
    Exit
    EndFunc

    [/autoit]
  • Changelog Creator

    • Nakroma
    • 28. März 2013 um 15:11

    Bei dem Add und Remove neben der Version.

  • Changelog Creator

    • Nakroma
    • 28. März 2013 um 15:08

    Version 1.5
    ver

    • Added : Baum
    • Fixed : Baum

    :P Ist schön geworden, was mich interessieren würde was close, ent und ver sind.

  • RosettaCode Sammelthread

    • Nakroma
    • 25. März 2013 um 12:07

    Ups... klar, Sekunde.
    €: So, Links gefixt ^^

  • RosettaCode Sammelthread

    • Nakroma
    • 25. März 2013 um 12:07

    Art: Neu-Implementierung
    Task: http://rosettacode.org/wiki/Guess_the_number/With_Feedback
    Beteiligte: Nakroma
    Skript:

    Spoiler anzeigen
    [autoit]


    $iMin = 1
    $iMax = 100
    $iAnswer = Random(1, 100, 1)

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

    MsgBox(0, "RosettaCode: Guess the number/With feedback", "You have to find out a number beetwen " & $iMin & " and " & $iMax & ".")
    While 1
    $hInput = InputBox("RossetaCode: Guess the number", "Guess the number", "")
    If @error Then Exit
    If ($hInput < $iMax) AND ($hInput > $iMin) Then
    If $hInput < $iAnswer Then
    MsgBox(0, "Wrong", "Your guess was less than the target number.")
    ElseIf $hInput > $iAnswer Then
    MsgBox(0, "Wrong", "Your guess was higher than the target number.")
    ElseIf $hInput = $iAnswer Then
    MsgBox(0, "Right", "The guess was right. Congratulations!")
    Exit
    EndIf
    Else
    MsgBox(0, "Error", "Invalid input")
    EndIf
    WEnd

    [/autoit]
  • RosettaCode Sammelthread

    • Nakroma
    • 25. März 2013 um 11:40

    Art: Neu-Implementierung
    Task: http://rosettacode.org/wiki/Variables
    Beteiligte: Nakroma
    Skript:

    Spoiler anzeigen
    [autoit]


    Local $bBoolean = True ; Local boolean
    Global $sString = "RosettaCode" ; Global string
    $iInteger = 42 ; Integer
    $hGui = GuiCreate("RosettaCode") ; Handle
    $aArray[2] = ["code 1", "code 2"] ; Array

    [/autoit]

    Bin mir hierbei nicht so ganz sicher ob ich das erfüllt habe was verlangt wurde, aber naja.

  • RosettaCode Sammelthread

    • Nakroma
    • 25. März 2013 um 11:27

    Art: Neu-Implementierung
    Task: http://rosettacode.org/wiki/URL_decoding
    Beteiligte: Nakroma, James1337
    Skript:

    Spoiler anzeigen
    [autoit]


    $sUrl = "http%3A%2F%2Ffoo%20bar%2F"
    $aDecode = StringRegExp($sUrl, '(?i)%[0-9A-F]{2}', 3)
    If IsArray($aDecode) Then
    For $i = 0 To UBound($aDecode) - 1
    $sTrim = StringTrimLeft($aDecode[$i], 1)
    $sUrl = StringReplace($sUrl, $aDecode[$i], BinaryToString("0x" & $sTrim))
    Next
    ConsoleWrite($sUrl)
    EndIf

    [/autoit]
  • RosettaCode Sammelthread

    • Nakroma
    • 24. März 2013 um 22:22

    Art: Neu-Implementierung
    Task: http://rosettacode.org/wiki/URL_encoding
    Beteiligte: Nakroma
    Skript:

    Spoiler anzeigen
    [autoit]

    #include <String.au3>

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

    $sUrl = "http://foo bar/"
    $aEncode = StringRegExp($sUrl, '\W', 3)
    If IsArray($aEncode) Then
    For $i = 0 To UBound($aEncode) - 1
    $sUrl = StringReplace($sUrl, $aEncode[$i], "%" & _StringToHex($aEncode[$i]))
    Next
    ConsoleWrite($sUrl)
    EndIf

    [/autoit]
  • Minecraft-Server-Editor v2.0.3

    • Nakroma
    • 25. Februar 2013 um 20:02

    Habs getestet, funktioniert tatsächlich.

  • Speichern, Laden in Combobox..

    • Nakroma
    • 24. Februar 2013 um 17:37

    Mach mal das rein:

    [autoit]


    Local $i = 1
    $sRead = FileReadLine("blub.txt", $i)
    While $sRead <> ""
    $sRead = FileReadLine("blub.txt", $i)
    $aData = StringSplit($sRead, "|")
    If $aData[0] = 3 Then
    GUICtrlSetData($hCombo, $aData[1] & ":" & $aData[2], $i)
    $i += 1
    EndIf
    WEnd

    [/autoit]
  • Speichern, Laden in Combobox..

    • Nakroma
    • 24. Februar 2013 um 16:44

    ^^ Christoph, das meinte ich doch mit $aData[0] zu überprüfen

  • Speichern, Laden in Combobox..

    • Nakroma
    • 24. Februar 2013 um 15:52

    Prüf mal bitte $aData[0].

  • Speichern, Laden in Combobox..

    • Nakroma
    • 24. Februar 2013 um 15:17
    [autoit]


    $aData = StringSplit($sInhalt, "|")
    $aData[0] ; Anzahl von "Splits"
    $aData[1] ; Erster Split, in diesem Fall die IP
    $aData[2] ; Zweiter Split, in diesem Fall der Port
    $aData[3] ; Dritter Split, in diesem Fall... was auch immer

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

    GuiCtrlSetData($hCombo, $aData[1] & ":" & $aData[2])

    [/autoit]

    Wenn du das alles in ne Combo tun willst würde das so aussehen:

    [autoit]


    Local $i = 1
    $sRead = FileReadLine("blub.txt", $i)
    While $sRead <> ""
    $sRead = FileReadLine("blub.txt", $i)
    $aData = StringSplit($sRead, "|")
    GUICtrlSetData($hCombo, $aData[1] & ":" & $aData[2], $i)
    $i += 1
    WEnd

    [/autoit]
  • GDI+ Animationen und AutoIt Multiplayer

    • Nakroma
    • 24. Februar 2013 um 12:23

    Gut, dann poste ich mal wieder hier damit ich keinen neuen Thread aufmachen muss.
    Ich hab grade massive Probleme mit GDI+ und Backbuffern. Klappt alles super bis auf die Imagegröße.
    Die wird irgendwie durch die Bitmap verkleinert, die Werte bleiben aber die gleichen(die ich ja später brauche zum Hitbox berechnen).
    Wenn ich die Bitmap auf die selbe Größe wie die Figur mache, wird sie irgendwann abgeschnitten.

    Mit gleicher Bitmap, Bild ist in der richtigen Größe wie die Variablen aber wird abgeschnitten wenn man zu weit läuft:

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstants.au3>
    Opt("GUIOnEventMode", 1)
    _GDIPlus_Startup()
    Global $aPos_RectX[2] = [0, 400]
    Global $aPos_RectY[2] = [0, 400]
    Global $aPos_RectW[2] = [100, 100]
    Global $aPos_RectH[2] = [142, 142]
    HotKeySet("w", "_move")

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

    $hGUI = GUICreate("GUI", 700, 700)

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

    $hPlayer = _GDIPlus_ImageLoadFromFile("./data/char1.gif")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($aPos_RectW[0], $aPos_RectH[0], $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    GUISetOnEvent(-3, "_exit")
    GUIRegisterMsg(0x000F, "WM_PAINT")
    GUISetState(@SW_SHOW)

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

    While 1
    WEnd

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

    Func _exit() ; Beenden des Clients
    _GDIPlus_ImageDispose($hPlayer)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    Exit
    EndFunc
    Func WM_PAINT() ; Redraw Funktion
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + 0xF0F0F0)

    _GDIPlus_GraphicsDrawImageRect($hBackbuffer,$hPlayer, $aPos_RectX[0], $aPos_RectY[0], $aPos_RectW[0], $aPos_RectH[0])

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, $aPos_RectX[0], $aPos_RectY[0], $aPos_RectW[0], $aPos_RectH[0])
    EndFunc
    Func _move()
    $speed = 1
    $aPos_RectX[0] += $speed
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INTERNALPAINT)
    EndFunc

    [/autoit]

    Mit Bitmap die so groß ist wie die GUI, Bild wird verkleinert Height und Width Werte bleiben aber normal groß:

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstants.au3>
    Opt("GUIOnEventMode", 1)
    _GDIPlus_Startup()
    Global $aPos_RectX[2] = [0, 400]
    Global $aPos_RectY[2] = [0, 400]
    Global $aPos_RectW[2] = [100, 100]
    Global $aPos_RectH[2] = [142, 142]
    HotKeySet("w", "_move")

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

    $hGUI = GUICreate("GUI", 700, 700)

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

    $hPlayer = _GDIPlus_ImageLoadFromFile("./data/char1.gif")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics(700, 700, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    GUISetOnEvent(-3, "_exit")
    GUIRegisterMsg(0x000F, "WM_PAINT")
    GUISetState(@SW_SHOW)

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

    While 1
    WEnd

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

    Func _exit() ; Beenden des Clients
    _GDIPlus_ImageDispose($hPlayer)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    Exit
    EndFunc
    Func WM_PAINT() ; Redraw Funktion
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + 0xF0F0F0)

    _GDIPlus_GraphicsDrawImageRect($hBackbuffer,$hPlayer, $aPos_RectX[0], $aPos_RectY[0], $aPos_RectW[0], $aPos_RectH[0])

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, $aPos_RectX[0], $aPos_RectY[0], $aPos_RectW[0], $aPos_RectH[0])
    EndFunc
    Func _move()
    $speed = 1
    $aPos_RectX[0] += $speed
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INTERNALPAINT)
    EndFunc

    [/autoit]
  • Txt File Inhalt auslesen

    • Nakroma
    • 14. Februar 2013 um 13:57

    Naja ich denke mal du ließt das File aus und schneidest dann den String zurecht. Weiß ja grad nicht wie genau deine TXT Datei aussieht.

  • GDI+ Animationen und AutoIt Multiplayer

    • Nakroma
    • 13. Februar 2013 um 22:30

    Hab mal wieder ein kleines Problem mit mehreren Clients :/
    Ich habe jetzt einfach mal die UDF von hier genommen: https://autoit.de/index.php?page…2087#post262087
    Damit
    klappt auch alles wunderbar, aber der Client verarbeitet irgendwie die
    Returns nicht. Sleep funktioniert nicht und ich weiß nicht was Christoph mit
    "Normalerweise macht man das so, dass der Client/Server die Pakete
    'unvorbereitet' empfängt." meint.
    Bevor man mein Script liest,
    solltest man vlt wissen worum es geht, ich will wie gesagt ein
    Multiplayerfähiges StreetFighter Game bauen. Aber, weil man sonst die
    Ports freigeben muss, will ich das nicht über einen Host & einen
    Client laufen lassen wie in etwas älteren Spielen, WarCraft III z.B.
    sondern ich will einen großen Server auf dem dann immer zwei Clients
    zusammen spielen können. Aktuell löse ich das so, indem ich bei Login
    einer freien $player[$i] diesen Client zuteile. In der späteren Match
    Funktion soll der Server dann einfach zwei Clients die eingeloggt sind
    zusammenwerfen.
    Server.au3

    Spoiler anzeigen
    [autoit]


    #include "TCPServer.au3" ;http://pastebin.com/Ht8vqAXN
    $Server_IP = "25.57.169.7"
    $Server_Port = 32976
    Global $player[99]
    For $i=0 To 98
    $player[$i] = False
    Next
    Global $login = False
    _TCPServer_RegisterEvent($TCPSERVER_RECEIVEDDATA, "ReceivedData")
    _TCPServer_Startup($Server_IP, $Server_Port)
    ConsoleWrite("Server ist nun hochgefahren." & @CRLF)

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

    While Sleep(100)
    WEnd

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

    Func ReceivedData($socket, $data)
    $data = StringSplit($data, "|")
    Switch $data[1]
    Case "SHUTDOWN"
    ConsoleWrite("Server wird runtergefahren." & @CRLF)
    _TCPServer_Shutdown()
    Exit
    Case "CONNECT"
    If ($data[0] = 2) Then
    For $i=0 To 98
    If $player[$i] = False Then
    $player[$i] = True
    ConsoleWrite("Ein Client hat sich als Player " & $i & " eingeloggt." & @CRLF)
    Return $i
    $login = True
    ExitLoop
    EndIf
    Next
    If $login <> True Then
    Return "Der Server ist aktuell ausgelastet. Versuch es später nochmal."
    ConsoleWrite("Der Server ist ausgelastet." & @CRLF)
    EndIf
    $login = False
    EndIf
    Case "LOGOUT"
    If ($data[0] = 2) Then
    $player[$data[2]] = False
    ConsoleWrite("Client " & $data[2] & " hat sich ausgeloggt." & @CRLF)
    EndIf
    Case Else
    ConsoleWrite("Unbekanntes Kommando: " & $data[1] & @CRLF)
    EndSwitch
    EndFunc

    [/autoit]


    Client.au3

    Spoiler anzeigen
    [autoit]


    #include
    #include
    Opt("GUIOnEventMode", 1)
    TCPStartup()
    $Server_IP = "25.57.169.7"
    $Server_Port = 32976
    $hGUI = GUICreate("GDI-TCP-Client", 400, 400)
    $button1 = GUICtrlCreateButton("Einlogen", 10, 10)
    $button2 = GUICtrlCreateButton("Ausloggen", 10, 60)
    GUISetOnEvent(-3, "_exit")
    GUICtrlSetOnEvent($button1, "_einloggen")
    GUICtrlSetOnEvent($button2, "_ausloggen")
    GUISetState(@SW_SHOW)

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

    $MainSocket = TCPConnect($Server_IP, $Server_Port)
    If @error Then

    MsgBox(16, 'Fehler beim Verbinden', 'Entweder stimmen IP-Adresse/Port
    nicht, oder es ist bereits ein anderer Client mit dem Server
    verbunden.', 10)
    _exit()
    EndIf

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

    While 1
    $Recv = TCPRecv($MainSocket, 1024)
    If @error Then _exit()
    If $Recv <> '' Then
    If StringIsDigit($Recv) Then
    MsgBox(0, "", "Du bist nun Player " & $Recv)
    Global $baum = $Recv
    Else
    MsgBox(0, "", $Recv)
    EndIf
    EndIf
    WEnd

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

    Func _einloggen()
    TCPSend($MainSocket, "CONNECT|")
    EndFunc
    Func _ausloggen()
    TCPSend($MainSocket, "LOGOUT|" & $baum)
    EndFunc

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

    Func _exit()
    TCPCloseSocket($MainSocket)
    TCPShutdown()
    Exit
    EndFunc

    [/autoit]

    Noch anzumerken ist, das dies meine Hamachi IP ist, also nicht wundern das ich sie nicht zensiere^^
    Wäre nett wenn mir jemand helfen könnte,
    Mfg Nakro

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™