Moin,
Habe grade ein seltsames Problem entdeckt.
In einer For schleife wird ein Continueloop aufgerufen (soweit so gut).
Interessanterweise spuckt der Interpreter bei AutoItVersion 3.3.8.1 einen Fehler aus:
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
C:\Users\Marsi\Desktop\CookieKlick.au3 (51) : ==> "ContinueLoop" statement with no matching "While", "Do" or "For" statement.:
If ($iAnz = 0) Or ($iEin = 0) Or ($iPreis = 0) Then ContinueLoop
->02:26:30 AutoIt3.exe ended.rc:1
>Exit code: 1 Time: 3.005
In der Beta 3.3.9.17 läuft alles wie gewünscht. (Eventuell ist das Problem ja behoben worden.)
Da ich aber noch nie einen "echten" Fehler in AutoIt gefunden habe möchte ich, dass ihr das Skript mal mit der Stable ausführt und schaut ob der Fehler auch auftritt. (ggf hab ich ja auch einen Fehler im System und sehe ihn vor lauter Bäumen nicht, dann dürfte es in der .9.17 aber nicht so einfach laufen^^) Schreibt man den Einzeiligen Continueloop Teil in Zeile 50 zu einem Mehrzeiler um funktioniert es lustigerweise auch in der 8.1
Bevor Fragen auftauchen: Das Skript ist dazu gedacht das effizienteste Upgrade beim Spiel Cookie Clicker herauszufinden. Automatisiert wird nix, sollte also regelkonform sein (rechnen kann man ja keinem verbieten).
Spoiler anzeigen
#include <Array.au3>
; Herausfinden welches Upgrade das beste ist.
[/autoit] [autoit][/autoit] [autoit]Global $iMsg
Global $hGUI = GUICreate('Cookie Klicker', 454, 224)
Global $aItems[9][4]
; 0 - Anzahl
; 1 - Einkommen (Kekse)
; 2 - Preis
; 3 - Name
; Die Kekse pro Item sind also [1]/[0]
; Der Preis pro Keks ist ([1]/[0])/[2]
Global $aInput[9][3]
; 0 - Anzahl
; 1 - Einkommen
; 2 - Preis
Global $aNamen[9]
Global $aPreisProKeks[9]
_SetNames()
_CreateLabels()
GUISetState(@SW_SHOW, $hGUI)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While True
$iMsg = GUIGetMsg()
Switch $iMsg
Case 0, -11, -7, -8, -9, -10, -4
Case -3
Exit
Case Else
If $iMsg > 0 Then _Calc()
EndSwitch
WEnd
Func _Calc()
Local $aPreisProKeks_Local[9]
Local $iAnz, $iEin, $iPreis
For $i = 0 To 8 Step 1
$iAnz = Int(GUICtrlRead($aItems[$i][0]))
$iEin = Int(GUICtrlRead($aItems[$i][1]))
$iPreis = Int(GUICtrlRead($aItems[$i][2]))
If ($iAnz = 0) Or ($iEin = 0) Or ($iPreis = 0) Then ContinueLoop
Next
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _CreateLabels()
GUICtrlCreateEdit('Anzahl', 85, 3, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Einkommen', 82 + 85, 3, 100, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Preis', 102 + 82 + 85, 3, 100, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Effizienz', 102+102 + 82 + 85, 3, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
For $i = 0 To 8 Step 1
$aNamen[$i] = GUICtrlCreateEdit($aItems[$i][3], 3, 25 + 22 * $i, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
$aInput[$i][0] = GUICtrlCreateEdit('', 85, 25 + 22 * $i, 80, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aInput[$i][1] = GUICtrlCreateEdit('', 82 + 85, 25 + 22 * $i, 100, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aInput[$i][2] = GUICtrlCreateEdit('', 184 + 85, 25 + 22 * $i, 100, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aPreisProKeks[$i] = GUICtrlCreateEdit('', 102+184 + 85, 25 + 22 * $i, 80, 20, 2049)
GUICtrlSetFont(-1, 10, 500)
Next
EndFunc ;==>_CreateLabels
Func _SetNames()
Local $a = StringSplit('Cursor,Grandma,Farm,Factory,Mine,Shipment,Alchemy lab,Portal,Time machine', ',', 2)
For $i = 0 To 8 Step 1
$aItems[$i][3] = $a[$i]
Next
EndFunc ;==>_SetNames
Edit 1: Hab grade eine Zeile(51) hinzugefügt. Kommentiert man diese aus schmiert das Skript bei der ersten Zahleneingabe ab. Lässt man die Zeile drinnen funktioniert alles nach Plan. Die Zeile hat aber nichts mit dem Continueloop zu tun...
Spoiler anzeigen
#include <Array.au3>
; Herausfinden welches Upgrade das beste ist.
[/autoit] [autoit][/autoit] [autoit]Global $iMsg
Global $hGUI = GUICreate('Cookie Klicker', 454, 224)
Global $aItems[9][4]
; 0 - Anzahl
; 1 - Einkommen (Kekse)
; 2 - Preis
; 3 - Name
; Die Kekse pro Item sind also [1]/[0]
; Der Preis pro Keks ist ([1]/[0])/[2]
Global $aInput[9][3]
; 0 - Anzahl
; 1 - Einkommen
; 2 - Preis
Global $aNamen[9]
Global $aPreisProKeks[9]
_SetNames()
_CreateLabels()
GUISetState(@SW_SHOW, $hGUI)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While True
$iMsg = GUIGetMsg()
Switch $iMsg
Case 0, -11, -7, -8, -9, -10, -4
Case -3
Exit
Case Else
If $iMsg > 0 Then _Calc()
EndSwitch
WEnd
Func _Calc()
Local $aPreisProKeks_Local[9]
Local $iAnz, $iEin, $iPreis
For $i = 0 To 8 Step 1
$iAnz = Int(GUICtrlRead($aItems[$i][0]))
$iEin = Int(GUICtrlRead($aItems[$i][1]))
$iPreis = Int(GUICtrlRead($aItems[$i][2]))
If ($iAnz = 0) Or ($iEin = 0) Or ($iPreis = 0) Then ContinueLoop
;~ $aPreisProKeks_Local[$i] = ($iEin/$iAnz)/$iPreis
Next
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _CreateLabels()
GUICtrlCreateEdit('Anzahl', 85, 3, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Einkommen', 82 + 85, 3, 100, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Preis', 102 + 82 + 85, 3, 100, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
GUICtrlCreateEdit('Effizienz', 102+102 + 82 + 85, 3, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
For $i = 0 To 8 Step 1
$aNamen[$i] = GUICtrlCreateEdit($aItems[$i][3], 3, 25 + 22 * $i, 80, 20, 2049)
GUICtrlSetFont(-1, 11, 500)
$aInput[$i][0] = GUICtrlCreateEdit('', 85, 25 + 22 * $i, 80, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aInput[$i][1] = GUICtrlCreateEdit('', 82 + 85, 25 + 22 * $i, 100, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aInput[$i][2] = GUICtrlCreateEdit('', 184 + 85, 25 + 22 * $i, 100, 20, 1)
GUICtrlSetFont(-1, 10, 500)
$aPreisProKeks[$i] = GUICtrlCreateEdit('', 102+184 + 85, 25 + 22 * $i, 80, 20, 2049)
GUICtrlSetFont(-1, 10, 500)
Next
EndFunc ;==>_CreateLabels
Func _SetNames()
Local $a = StringSplit('Cursor,Grandma,Farm,Factory,Mine,Shipment,Alchemy lab,Portal,Time machine', ',', 2)
For $i = 0 To 8 Step 1
$aItems[$i][3] = $a[$i]
Next
EndFunc ;==>_SetNames
lg
Mars