가위바위보
Gui, Add, Text, w100 cRed, Result
Gui, Font, s18 Gui, Add, Text, x70 Center, 컴퓨터 Gui, Add, Button, x10 gScis, 가위 Gui, Add, Button, x80 yp gFist, 바위 Gui, Add, Button, x150 yp gWrap, 보 Gui, Show, , 가위바위보 Return
Scis: Com() ;이름이 Com인 함수를 호출합니다. If Var=1 GuiControl, , Static1, 비겼습니다. If Var=2 GuiControl, , Static1, 졌습니다. If Var=3 GuiControl, , Static1, 이겼습니다. Return
Fist: Com() ;이름이 Com인 함수를 호출합니다. If Var=1 GuiControl, , Static1, 이겼습니다. If Var=2 GuiControl, , Static1, 비겼습니다. If Var=3 GuiControl, , Static1, 졌습니다. Return
Wrap: Com() ;이름이 Com인 함수를 호출합니다. If Var=1 GuiControl, , Static1, 졌습니다. If Var=2 GuiControl, , Static1, 이겼습니다. If Var=3 GuiControl, , Static1, 비겼습니다. Return
Com() ;컴퓨터 가위바위보 함수 { Global Var ;랜덤에서 나온 Var값은 함수바깥 If에서 사용하기 위해 전역변수로 변경 해줍니다. Com1 = 가위 Com2 = 바위 Com3 = 보 Random, Var, 1, 3 ;램덤명령어로 1~3 사이의 숫자를 Var변수에 담습니다. Computer := Com%Var% ;Com1, Com2, Com3의 값을 변수 Computer에 담아줍니다. GuiControl, , Static2, %Computer% ;GUI의 두번째 텍스트에 Computer값을 반영시켜줍니다. } |