Advertisement
Wibble199

LoL timer revised

Nov 18th, 2012
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.45 KB | None | 0 0
  1. #include <GUIConstantsEx.au3>
  2. #include <ButtonConstants.au3>
  3.  
  4. ;==> Set our $font variable
  5. Global $font
  6. $font = "Arial Black"
  7.  
  8. ;Constants
  9. Const $sleepLen = 100
  10. ; New variables
  11. Dim $ybluebuffactive = False
  12. Dim $ybluebuffcounter = 0
  13.  
  14. ;==> Create our Graphic User Interface
  15. ;Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
  16. $mainwindow = GUICreate("Jungle Timers Deluxe", 200, 400)
  17. $startbutton = GUICtrlCreateButton("Start Game", 50, 10, 70)
  18. $ybluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 10, 40, 50, 50, $BS_MULTILINE)
  19. $yredbuff = GUICtrlCreateButton("Lizard Elder (Red)", 10, 110, 50, 50, $BS_MULTILINE)
  20. $ywraiths = GUICtrlCreateButton("Lizard Elder (Red)", 10, 180, 50, 50, $BS_MULTILINE)
  21. $ywolves = GUICtrlCreateButton("Lizard Elder (Red)", 10, 250, 50, 50, $BS_MULTILINE)
  22. $ydgolems = GUICtrlCreateButton("Lizard Elder (Red)", 10, 320, 50, 50, $BS_MULTILINE)
  23. $ebluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 100, 40, 50, 50,     $BS_MULTILINE)
  24. $eredbuff = GUICtrlCreateButton("Lizard Elder (Red)", 100, 110, 50, 50, $BS_MULTILINE)
  25. $ewraiths = GUICtrlCreateButton("Lizard Elder (Red)", 100, 180, 50, 50, $BS_MULTILINE)
  26. $ewolves = GUICtrlCreateButton("Lizard Elder (Red)", 100, 250, 50, 50, $BS_MULTILINE)
  27. $edgolems = GUICtrlCreateButton("Lizard Elder (Red)", 100, 320, 50, 50, $BS_MULTILINE)
  28.  
  29. ;==> Display our Graphic User Interface.
  30. GUISetState(@SW_SHOW)
  31.  
  32. While True
  33.     ; Check which buttons have been pressed
  34.     $msg = GUIGetMsg()
  35.     Switch $msg
  36.     Case $GUI_EVENT_CLOSE
  37.         CLOSEClicked()
  38.     Case $startbutton
  39.         StartGame()
  40.         ; If this is run at the same time as a timer, it would cause the timer to be off of its original time
  41.     Case $ybluebuff
  42.         ; Start the timer
  43.         $ybluebuffactive = True
  44.         ; Reset the counter
  45.         $ybluebuffcounter = 0
  46.         ; Delete the controls and make the new ones
  47.         $ybb = GUICtrlCreateLabel("Your Blue Buff:", 10, 40)
  48.         GUICtrlDelete($ybluebuff)
  49.         Global $ybblabel = GUICtrlCreateLabel("0", 15, 60, 50, 40)
  50.         GUICtrlSetFont(-1, 22, 500, $font)
  51.     EndSwitch
  52.     sleep($sleepLen)
  53.     checkYBlueBuff()
  54. WEnd
  55.  
  56. Func checkYBlueBuff()
  57.     If $ybluebuffactive Then
  58.         $ybluebuffcounter += 1
  59.         If $ybluebuffcounter = (1000/$sleepLen)*5 Then
  60.             ; Set the back color
  61.             GUICtrlSetBkColor($ybblabel, 0xFFCCCC)
  62.         EndIf
  63.         ; Update the label & font
  64.         If Mod($ybluebuffcounter, (1000/$sleepLen)) = 0 Then
  65.             GUICtrlSetData($ybblabel, Round($ybluebuffcounter/(1000/$sleepLen)))
  66.         EndIf
  67.         If $ybluebuffcounter >= (1000/$sleepLen)*10 Then ; This is 10 (buff time) * 10 (a hundred of these checks per second)
  68.             ; Reset the controls
  69.             $ybluebuffactive = False
  70.             GUICtrlDelete($ybblabel)
  71.             GUICtrlDelete($ybb)
  72.             $ybluebuff = GUICtrlCreateButton("Ancient Golem (Blue)", 10, 40, 50, 50, $BS_MULTILINE)
  73.         EndIf
  74.     EndIf
  75. EndFunc
  76.  
  77. Func StartGame()
  78. ; Activate your League Window
  79.     WinActivate("[CLASS:Notepad]")
  80.  
  81. ; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems
  82.     WinWaitActive("[CLASS:Notepad]")
  83.  
  84. ; Now that the Notepad window is active type some text
  85.     Send("{ENTER}Baron spawns in 15, Dragon spawns at 2:30{ENTER}")
  86.     Sleep(500)
  87.     Send("{ENTER}Wraiths/Wolves/Double Golems spawn at 1:40. Red & Blue spawn at 1:55{ENTER}")
  88.     Sleep(500)
  89.  
  90. EndFunc   ;==>StartGame
  91.  
  92.     Func CLOSEClicked()
  93. ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  94. ;and @GUI_WINHANDLE would equal $mainwindow
  95.     MsgBox(0, "Goodbye", "Thanks for using Jungle Timers Deluxe!")
  96.     Exit
  97. EndFunc   ;==>CLOSEClicked
  98.  
  99. ; Finished!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement