Hallo Buckiuxx,
der entscheidende Unterschied: das Skript von Schnitzel hat nur 1 Endlosschleife, du aber 2 . Da die Funktion _Play über einen Event aufgerufen wird und diese durch deine 2. Endlosschleife nie verlassen wird, ist das Skript blockiert. Mach es so und es klappt:
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $Form1 = -99
[/autoit] [autoit][/autoit] [autoit]$Fenstermain = GUICreate("", 403, 476, 359, 214, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
$Exit = GUICtrlCreatePic(@ScriptDir & "\Exit.jpg", 326, 0, 77, 38, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent($Exit, "Ende")
GUICtrlCreatePic(@scriptdir & "\Main.jpg",0, 0, 401, 473, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Startbutton = GUICtrlCreateButton("Start", 20, 100)
GUICtrlSetOnEvent($Startbutton, "_Play")
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
Sleep(5)
IF $Form1 <> -99 Then
;_Movement_Hindernisse() ;weiter unten im Script...funktioniert...(in den funktionen kommt kein while oder sleep vor daran liegt es also auch nicht.)
;_Check_Playerfail() ;weiter unten im Script...funktioniert...(in den funktionen kommt kein while oder sleep vor daran liegt es also auch nicht.)
EndIf
WEnd
Func _Play()
Sleep(300)
GUIDelete()
;HotKeySet("{Right}", "_Right")
;HotKeySet("{Left}", "_Left")
$Form1 = GUICreate("GUI", 403, 800, 359, 12, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP));,$WS_CLIPSIBLINGS))
$pExit = GUICtrlCreatePic(@ScriptDir & "\Exit.jpg", 326, 0, 77, 38);, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent($pExit, "Ende")
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]#cs
While 1
Sleep(3)
WEnd
#ce
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func Ende()
Exit
EndFunc
;...
[/autoit]mfg (Auto)Bert