MrBrasta Posted July 12, 2013 Posted July 12, 2013 (edited) hello, I'm very new to autoit, I only had experience with java language. But I'm trying to make a timer. So I'll explain what I'm trying to do: 1) the first 7 seconds (after I pressed the button) should show up normally 2) the following 80 seconds should show up with an orange background but when 1) is finished the timer should be resetted and start counting to 80 with the orange background 3) then if 2) is finished the timer should be resseted to and start counting to 6 with a red background 4) finally if 3) is finished the timer should reset again and start counting ip to 8minutes and I want it so it displays minutes : seconds 5) after all this is finished it should start from the beginning again expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> ;==> Set our $font variable Global $font $font = "Arial Black" ;Constants Const $sleepLen = 100 ; New variables Dim $check1 = False Dim $check2 = False Dim $check3 = False Dim $check4 = False Dim $botcounter = 0 ;==> Create our Graphic User Interface ;Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $varWindow = GUICreate("Jungle Timers Deluxe", 150, 400, 1675, 30) $startbutton = GUICtrlCreateButton("start bot", 10, 10, 100, 50, $BS_MULTILINE) $varButtonTopmost = GUICtrlCreateButton("window topmost", 10, 60, 100, 50) $varButtonNormal = GUICtrlCreateButton("window normal", 10, 110, 100, 50) $varLoop = True ;==> Display our Graphic User Interface. GUISetState(@SW_SHOW) While $varLoop $varMessage = GUIGetMsg() Select Case $varMessage = $GUI_EVENT_CLOSE $varLoop = False Exit Case $varMessage == $varButtonTopmost _Button_Topmost_Clicked() Case $varMessage == $varButtonNormal _Button_Normal_Clicked() EndSelect $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE CLOSEClicked() Case $startbutton ; Start the timer $check1 = True ; Reset the counter $botcounter = 0 ; Delete the controls and make the new ones $bot = GUICtrlCreateLabel("Bot active:", 10, 165) GUICtrlDelete($startbutton) Global $botlabel = GUICtrlCreateLabel("0", 15, 180, 50, 40) GUICtrlSetFont(-1, 22, 500, $font) EndSwitch sleep($sleepLen) check1() WEnd Func check1() If $check1 Then $botcounter += 1 If $botcounter = (1000/$sleepLen)*7 Then $botcounter = 0 $check2 = True EndIf ; Update the label & font If Mod($botcounter, (1000/$sleepLen)) = 0 Then GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen))) EndIf check2() if $check2 = True then $check1 = False endif EndIf EndFunc Func check2() if $check2 then $botcounter += 1 GUICtrlSetBkColor($botlabel, 0xff9900) If $botcounter = (1000/$sleepLen)*80 Then ; Set the back color GUICtrlSetBkColor($botlabel, 0x66ccff) $botcounter = 0 $check3 = True EndIf If Mod($botcounter, (1000/$sleepLen)) = 0 Then GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen))) EndIf EndIf check3() EndFunc Func check3() if $check3 then If $botcounter = (1000/$sleepLen)*6 Then ; Set the back color GUICtrlSetBkColor($botlabel, 0xff0000) $botcounter = 0 $check4 = True EndIf If Mod($ybluebuffcounter, (1000/$sleepLen)) = 0 Then GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen))) EndIf EndIf check4() EndFunc Func check4() if $check4 then If $botcounter = (1000/$sleepLen)*6 Then ; Set the back color GUICtrlSetBkColor($botlabel, 0xff0000) $botcounter = 0 EndIf If Mod($botcounter, (1000/$sleepLen)) = 0 Then GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen))) EndIf EndIf EndFunc Func _Button_Topmost_Clicked() WinSetOnTop($varWindow,"",1) EndFunc Func _Button_Normal_Clicked() WinSetOnTop($varWindow,"",0) EndFunc ; Finished! I know it's not finished the code but I can't even get numer 2) please help me (oh and btw the second code has 2 extra buttons to choose if it should be topmost or not) Edited July 12, 2013 by MrBrasta
DatMCEyeBall Posted July 12, 2013 Posted July 12, 2013 Still know what you want this for... '?do=embed' frameborder='0' data-embedContent>> "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation
MrBrasta Posted July 12, 2013 Author Posted July 12, 2013 Still know what you want this for... '?do=embed' frameborder='0' data-embedContent>> dude, this can be used in everything
Blue_Drache Posted July 12, 2013 Posted July 12, 2013 dude, this can be used in everything Dude, you failed to read the rules! Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Moderators Melba23 Posted July 12, 2013 Moderators Posted July 12, 2013 MrBrasta,Which part of: "Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above"is hard to understand? Do NOT start a third thread on this - our patience has limits. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts