Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region variablen
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$start = 1
$title = ""
$prodi_h = 100
$prodi_l = 100
$prodi_e = 100
;100 pro minute
$mainbuild = "Hauptgebäude"
$font = "Comic Sans MS"
$time_start = 30000
$level_main = $start
$level_wood = $start
$wood = "Holz:"
$clay = "Lehm:"
$iron = "Eisen:"
$error_ress = "Nicht genug Rohstoffe vorhanden"
$build = "Ausbauen"
$ress = 100
$ressH = $ress
$ressL = $ress
$ressE = $ress
$woodcutter = "Holzfäller"
$claypit = "Lehmgrube"
$ironmine = "Eisenmine"
;holzfäller kosten
$cost_wood2H = 40
$cost_wood2L = 20
$cost_wood2E = 10
$cost_wood3H = 60
$cost_wood3L = 40
$cost_wood3E = 20
$cost_wood4H = 100
$cost_wood4L = 60
$cost_wood14E = 30
#endregion variablen
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]AdlibRegister ( "_prodi", $time_start )
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]#region gui
[/autoit] [autoit][/autoit] [autoit]$Form1_1 = GUICreate( $title, 547, 368, 235, 193)
$Label_main = GUICtrlCreateLabel( $mainbuild, 24, 144, 91, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_mainLevel = GUICtrlCreateLabel( $level_main, 24, 168, 49, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_wood = GUICtrlCreateLabel( $wood, 24, 24, 36, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_clay = GUICtrlCreateLabel( $clay, 24, 48, 38, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_iron = GUICtrlCreateLabel( $iron, 24, 72, 40, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Button_buildMain = GUICtrlCreateButton( $build, 24, 200, 75, 25)
$Label_ressH = GUICtrlCreateLabel( $ressH, 72, 24, 35, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_ressL = GUICtrlCreateLabel( $ressL, 72, 48, 32, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_ressE = GUICtrlCreateLabel( $ressE, 72, 72, 35, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font )
$label_prodiH = GUICtrlCreateLabel( $prodi_h, 208, 16, 43, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_prodiL = GUICtrlCreateLabel( $prodi_l, 208, 40, 40, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label_prodiE = GUICtrlCreateLabel( $prodi_e, 208, 64, 43, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label1 = GUICtrlCreateLabel("Pro 30 Sekunden", 280, 40, 69, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font)
$Label2 = GUICtrlCreateLabel( $woodcutter, 144, 144, 67, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font )
$Label_woodcutter = GUICtrlCreateLabel( $level_wood, 144, 168, 49, 22)
GUICtrlSetFont(-1, 10, 400, 0, $font )
$Button_buildWood = GUICtrlCreateButton( $build, 136, 200, 75, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button_buildWood ;holzfäller ausbauen
;stufe 4
;stufe 3
;stufe 2
If $level_wood = $start Then ;if stufe 1
If $ressH > $cost_wood2H Then ;holz2
If $ressL > $cost_wood2L Then ;lehm2
If $ressE > $cost_wood2E Then ;eisen2
;neue ressis
$ressH = $ressH - $cost_wood2H
$ressL = $ressL - $cost_wood2L
$ressE = $ressE - $cost_wood2E
;stufe hoch
$level_wood = $level_wood +1
GUICtrlSetData ( $Label_woodcutter, $level_wood )
;neue prodi
$prodi_h = $prodi_h / 2
$prodi_h = $prodi_h * 3
Else
MsgBox ( 16, $title, $error_ress )
Else
MsgBox ( 16, $title, $error_ress )
Else
MsgBox ( 16, $title_error_ress )
EndIf
EndIf
EndIf
EndIf
EndSwitch
WEnd
#endregion
[/autoit] [autoit][/autoit] [autoit]Func _prodi ()
$ressH = $ressH + $prodi_h
$ressL = $ressL + $prodi_l
$ressE = $ressE + $prodi_e
GUICtrlSetData ( $Label_ressH, $ressH )
GUICtrlSetData ( $Label_ressL, $ressL )
GUICtrlSetData ( $Label_ressE, $ressE )
EndFunc
AutoIt zeigt mir immer an, dass zuviele Else da sind.
Aber wenn ich ein Else wegnehme, kommt wieder die gleiche, etc.