2012-10-22 6 views
0

League of Legends에 대한 타이머를 만드는 것이 목표입니다. 그것은 정글 캠프가 있습니다. 각자는 그것을 죽인 후에 일정한 시간을 다시 말합니다.여러 기능을 동시에 실행

이렇게하려면 여러 타이머에 대해 동일한 기능을 동시에 활성화하고 싶습니다. 내가 푸른 담황색의 늑대와 늑대를 죽인다면 동시에 두 마리의 타이머가 필요합니다. (내 늑대를위한 푸른 골렘의 단추를 클릭하면 같은 타이머를 얻을 수 있습니다).

나는 늑대 버튼을 구현하지 않았지만 시작 버튼이 있습니다. 파란색 버튼을 클릭하면 내 타이머가 시작되지만 게임 시작 버튼을 클릭하면 첫 번째 타이머가 끝날 때까지 대기합니다.

나는 the wiki page을 들여다 보았다. 하지만 나는 달리기 타이머를 멈추고 싶지 않습니다. 나는 동시에 다른 것을 달리기를 원한다. 코딩 오류, 더 나은 방법 등이 있습니까?

#include <GUIConstantsEx.au3> 
#include <ButtonConstants.au3> 
#include <Timers.au3> 

;==> Set our $font variable 
Global $font 
$font = "Arial Black" 

;==> Create our Graphic User Interface 
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode 
$mainwindow = GUICreate("Jungle Timers Deluxe", 200, 400) 
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") 
$startbutton = GUICtrlCreateButton("Start Game", 50, 10, 70) 
$ybluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 10, 40, 50, 50, $BS_MULTILINE) 
$yredbuff = GUICtrlCreateButton("Lizard Elder (Red)", 10, 110, 50, 50, $BS_MULTILINE) 
$ywraiths = GUICtrlCreateButton("Lizard Elder (Red)", 10, 180, 50, 50, $BS_MULTILINE) 
$ywolves = GUICtrlCreateButton("Lizard Elder (Red)", 10, 250, 50, 50, $BS_MULTILINE) 
$ydgolems = GUICtrlCreateButton("Lizard Elder (Red)", 10, 320, 50, 50, $BS_MULTILINE) 
$ebluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 100, 40, 50, 50,  $BS_MULTILINE) 
$eredbuff = GUICtrlCreateButton("Lizard Elder (Red)", 100, 110, 50, 50, $BS_MULTILINE) 
$ewraiths = GUICtrlCreateButton("Lizard Elder (Red)", 100, 180, 50, 50, $BS_MULTILINE) 
$ewolves = GUICtrlCreateButton("Lizard Elder (Red)", 100, 250, 50, 50, $BS_MULTILINE) 
$edgolems = GUICtrlCreateButton("Lizard Elder (Red)", 100, 320, 50, 50, $BS_MULTILINE) 
;==> Create our events 
GUICtrlSetOnEvent($startbutton, "StartGame") 
GUICtrlSetOnEvent($ybluebuff, "yBlueBuff") 
;==> Display our Graphic User Interface. 
GUISetState(@SW_SHOW) 
While 1 
Sleep(1000) ; Idle around 
WEnd 
Func yBlueBuff() 
Dim $bluetimer = 10 
$i = 1 
$ybb = GUICtrlCreateLabel("Your Blue Buff:", 10, 40) 
GUICtrlDelete($ybluebuff) 
$ybblabel = GUICtrlCreateLabel($i, 15, 60, 50, 40) 
While $i <= $bluetimer 
    GUICtrlDelete($ybblabel) 
    If $i >= 5 Then 
     $ybblabel = GUICtrlCreateLabel($i, 15, 60, 50, 40) 
     GUICtrlSetFont(-1, 22, 500, $font) 
     GUICtrlSetBkColor($ybblabel, 0xFFCCCC) 
     $i = $i + 1 
    ElseIf $i < 5 Then 
     $ybblabel = GUICtrlCreateLabel($i, 15, 60, 50, 40) 
     GUICtrlSetFont(-1, 22, 500, $font) 
     $i = $i + 1 
    EndIf 
    Sleep(1000) 
WEnd 
GUICtrlDelete($ybblabel) 
GUICtrlDelete($ybb) 
$ybluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 10, 40, 50, 50, $BS_MULTILINE) 
EndFunc ;==>yBlueBuff 

Func StartGame() 
    ; Activate your League Window 
    WinActivate("[CLASS:Notepad]") 

    ; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems 
    WinWaitActive("[CLASS:Notepad]") 

    ; Now that the Notepad window is active type some text 
    Send("{ENTER}Baron spawns in 15, Dragon spawns at 2:30{ENTER}") 
    Sleep(500) 
    Send("{ENTER}Wraiths/Wolves/Double Golems spawn at 1:40. Red & Blue spawn at 1:55{ENTER}") 
    Sleep(500) 

EndFunc ;==>StartGame 

Func CLOSEClicked() 
    ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
    ;and @GUI_WINHANDLE would equal $mainwindow 
    MsgBox(0, "GUI Event", "Thanks for using Jungle Timers Deluxe!") 
    Exit 
EndFunc ;==>CLOSEClicked 

; Finished! 

내가 Notepad 예 자습서를이을 구축하고 디버깅하기 쉽기 때문에 메모장을 사용하여 : 여기 내 코드입니다.

+1

타이머 및 나머지 GUI 기능이 작동하려면 창 메시지 핸들러가 필요합니다. 예제는 사용자 정의 타이머 기능 카테고리 도움말을 참조하십시오. – Jay

답변

3

AutoIt은 두 가지 기능 (동시에 멀티 스레딩이라고 함)을 동시에 실행할 수 없습니다. 여기

는 설명입니다 AutoItNotOnToDoList 프로그램이 당신은 끊임없이 버튼을 누르면되고 있는지 여부를 모니터링 할 수 있어야하고 동시에 호출되는 기능을 수행 할 작동하기 위해서는

버튼으로

기술적으로 mulithreading은 아니지만이 문제의 해결 방법은 동시에 여러 스크립트를 실행하는 것입니다.

관련 문제