Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pytanie] Pytanie


Rekomendowane odpowiedzi

Opublikowano

No trzeba mi w SciTE Script Editor dodać taki kod bym w programie miał opcje wyłącz i gdy naduszam by sie wyłączył

Opublikowano

zacznij moze od tutków bo w autoit juz od poczaku zrobienia formy

 

guicreate('tytuł",500,500);jest buttonek do minimalizacji, max, i zamykania zwany iksem do zamykania:D

 

potem robisz

 switch guigetmsg();czyli wlacznik tych buttonków
case -3; odnosnik do iksa 
exit
endswitch 

i to dajesz do petli

while 1
tu
wend

zeby program sprawdzal czy przypadkiem nie wduszasz iksa

 

ps. jak masz pytania kliknij moja sygne "tu" i poczytaj troche

Do
$wiek+=1
Until ŻycieGetMsg() = -3

zbieram +

Opublikowano

mam napisane skopiowane kołko i krzyzyk i lekko przerobione tą wersje co nie da sie wygrac. i chcialbym dodac pare rzeczy do niej

 

Jak juz chcem zakonczyc program to co mam zrobic po prostu zapisac skrypt i tyle czy odpalic w folderze z AutoIT "AutoIt3.exe"

 

"AutoIt3.exe" - nie wiem CO to jest dokladnie nie wiem co w tym robic bo all robilem w tym co podalem wyzej

Opublikowano

hahah i podpisać ze to twoje a nawet nie umiesz tego zrobić odpuść sobie...

Do
$wiek+=1
Until ŻycieGetMsg() = -3

zbieram +

Opublikowano

Chcem po prostu na czyms nauczyc sie tej opcji i Tyle :P

 

 

Lekko przerobiona wersja

 

MsgBox(64,"Informacja", "Zapraszam do gry w kółko i krzyżyk")
#include <GUIConstants.au3>
#include <ARRAY.AU3>

Global $turn = True;true means player false means ai
Global $grid[4][4]
Global $button[4][4]
Global $string_eval[9]
Global $content[9]
Global $moves = 0
Global $computer_win = 0
Global $total = 0
Global $playerwin = 0

$content[1] = "31,32,33"
$content[2] = "21,22,23"
$content[3] = "11,12,13"
$content[4] = "11,22,33"
$content[5] = "11,21,31"
$content[6] = "12,22,32"
$content[7] = "13,23,33"
$content[8] = "13,22,31"

$Form1 = GUICreate("Kółko i krzyżyk", 326, 347, 193, 125)
GUICtrlCreateLabel("Komputer", 10, 10, 71, 17)
$cwin = GUICtrlCreateLabel("00", 90, 10, 25, 17)
GUICtrlCreateLabel("Ty", 140, 10, 55, 17)
$pwin = GUICtrlCreateLabel("00", 205, 10, 25, 17)
GUICtrlCreateLabel("Grałeś", 250, 10, 37, 17)
$games = GUICtrlCreateLabel("00", 295, 10, 16, 17)
$Button[1][1] = GUICtrlCreateButton("", 44, 72, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[1][2] = GUICtrlCreateButton("", 134, 72, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[1][3] = GUICtrlCreateButton("", 224, 72, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[2][3] = GUICtrlCreateButton("", 224, 152, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[2][1] = GUICtrlCreateButton("", 44, 152, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[2][2] = GUICtrlCreateButton("", 134, 152, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[3][3] = GUICtrlCreateButton("", 224, 232, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[3][2] = GUICtrlCreateButton("", 134, 232, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Button[3][1] = GUICtrlCreateButton("", 44, 232, 57, 57, 0)
GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Zaczynaj", 100, 40, 200, 17)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$reset = GUICtrlCreateButton("Reset", 60, 312, 97, 25, 0)
$exit = GUICtrlCreateButton("Wyjdź", 220, 312, 97, 25, 0)

GUISetState(@SW_SHOW)
GUICtrlSetOnEvent(-1, "Wyjdź")
Func Terminate()
       Exit
EndFunc
For $i = 1 to 3;column
   For $j = 1 to 3;row
       $grid[$i][$j] = 0
   Next
Next

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
       Case $GUI_EVENT_CLOSE
           Exit
       Case $button [1][1]
           If $grid[1][1] = 0 And BitAND(GUICtrlGetState($button [1][1]),$GUI_ENABLE) Then
               _clicked (1,1)
           EndIf
        Case $button [1][2]
           If $grid[1][2] = 0 And BitAND(GUICtrlGetState($button [1][2]),$GUI_ENABLE) Then
               _clicked (1,2)
           EndIf

       Case $button [1][3]
           If $grid[1][3] = 0 And BitAND(GUICtrlGetState($button [1][3]),$GUI_ENABLE) Then
               _clicked (1,3)
           EndIf

       Case $button [2][1]
           If $grid[2][1] = 0 And BitAND(GUICtrlGetState($button [2][1]),$GUI_ENABLE) Then
               _clicked (2,1)
           EndIf

       Case $button [2][2]
           If $grid[2][2] = 0 And BitAND(GUICtrlGetState($button [2][2]),$GUI_ENABLE) Then
               _clicked (2,2)
           EndIf

       Case $button [2][3]
           If $grid[2][3] = 0 And BitAND(GUICtrlGetState($button [2][3]),$GUI_ENABLE) Then
               _clicked (2,3)
           EndIf

       Case $button [3][1]
           If $grid[3][1] = 0 And BitAND(GUICtrlGetState($button [3][1]),$GUI_ENABLE) Then
               _clicked (3,1)
           EndIf

       Case $button[3][2]
            If $grid[3][2] = 0 And BitAND(GUICtrlGetState($button [3][2]),$GUI_ENABLE) Then
               _clicked (3,2)
           EndIf

       Case $button [3][3]
           If $grid[3][3] = 0 And BitAND(GUICtrlGetState($button [3][3]),$GUI_ENABLE) Then
               _clicked (3,3)
           EndIf
       Case $reset
           _ResetGrid()
   EndSwitch
   If $moves = 9 Then
       Select
           Case $computer_win = 1
               GUICtrlSetData ($Label1, "")
			MsgBox(64,"Informacja", "Przegrałeś")
               $moves = 0
           Case $playerwin = 1
               GUICtrlSetData ($Label1, "You Win - you shouldn't have.")
               $moves = 0
           Case $computer_win = 0 And $playerwin = 0
               GUICtrlSetData ($Label1, "")
			MsgBox(64,"Informacja", "Remis")
               $moves = 0
       EndSelect
   EndIf
WEnd

Func string_eval()
   For $j=1 To 8
       $string_eval[$j] = 0
   Next
   For $j=1 To 3
       $string_eval[1] +=  $grid[3][$j]
       $string_eval[2] +=  $grid[2][$j]
       $string_eval[3] +=  $grid[1][$j]
       $string_eval[5] +=  $grid[$j][1]
       $string_eval[6] +=  $grid[$j][2]
       $string_eval[7] +=  $grid[$j][3]
   Next
   $string_eval[4] =  $grid[1][1]+$grid[2][2]+$grid[3][3]
   $string_eval[8] =  $grid[1][3]+$grid[2][2]+$grid[3][1]
EndFunc

Func _clicked ($row, $column)
   If $moves = 9 Then Return
   Local $found_win = 0
       If $turn = true Then
           If BitAND(GUICtrlGetState($button [$row][$column]),$GUI_ENABLE) Then
               _SetButton($button[$row][$column], $grid[$row][$column], 5, "Thinking...", "X")
               $turn = False
               string_eval()
               For $i=1 To 8
                   If $string_eval[$i] = 15 Then   ;player won
                       $playerwin = 1
                       $moves = 9
                       Return
                   EndIf
               Next
               If $moves = 9 Then Return
           Else
               Return
           EndIf
       EndIf
       If $turn = False Then
           Select
               Case $moves = 1
                   If $grid[2][2] = 5 Then
                       _SetButton($button[1][1], $grid[1][1], 1, "Twój ruch")
                       If $moves = 9 Then Return
                       $turn = True
                       Return
                   EndIf
                   If $grid[2][2] = 0 Then
                       _SetButton($button[2][2], $grid[2][2], 1, "Twój ruch")
                       If $moves = 9 Then Return
                       $turn = True
                       Return
                   EndIf
               Case $moves >2
                   string_eval()
                   For $i=1 To 8
                       If $string_eval[$i] = 2 Then    ;go for win
                           $found_win = 1
                           $row_played = StringSplit($content[$i], ",")
                           For $k=1 To 3
                               $ids = StringSplit($row_played[$k], "")
                               If $grid[$ids[1]][$ids[2]] = 0 Then     ;3rd empty - play there
                                   GUICtrlSetData ($button[$ids[1]][$ids[2]], "O")
                                   GUICtrlSetState ($button[$ids[1]][$ids[2]], $gui_disable)
                                   $computer_win=1
                                   $grid[$ids[1]][$ids[2]] = 1
                                   $moves = 9
                                   Return
                               EndIf
                           Next
                       EndIf
                   Next
                   For $i=1 To 8
                       If $string_eval[$i] = 10 Then   ;2 in a row from player
                           $row_played = StringSplit($content[$i], ",")
                           For $k=1 To 3
                               $ids = StringSplit($row_played[$k], "")
                               If $grid[$ids[1]][$ids[2]] = 0 Then     ;3rd empty - play there
                                   _SetButton($button[$ids[1]][$ids[2]], $grid[$ids[1]][$ids[2]], 1, "Twój ruch")
                                   If $moves = 9 Then Return
                                   $turn = True
                                   Return
                               EndIf
                           Next
                       EndIf
                   Next
                   If $string_eval[4] = 11 Then
                       If $grid [1][1] = 5 And $grid [3][3] = 5 And $moves < 4 Then
                           _SetButton($button[1][2], $grid[1][2], 1, "Twój ruch")
                           If $moves = 9 Then Return
                           $turn = True
                           Return
                       EndIf
                       If $grid [2][2] = 5 And $grid [3][3] = 5 And $moves < 4 Then
                           _SetButton($button[1][3], $grid[1][3], 1, "Twój ruch")
                           If $moves = 9 Then Return
                           $turn = True
                           Return
                       EndIf
                   EndIf
                   If $grid [1][2] = 5 And $grid [3][3] = 5 And $moves < 4 Then
                       _SetButton($button[1][3], $grid[1][3], 1, "Twój ruch")
                       If $moves = 9 Then Return
                       $turn = True
                       Return
                   EndIf
                   If $grid [2][3] = 5 And $grid [3][2] = 5 And $moves < 4 Then
                       _SetButton($button[3][3], $grid[3][3], 1, "Twój ruch")
                       If $moves = 9 Then Return
                       $turn = True
                       Return
                   EndIf
                   If $grid [1][2] = 5 And $grid [3][1] = 5 And $moves < 4 Then
                       _SetButton($button[1][1], $grid[1][1], 1, "Twój ruch")
                       If $moves = 9 Then Return
                       $turn = True
                       Return
                   EndIf
                   For $x=1 To 8
                       If $string_eval[$x] <> 10 And $string_eval[$x] <> 2 Then    ;2 in a row from player
                           If $string_eval[$x] = 1 Then
                               $row_played = StringSplit($content[$x], ",")
                               For $k=1 To 3
                                   $ids = StringSplit($row_played[$k], "")
                                   If $grid[$ids[1]][$ids[2]] = 0 Then     ;3rd empty - play there
                                       _SetButton($button[$ids[1]][$ids[2]], $grid[$ids[1]][$ids[2]], 1, "Twój ruch")
                                       If $moves = 9 Then Return
                                       $turn = True
                                       Return
                                   EndIf
                               Next
                           ElseIf $string_eval[$x] = 5 Then
                               $row_played = StringSplit($content[$x], ",")
                               For $k=1 To 3
                                   $ids = StringSplit($row_played[$k], "")
                                   If $grid[$ids[1]][$ids[2]] = 0 Then     ;3rd empty - play there
                                       _SetButton($button[$ids[1]][$ids[2]], $grid[$ids[1]][$ids[2]], 1, "Twój ruch")
                                       If $moves = 9 Then Return
                                       $turn = True
                                       Return
                                   EndIf
                               Next
                           EndIf
                       EndIf
                   Next
           EndSelect
       EndIf
EndFunc

Func _SetButton($crt_pressed, ByRef $grid_pos, $grid_val, $label_txt, $label_but = "O")
   GUICtrlSetData ($crt_pressed, $label_but)
   GUICtrlSetState ($crt_pressed, $gui_disable)
   GUICtrlSetData ($Label1, $label_txt)
   $grid_pos = $grid_val
   $moves +=1
EndFunc

Func _ResetGrid()
   If $computer_win = 1 Then GUICtrlSetData($cwin, GUICtrlRead($cwin)+1)
   If $playerwin = 1 Then GUICtrlSetData($pwin, GUICtrlRead($pwin)+1)
   GUICtrlSetData ($Label1, "Twój ruch")
   For $i = 1 to 3;column
       For $j = 1 to 3;row
           $grid[$i][$j] = 0
           GUICtrlSetState($button[$i][$j], $GUI_ENABLE)
           GUICtrlSetData($button[$i][$j], "")
       Next
   Next
   $moves = 0
   $turn = True
   $total +=1
   $computer_win = 0
   $playerwin = 0
   GUICtrlSetData($games, $total)
EndFunc

Opublikowano

Hahaaa lekko, jedyne co tu zrobiłeś to dodałeś Msg na początku i spolszczyłeś kilka napisów w gui, choć z

GUICtrlSetData ($Label1, "You Win - you shouldn't have.")

Miałeś już chyba problem... Pierwszy raz widzę, aby nazwy funkcji mogły mieć polskojęzyczne znaki, wgl. nie napisałeś pierdolonej 3 linijkowej funkcji, która by ci wyszła z tego programu

Func Wyjdz()
    Exit
EndFunc

I ty chcesz się podpisać pod tą grą jak porządnie nie potrafisz jej nawet spolszczyć/dopisać chyba 3 najprostszych linijek?

czwartkowy posmak w ustach przypomina
że nie ma sensu owijać w bawełnę
zmarzniętego truchła

przez latarnię ktoś przerzucił sznur
cumuje statek w bezpieczną przystań

czuję jak na skroniach zasycha sól
...

Opublikowano

To czemu nie zrobisz sobie swojego gui? Ciężko

$zrobic_label=GUICtrlCreateLabel(>>F1<<)

?

czwartkowy posmak w ustach przypomina
że nie ma sensu owijać w bawełnę
zmarzniętego truchła

przez latarnię ktoś przerzucił sznur
cumuje statek w bezpieczną przystań

czuję jak na skroniach zasycha sól
...

Opublikowano

to po cholerę tak nudzisz jak wystarczy tylko poprawić $Form1 = GUICreate("Kółko i krzyżyk", 326, 347, 193, 125) i już możesz się chwalić w title że jesteś "AUTOREM" skryptu/programu

 

GUICtrlCreateLabel też doda do gui dowolny opis

If you = stupid then

insert(foot.in.your.ass)

end if

licznik-54-96732-stat.png

Opublikowano

Wiem ,że tak sie da ale chciałbym innaczej sie nauczyć :).

 

Z wyjściem z programu przez opcje wyjdź nie moge sobie poradzić dalej :/

 

Moze ktos podrzuci mi kod :) plusy będa :)

Opublikowano

Wiem ,że tak sie da ale chciałbym innaczej sie nauczyć :).

Ja też bym chciał się nauczyć programowania nie ucząc się tak jak się uczy 100% nowych programistów :<

 

Z wyjściem z programu przez opcje wyjdź nie moge sobie poradzić dalej :/

Jakbyś kurna psia glinianka nie zauważył to już ci tę funkcję napisałem

 

 

@Edit

czwartkowy posmak w ustach przypomina
że nie ma sensu owijać w bawełnę
zmarzniętego truchła

przez latarnię ktoś przerzucił sznur
cumuje statek w bezpieczną przystań

czuję jak na skroniach zasycha sól
...

Opublikowano

nie wiem w czym problem zacząć od robienia gui, nauki wstawiania opisów i przycisków itp, a potem dopiero nauczyć się jak do niego dopisać funkcje programu

 

gui prawie zawsze jest bezspośrednio zwiazane z programem jaki jest wykonywany , błąd w gui wywali program, błąd programu wywali gui

If you = stupid then

insert(foot.in.your.ass)

end if

licznik-54-96732-stat.png

Opublikowano

On chce nam wmówić, że nie chce podać się za autora kółka i krzyżyka.

czwartkowy posmak w ustach przypomina
że nie ma sensu owijać w bawełnę
zmarzniętego truchła

przez latarnię ktoś przerzucił sznur
cumuje statek w bezpieczną przystań

czuję jak na skroniach zasycha sól
...

Opublikowano
nIe chce sie podpisac!!! chce tylko nauczyc sie podpisywac ciezko bylo przeczytac z wczesciejszych moich wpisow ??

 

Nie chcę robić keyloggerów!! Ja tylko chcę wiedzieć jak mogę komuś ukraść konto i podpieprzyć jego pracę!!! Naprawdę, czysto teoretycznie!

 

Z wyjściem z programu przez opcje wyjdź nie moge sobie poradzić dalej :/

 

Na twoim miejscu wolałbym przeczytać tutoriale zanim zacząłbym się błaźnić i ośmieszać na publicznym forum.

Ta sygnatura jest pusta.

Opublikowano

10 postow potrzebuje/ spammm

 

Pierdolony metińczyk

czwartkowy posmak w ustach przypomina
że nie ma sensu owijać w bawełnę
zmarzniętego truchła

przez latarnię ktoś przerzucił sznur
cumuje statek w bezpieczną przystań

czuję jak na skroniach zasycha sól
...

Opublikowano

Napisz sobie proste GUI z Buttonem, gdzie wyskakuje ci okienko "Hello World!". Od tego się zaczyna.

 

Szczegółowe wytłumaczenie, jak czegoś nie wiesz, pytaj.

 

mlodyy_hrxqawq.PNG

To być input.

za duża sygnatura

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...