• So hier mal ein Script für Zwischendurch:

    kaffe automat !!!

    Überpprüft nich ob buchstaben oder zahl, aber es war nur zum entspannen

    Spoiler anzeigen
    [autoit]


    ;Kaffe Automat 1.0
    ;0,01 € / 0,05€ / 0,10 € / 0,20€/ 0,50€ / 1€ / 2€
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    Global $KaffeValue = 0
    Global $ZuckerValue = 0
    Global $MilchValue = 0
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Kaffe Automat", 370, 320, 192, 124)
    $Kaffe = GUICtrlCreateCheckbox("Kaffe", 26, 52, 97, 17)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Zucker = GUICtrlCreateCheckbox("Zucker", 26, 74, 97, 17)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Milch = GUICtrlCreateCheckbox("Milch", 26, 96, 97, 17)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $KaffeAusgabe = GUICtrlCreateButton("Gib mir Kaffe", 76, 290, 145, 25, $WS_GROUP)
    $Label1 = GUICtrlCreateLabel("Was möchtest du trinken ?", 24, 6, 308, 33)
    GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bezahlen !", 30, 134, 103, 22)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("0,01 €", 32, 174, 34, 17)
    $Label4 = GUICtrlCreateLabel("0,05 €", 31, 199, 34, 17)
    $Label5 = GUICtrlCreateLabel("0,10 €", 32, 224, 34, 17)
    $Label6 = GUICtrlCreateLabel("0,20 €", 32, 249, 34, 17)
    $Label7 = GUICtrlCreateLabel("0,50 €", 151, 173, 34, 17)
    $Label8 = GUICtrlCreateLabel("1,00 €", 151, 196, 34, 17)
    $Label9 = GUICtrlCreateLabel("2,00 €", 152, 222, 34, 17)
    $Cent1 = GUICtrlCreateInput("0", 70, 174, 73, 21)
    $Cent2 = GUICtrlCreateInput("0", 70, 199, 73, 21)
    $Cent10 = GUICtrlCreateInput("0", 70, 223, 73, 21)
    $Cent20 = GUICtrlCreateInput("0", 69, 246, 73, 21)
    $Cent50 = GUICtrlCreateInput("0", 194, 172, 73, 21)
    $Euro1 = GUICtrlCreateInput("0", 194, 197, 73, 21)
    $Euro2 = GUICtrlCreateInput("0", 195, 222, 73, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $Kaffe
    If $KaffeValue = 0 Then
    $KaffeValue = 1
    Else
    $KaffeValue = 0
    EndIf

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

    Case $Zucker
    If $ZuckerValue = 0 Then
    $ZuckerValue = 1
    Else
    $ZuckerValue = 0
    EndIf

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

    Case $Milch
    If $MilchValue = 0 Then
    $MilchValue = 1
    Else
    $MilchValue = 0
    EndIf

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

    ;1 Kaffee 1 €
    ;+ Zucker 0,20 €
    ;+ Milch 0,49 €

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

    Case $KaffeAusgabe

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

    ;Nur Kaffe

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

    If $KaffeValue = 0 Then
    MsgBox(0, "Error", "Du musst schon Kaffe kaufen !")
    ElseIf $KaffeValue = 1 and $ZuckerValue = 0 and $MilchValue = 0 Then
    Local $Kosten = 1
    Local $1CentStk = GUICtrlRead($Cent1)/100
    Local $5CentStk = GUICtrlRead($Cent2)/20
    Local $10CentStk = GUICtrlRead($Cent10)/10
    Local $20CentStk = GUICtrlRead($Cent20)/5
    Local $50CentStk = GUICtrlRead($Cent50)/2
    Local $1EuroStk = GUICtrlRead($Euro1)
    Local $2EuroStk = GUICtrlRead($Euro2)*2
    Local $GesamtGeldZahlen = $1CentStk+$5CentStk+$10CentStk+$20CentStk+$50CentStk+$1EuroStk+$2EuroStk
    If $GesamtGeldZahlen < $Kosten Then
    MsgBox(0, "Error", "Du hast nicht genügend Geld, dir fehlen "&$Kosten-$GesamtGeldZahlen&" € !")
    Else
    MsgBox(0, "Guten Appetit", "Guten Appetit mit deinem Kaffe, du bekommst "&($Kosten-$GesamtGeldZahlen)*-1&" € Rückgeld !")
    EndIf
    ElseIf $KaffeValue = 1 and $ZuckerValue = 1 and $MilchValue = 0 Then
    Local $Kosten = 1.20
    Local $1CentStk = GUICtrlRead($Cent1)/100
    Local $5CentStk = GUICtrlRead($Cent2)/20
    Local $10CentStk = GUICtrlRead($Cent10)/10
    Local $20CentStk = GUICtrlRead($Cent20)/5
    Local $50CentStk = GUICtrlRead($Cent50)/2
    Local $1EuroStk = GUICtrlRead($Euro1)
    Local $2EuroStk = GUICtrlRead($Euro2)*2
    Local $GesamtGeldZahlen = $1CentStk+$5CentStk+$10CentStk+$20CentStk+$50CentStk+$1EuroStk+$2EuroStk
    If $GesamtGeldZahlen < $Kosten Then
    MsgBox(0, "Error", "Du hast nicht genügend Geld, dir fehlen "&$Kosten-$GesamtGeldZahlen&" € !")
    Else
    MsgBox(0, "Guten Appetit", "Guten Appetit mit deinem Kaffe mit Zucker !"&@CRLF&"Du bekommst "&($Kosten-$GesamtGeldZahlen)*-1&" € Rückgeld !")
    EndiF
    ElseIf $KaffeValue = 1 and $ZuckerValue = 0 and $MilchValue = 1 Then
    Local $Kosten = 1.49
    Local $1CentStk = GUICtrlRead($Cent1)/100
    Local $5CentStk = GUICtrlRead($Cent2)/20
    Local $10CentStk = GUICtrlRead($Cent10)/10
    Local $20CentStk = GUICtrlRead($Cent20)/5
    Local $50CentStk = GUICtrlRead($Cent50)/2
    Local $1EuroStk = GUICtrlRead($Euro1)
    Local $2EuroStk = GUICtrlRead($Euro2)*2
    Local $GesamtGeldZahlen = $1CentStk+$5CentStk+$10CentStk+$20CentStk+$50CentStk+$1EuroStk+$2EuroStk
    If $GesamtGeldZahlen < $Kosten Then
    MsgBox(0, "Error", "Du hast nicht genügend Geld, dir fehlen "&$Kosten-$GesamtGeldZahlen&" € !")
    Else
    MsgBox(0, "Guten Appetit", "Guten Appetit mit deinem Kaffe mit Milch !"&@CRLF&"Du bekommst "&($Kosten-$GesamtGeldZahlen)*-1&" € Rückgeld !")
    EndIf
    ElseIf $KaffeValue = 1 and $ZuckerValue = 1 and $MilchValue = 1 Then
    Local $Kosten = 1.69
    Local $1CentStk = GUICtrlRead($Cent1)/100
    Local $5CentStk = GUICtrlRead($Cent2)/20
    Local $10CentStk = GUICtrlRead($Cent10)/10
    Local $20CentStk = GUICtrlRead($Cent20)/5
    Local $50CentStk = GUICtrlRead($Cent50)/2
    Local $1EuroStk = GUICtrlRead($Euro1)
    Local $2EuroStk = GUICtrlRead($Euro2)*2
    Local $GesamtGeldZahlen = $1CentStk+$5CentStk+$10CentStk+$20CentStk+$50CentStk+$1EuroStk+$2EuroStk
    If $GesamtGeldZahlen < $Kosten Then
    MsgBox(0, "Error", "Du hast nicht genügend Geld, dir fehlen "&$Kosten-$GesamtGeldZahlen&" € !")
    Else
    MsgBox(0, "Guten Appetit", "Guten Appetit mit deinem Kaffe mit Zucker und Milch !"&@CRLF&"Du bekommst "&($Kosten-$GesamtGeldZahlen)*-1&" € Rückgeld !")
    EndIf
    EndIf

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

    EndSwitch
    WEnd

    [/autoit]

    Wie sagt man so schön:


    Genieß"t" es !

    Es gibt sehr viele Leute, die glauben. Aber aus Aberglauben.
    - Blaise Pascal

    Einmal editiert, zuletzt von EliteMattthias (13. Mai 2010 um 14:57)

  • Du solltest vlt ein wenig auf design achten und die münzeninput vlt auf eine beschränken und diese per komma eingabe

    MFg.Simon

  • hmm komischer automat....
    1,69 € soll ich bezahlen und wenn ich das tue sagt er 5 cent fehlen, wenn ich die 5cent dazu tue sagt er 4cent fehlen, die tue ich dazu --> 1cent fehlet, 1cent dazu, 1ent fehlt 1cent dazu --00,00 rückgeld ;)

  • wieso so zeilenaufwendig??

    [autoit]

    Local $1CentStk = GUICtrlRead($Cent1)/100
    Local $5CentStk = GUICtrlRead($Cent2)/100
    Local $10CentStk = GUICtrlRead($Cent10)/10
    Local $20CentStk = GUICtrlRead($Cent20)/5
    Local $50CentStk = GUICtrlRead($Cent50)/2
    Local $1EuroStk = GUICtrlRead($Euro1)
    Local $2EuroStk = GUICtrlRead($Euro2)

    [/autoit]

    mach das doch in einen switch rein... (Switch $Preis ;... Case 1.69 oder so
    jedesmal wieder den selben dreck aufschreiben ist ein wenig hirnlos (nichts gegen dich)

  • ja hehehe ;)

    Naja werd mich mal dran setzen das in GDI+ Grafisch und mit bestimmter geldvorgabe zu machen !

    Es gibt sehr viele Leute, die glauben. Aber aus Aberglauben.
    - Blaise Pascal