Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.56 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseX64=n
  3. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #include <ButtonConstants.au3>
  5. #include <GUIConstantsEx.au3>
  6. #include <StaticConstants.au3>
  7. #include <WindowsConstants.au3>
  8. $Form1 = GUICreate("'Scheiß Spiel'", 596, 138, 192, 124)
  9. $1 = GUICtrlCreateCheckbox("1", 16, 88, 25, 17)
  10. $2 = GUICtrlCreateCheckbox("2", 48, 48, 25, 17)
  11. $3 = GUICtrlCreateCheckbox("3", 144, 16, 33, 17)
  12. $4 = GUICtrlCreateCheckbox("4", 232, 48, 25, 17)
  13. $5 = GUICtrlCreateCheckbox("5", 272, 88, 25, 17)
  14. $6 = GUICtrlCreateRadio("6", 144, 88, 25, 17)
  15. $Group1 = GUICtrlCreateGroup("Spielfeld", 8, 0, 321, 129)
  16. GUICtrlCreateGroup("", -99, -99, 1, 1)
  17. $Group2 = GUICtrlCreateGroup("Würfel", 336, 0, 161, 129)
  18. $Label1 = GUICtrlCreateLabel("Spieler 1 ist dran!", 344, 16, 129, 17)
  19. $Button1 = GUICtrlCreateButton("Würflen", 344, 48, 147, 41, $WS_GROUP)
  20. $Button2 = GUICtrlCreateButton("weiter", 344, 87, 147, 41, $WS_GROUP)
  21. GUICtrlCreateGroup("", -99, -99, 1, 1)
  22. $Group3 = GUICtrlCreateGroup("Sticks", 504, 0, 89, 129)
  23. $Label2 = GUICtrlCreateLabel("Du:", 512, 16, 21, 17)
  24. $SticksP = GUICtrlCreateLabel("IIIIIIIII", 512, 32, 71, 33)
  25. $Label4 = GUICtrlCreateLabel("Computer:", 512, 72, 52, 17)
  26. $SticksC = GUICtrlCreateLabel("IIIIIIIII", 513, 86, 71, 33)
  27. GUICtrlCreateGroup("", -99, -99, 1, 1)
  28. GUISetState(@SW_SHOW)
  29.  
  30. $next = False
  31. MsgBox(0, "Hilfe", "Drücke F1 für die Hilfe!")
  32. HotKeySet("{F1}", "_Help")
  33. While 1
  34.     $nMsg = GUIGetMsg()
  35.     Switch $nMsg
  36.         Case $GUI_EVENT_CLOSE
  37.             Exit
  38.         Case $Button1
  39.             _GoUser()
  40.         Case $Button2
  41.             _weiter("User")
  42.     EndSwitch
  43. WEnd
  44.  
  45. Func _GoPC()
  46.     $next = False
  47.     $W = Random(1, 6, 1)
  48.     $nNext = Random(0, 1, 1)
  49.     If $nNext = 1 Then _weiter("PC")
  50.     GUICtrlSetData($Label1, "Computer hat " & $W & " gewürfelt!")
  51.     Switch $W
  52.         Case 1
  53.             If GUICtrlRead($1) = $GUI_CHECKED Then
  54.                 GUICtrlSetState($1, $GUI_UNCHECKED)
  55.                 $sticks = GUICtrlRead($SticksC)
  56.                 GUICtrlSetData($SticksC, $sticks & "I")
  57.                 MsgBox(0, "Nächster", "Du bist der nächste!")
  58.             Else
  59.                 GUICtrlSetState($1, $GUI_CHECKED)
  60.                 $sticks = GUICtrlRead($SticksC)
  61.                 If Not $sticks = "" Then
  62.                     GUICtrlSetData($SticksC, StringRight($sticks, StringLen($sticks) - 1))
  63.                 Else
  64.                     MsgBox(0, "Verloren!", "Tut mir leid aber der Computer hat gewonnen!")
  65.                 EndIf
  66.                 _GoPC()
  67.             EndIf
  68.         Case 2
  69.             If GUICtrlRead($2) = $GUI_CHECKED Then
  70.                 GUICtrlSetState($2, $GUI_UNCHECKED)
  71.                 $sticks = GUICtrlRead($SticksC)
  72.                 GUICtrlSetData($SticksC, $sticks & "I")
  73.                 MsgBox(0, "Nächster", "Du bist der nächste!")
  74.             Else
  75.                 GUICtrlSetState($2, $GUI_CHECKED)
  76.                 $sticks = GUICtrlRead($SticksC)
  77.                 If Not $sticks = "" Then
  78.                     GUICtrlSetData($SticksC, StringRight($sticks, StringLen($sticks) - 1))
  79.                 Else
  80.                     MsgBox(0, "Verloren!", "Tut mir leid aber der Computer hat gewonnen!")
  81.                 EndIf
  82.                 _GoPC()
  83.             EndIf
  84.         Case 3
  85.             If GUICtrlRead($3) = $GUI_CHECKED Then
  86.                 GUICtrlSetState($3, $GUI_UNCHECKED)
  87.                 $sticks = GUICtrlRead($SticksC)
  88.                 GUICtrlSetData($SticksC, $sticks & "I")
  89.                 MsgBox(0, "Nächster", "Du bist der nächste!")
  90.             Else
  91.                 GUICtrlSetState($3, $GUI_CHECKED)
  92.                 $sticks = GUICtrlRead($SticksC)
  93.                 If Not $sticks = "" Then
  94.                     GUICtrlSetData($SticksC, StringRight($sticks, StringLen($sticks) - 1))
  95.                 Else
  96.                     MsgBox(0, "Verloren!", "Tut mir leid aber der Computer hat gewonnen!")
  97.                 EndIf
  98.                 _GoPC()
  99.             EndIf
  100.         Case 4
  101.             If GUICtrlRead($4) = $GUI_CHECKED Then
  102.                 GUICtrlSetState($1, $GUI_UNCHECKED)
  103.                 $sticks = GUICtrlRead($SticksC)
  104.                 GUICtrlSetData($SticksC, $sticks & "I")
  105.                 MsgBox(0, "Nächster", "Du bist der nächste!")
  106.             Else
  107.                 GUICtrlSetState($4, $GUI_CHECKED)
  108.                 $sticks = GUICtrlRead($SticksC)
  109.                 If Not $sticks = "" Then
  110.                     GUICtrlSetData($SticksC, StringRight($sticks, StringLen($sticks) - 1))
  111.                 Else
  112.                     MsgBox(0, "Verloren!", "Tut mir leid aber der Computer hat gewonnen!")
  113.                 EndIf
  114.                 _GoPC()
  115.             EndIf
  116.         Case 5
  117.             If GUICtrlRead($5) = $GUI_CHECKED Then
  118.                 GUICtrlSetState($5, $GUI_UNCHECKED)
  119.                 $sticks = GUICtrlRead($SticksC)
  120.                 GUICtrlSetData($SticksC, $sticks & "I")
  121.                 MsgBox(0, "Nächster", "Du bist der nächste!")
  122.             Else
  123.                 GUICtrlSetState($5, $GUI_CHECKED)
  124.                 $sticks = GUICtrlRead($SticksC)
  125.                 If Not $sticks = "" Then
  126.                     GUICtrlSetData($SticksC, StringRight($sticks, StringLen($sticks) - 1))
  127.                 Else
  128.                     MsgBox(0, "Verloren!", "Tut mir leid aber der Computer hat gewonnen!")
  129.                 EndIf
  130.                 _GoPC()
  131.             EndIf
  132.         Case 6
  133.             GUICtrlSetState($6, $GUI_CHECKED)
  134.             Sleep(1000)
  135.             GUICtrlSetState($6, $GUI_UNCHECKED)
  136.             _GoPC()
  137.     EndSwitch
  138. EndFunc   ;==>_GoPC
  139.  
  140. Func _GoUser()
  141.     $W = Random(1, 6, 1)
  142.     $next = True
  143.     GUICtrlSetData($Label1, "Spieler 1 hat " & $W & " gewürfelt!")
  144.     Switch $W
  145.         Case 1
  146.             If GUICtrlRead($1) = $GUI_CHECKED Then
  147.                 GUICtrlSetState($1, $GUI_UNCHECKED)
  148.                 $sticks = GUICtrlRead($SticksP)
  149.                 GUICtrlSetData($SticksP, $sticks & "I")
  150.                 MsgBox(0, "Eins Ziehen!", "Tut mir leid! Aber du musst ein Stick ziehen!")
  151.                 _GoPC()
  152.             Else
  153.                 GUICtrlSetState($1, $GUI_CHECKED)
  154.                 $sticks = GUICtrlRead($SticksP)
  155.                 If Not $sticks = "" Then
  156.                     GUICtrlSetData($SticksP, StringRight($sticks, StringLen($sticks) - 1))
  157.                 Else
  158.                     MsgBox(0, "Gewonnen!", "Glückwunsch! Du hast den Computer geschlagen und gewonnen!")
  159.                 EndIf
  160.             EndIf
  161.         Case 2
  162.             If GUICtrlRead($2) = $GUI_CHECKED Then
  163.                 GUICtrlSetState($2, $GUI_UNCHECKED)
  164.                 $sticks = GUICtrlRead($SticksP)
  165.                 MsgBox(0, "", $sticks)
  166.                 GUICtrlSetData($SticksP, $sticks & "I")
  167.                 MsgBox(0, "Eins Ziehen!", "Tut mir leid! Aber du musst ein Stick ziehen!")
  168.                 _GoPC()
  169.             Else
  170.                 GUICtrlSetState($2, $GUI_CHECKED)
  171.                 $sticks = GUICtrlRead($SticksP)
  172.                 If Not $sticks = "" Then
  173.                     GUICtrlSetData($SticksP, StringRight($sticks, StringLen($sticks) - 1))
  174.                 Else
  175.                     MsgBox(0, "Gewonnen!", "Glückwunsch! Du hast den Computer geschlagen und gewonnen!")
  176.                 EndIf
  177.             EndIf
  178.         Case 3
  179.             If GUICtrlRead($3) = $GUI_CHECKED Then
  180.                 GUICtrlSetState($3, $GUI_UNCHECKED)
  181.                 $sticks = GUICtrlRead($SticksP)
  182.                 GUICtrlSetData($SticksP, $sticks & "I")
  183.                 MsgBox(0, "Eins Ziehen!", "Tut mir leid! Aber du musst ein Stick ziehen!")
  184.                 _GoPC()
  185.             Else
  186.                 GUICtrlSetState($3, $GUI_CHECKED)
  187.                 $sticks = GUICtrlRead($SticksP)
  188.                 If Not $sticks = "" Then
  189.                     GUICtrlSetData($SticksP, StringRight($sticks, StringLen($sticks) - 1))
  190.                 Else
  191.                     MsgBox(0, "Gewonnen!", "Glückwunsch! Du hast den Computer geschlagen und gewonnen!")
  192.                 EndIf
  193.             EndIf
  194.         Case 4
  195.             If GUICtrlRead($4) = $GUI_CHECKED Then
  196.                 GUICtrlSetState($1, $GUI_UNCHECKED)
  197.                 $sticks = GUICtrlRead($SticksP)
  198.                 GUICtrlSetData($SticksP, $sticks & "I")
  199.                 MsgBox(0, "Eins Ziehen!", "Tut mir leid! Aber du musst ein Stick ziehen!")
  200.                 _GoPC()
  201.             Else
  202.                 GUICtrlSetState($4, $GUI_CHECKED)
  203.                 $sticks = GUICtrlRead($SticksP)
  204.                 If Not $sticks = "" Then
  205.                     GUICtrlSetData($SticksP, StringRight($sticks, StringLen($sticks) - 1))
  206.                 Else
  207.                     MsgBox(0, "Gewonnen!", "Glückwunsch! Du hast den Computer geschlagen und gewonnen!")
  208.                 EndIf
  209.             EndIf
  210.         Case 5
  211.             If GUICtrlRead($5) = $GUI_CHECKED Then
  212.                 GUICtrlSetState($5, $GUI_UNCHECKED)
  213.                 $sticks = GUICtrlRead($SticksP)
  214.                 GUICtrlSetData($SticksP, $sticks & "I")
  215.                 MsgBox(0, "Eins Ziehen!", "Tut mir leid! Aber du musst ein Stick ziehen!")
  216.                 _GoPC()
  217.             Else
  218.                 GUICtrlSetState($5, $GUI_CHECKED)
  219.                 $sticks = GUICtrlRead($SticksP)
  220.                 If Not $sticks = "" Then
  221.                     GUICtrlSetData($SticksP, StringRight($sticks, StringLen($sticks) - 1))
  222.                 Else
  223.                     MsgBox(0, "Gewonnen!", "Glückwunsch! Du hast den Computer geschlagen und gewonnen!")
  224.                 EndIf
  225.             EndIf
  226.         Case 6
  227.             GUICtrlSetState($6, $GUI_CHECKED)
  228.             MsgBox(0, "6 Gewürfelt", "Glückwunsch du hast die 6 gewürfelt!")
  229.             GUICtrlSetState($6, $GUI_UNCHECKED)
  230.     EndSwitch
  231. EndFunc   ;==>_GoUser
  232.  
  233. Func _Help()
  234.     MsgBox(0, "Hilfe", "Das Ziel ist es möglichst schnell alle Sticks weg zu bekommen." & @CRLF & _
  235.             "Dazu Würfelst du, und setzt einen Stick auf das Feld das du gewürfelt hast. Das Script macht dies sogar automatisch." & @CRLF & _
  236.             "Ist in dem Feld jedoch schon ein Stick musst du diesen herausnehmen und der Gegner ist dran." & @CRLF & _
  237.             "Bist du dran und hattest gerade einmal gewürfelt, kannst du den Würfel weiter geben!")
  238. EndFunc   ;==>_Help
  239.  
  240. Func _weiter($who)
  241.     Switch $who
  242.         Case "User"
  243.             If $next = True Then
  244.                 _GoPC()
  245.             Else
  246.                 MsgBox(0, "Tut mir leid!", "Tut mir leid, aber du musst noch einmal würfeln!")
  247.             EndIf
  248.         Case "PC"
  249.             If $next = False Then
  250.                 _GoUser()
  251.             Else
  252.             EndIf
  253.     EndSwitch
  254. EndFunc   ;==>_weiter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement