Golbez Posted January 25, 2007 Posted January 25, 2007 (edited) ; *** Demo to show a timer window #include <GUIConstants.au3> #include <Date.au3> opt("TrayIconDebug",1) Global $Secs, $Mins, $Hour, $Time ;Create GUI GUICreate("Timer",120, 50) GUICtrlCreateLabel("00:00:00", 10,10) GUISetState() ;Start timer $timer = TimerInit() AdlibEnable("Timer", 50) ; While 1 ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before") $msg = GUIGetMsg() ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after") Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Wend ; Func Timer() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time ; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time) EndFunc ;==>Timeri wanna put this into my program.. i copyed everything i needed into it.. the timer() function, i made the label.. and i added the $timer= timerinit() n adlibenable("timer",50") but it dont seem 2 work n idk y opt("TrayIconDebug",1) Opt("GUIONEVENTMODE", 1) Opt("WinTitleMatchMode",4) #include <GUIConstants.au3> #include <Date.au3> #include <XSkin.au3> #include <Misc.au3> Global $time, $game, $skillkey, $mousekey, $x, $y, $ek, $delay1, $skilldelay, $pause, $t, $pk, $spot Global $Button1, $Button2, $Button3, $iHour, $AMPM, $iCHK, $iPid, $iCTime, $Secs, $Mins, $Hour, $Time, $timer Dim $dupe = 0 loadini() $XSkinGui = XSkinGUICreate("Dupe Helper", 183, 597, $Skin_Folder) $Group1 = GUICtrlCreateGroup("Cast Spots", 23, 423, 137, 105) $Radio1 = GUICtrlCreateRadio("Top Left", 32, 455, 97, 17) ;If $spot = 1 Then Return BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED $Radio2 = GUICtrlCreateRadio("Top Right", 32, 471, 97, 17) ;If $spot = 2 Then Return BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED $Radio3 = GUICtrlCreateRadio("Bottom Left", 32, 487, 97, 17) ;If $spot = 3 Then Return BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED $Radio4 = GUICtrlCreateRadio("Bottom Right", 32, 503, 97, 17) ;If $spot = 4 Then Return BitAND(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED $Radio5 = GUICtrlCreateRadio("Center", 32, 439, 97, 17) ;If $spot = 5 Then Return5 BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Exit", 23, 531, 137, 41, 0) GUICtrlSetOnEvent(-1, "Terminate") GUICtrlSetCursor ($Button1, 7) $Button2 = GUICtrlCreateButton("Start Dupe", 23, 330, 137, 41, 0) GUICtrlSetOnEvent(-1, "pause") $Button3 = GUICtrlCreateButton("Set Cast Spot", 23, 377, 137, 41, 0) GUICtrlSetOnEvent(-1, "iniload") $Group2 = GUICtrlCreateGroup("Time Spend In Game", 23, 23, 137, 57, $BS_CENTER) GUICtrlCreateLabel("00:00:00", 70, 48) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Current Time", 23, 82, 137, 57, $BS_CENTER) $iCTime = GUICtrlCreateLabel('' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _ , 33, 100, 120, 27, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label2 = GUICtrlCreateLabel("Made by: Ray Smith ", 23, 155, 134, 17, $SS_CENTER) $Label4 = GUICtrlCreateLabel("I take no blame if you get banned for breaking the rules. (duping, hacking, etc.)", 23, 286, 139, 41, $SS_CENTER) $Label5 = GUICtrlCreateLabel("Feel free to contact me: MasterGolbez37@Gmail.com Aim: Zephino ", 23, 200, 140, 60) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $XSkinGui) $timer = TimerInit() AdlibEnable("Timer", 50) WinMove ( "Dupe Helper", "", 800, 4) While 1 loadini() Sleep(1000) ;_AdlibManager() WEnd Func loadini() ;Other $game = IniRead("d2dupe.ini", "other", "game", "Error") $skillkey = IniRead("d2dupe.ini", "other", "skillkey", "Error") $mousekey = IniRead("d2dupe.ini", "other", "mousekey", "Error") $ek = IniRead("d2dupe.ini", "other", "endkey", "Error") $pk = IniRead("d2dupe.ini", "other", "sleepkey", "Error") $ik = IniRead("d2dupe.ini", "other", "inikey", "Error") $skin = IniRead("d2dupe.ini", "other", "skin", "Error") $Skin_Folder = @ScriptDir & $skin ;Spots To Cast $spot = IniRead("d2dupe.ini", "other", "spottocast", "Error") If $spot = 1 Then $x = IniRead("d2dupe.ini", "Coords", "topleftx", "Error") $y = IniRead("d2dupe.ini", "Coords", "toplefty", "Error") ElseIf $spot = 2 Then $x = IniRead("d2dupe.ini", "Coords", "toprightx", "Error") $y = IniRead("d2dupe.ini", "Coords", "toprighty", "Error") ElseIf $spot = 3 Then $x = IniRead("d2dupe.ini", "Coords", "botleftx", "Error") $y = IniRead("d2dupe.ini", "Coords", "botlefty", "Error") ElseIf $spot = 4 Then $x = IniRead("d2dupe.ini", "Coords", "botrightx", "Error") $y = IniRead("d2dupe.ini", "Coords", "botrighty", "Error") ElseIf $spot = 5 Then $x = IniRead("d2dupe.ini", "Coords", "centerx", "Error") $y = IniRead("d2dupe.ini", "Coords", "centery", "Error") EndIf ;Delays $delay1 = IniRead("d2dupe.ini", "delays", "maindelay", "Error") $skilldelay = IniRead("d2dupe.ini", "delays", "skilldelay", "Error") HotKeySet($ek, "Terminate") HotKeySet($pk, "pause") HotKeySet($ik, "loadini") EndFunc Func iniload() Opt("GUIOnEventMode", 1) If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "1" ) ElseIf BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "2" ) ElseIf BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "3" ) ElseIf BitAND(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "4" ) ElseIf BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "5" ) EndIf ;Opt("GUIOnEventMode", 0) loadini() EndFunc Func Timer() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time ; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time) EndFunc Func dupestart() While $dupe = 1 ;MouseClick($mousekey, $x, $y, 1) sleep($skilldelay) ClickInControl($mousekey, $game, "", "", $x, $y) If $dupe = 0 Then ExitLoop Sleep(10) WEnd EndFunc Func pause() If $dupe = 0 Then GUICtrlSetData ($button2,"Stop Duping") $dupe = 1 Getready() Else GUICtrlSetData ($button2,"Start Duping") $dupe = 0 EndIf EndFunc ;Func _AdlibManager() ; Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':') ; If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _ ; Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _ ; GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM) ; EndIf ;EndFunc Func _IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc Func _GetHour($iHour) Switch $iHour Case 12 $AMPM = 'PM' Return $iHour Case 13 To 23 $AMPM = 'PM' Return $iHour - 12 Case 0 $AMPM = 'AM' Return 12 Case 1 To 11 $AMPM = 'AM' Return $iHour EndSwitch EndFunc Func _SwitchHour($iHour) Switch $iHour Case 12 If $AMPM = 'AM' Then Return 0 Else Return 12 EndIf Case 1 To 11 If $AMPM = 'PM' Then Return $iHour + 12 Else Return $iHour EndIf EndSwitch EndFunc Func Terminate() Exit 0 EndFunc Func HoldTime() $p = 2 MsgBox(48, "", "Paused") EndFunc Func StartTime() MsgBox(48, "", "Started") $p = 1 EndFunc func Getready() If WinActive($game) = 0 Then WinActivate($game) Sleep($delay1) WinMove($game, "", 0, 0, 800, 630) Sleep($delay1) MouseMove($x, $y, .5) Sleep($delay1) ControlSend($game, "", "", $skillkey) Sleep($delay1) dupestart() EndFunc edit: well from fittling with the demo if i change the name of the gui it stops working.. Edited January 25, 2007 by Golbez
Valuater Posted January 25, 2007 Posted January 25, 2007 change this GUICtrlCreateLabel("00:00:00", 70, 48) to this $ticker = GUICtrlCreateLabel("00:00:00", 70, 48) ************ and change this If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time) to this If $sTime <> $Time Then GUICtrlSetData( $ticker, $Time) **************************** By the way ... where is the skin folder example $Skin_Folder = @ScriptDir & "\Skins\Black-Yellow" ???? 8)
Golbez Posted January 25, 2007 Author Posted January 25, 2007 (edited) change this GUICtrlCreateLabel("00:00:00", 70, 48) to this $ticker = GUICtrlCreateLabel("00:00:00", 70, 48) ************ and change this If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time) to this If $sTime <> $Time Then GUICtrlSetData( $ticker, $Time) **************************** By the way ... where is the skin folder example $Skin_Folder = @ScriptDir & "\Skins\Black-Yellow" ???? 8) oo its in the ini xD i made it so i coul change it with out having to edit the program.. \bin\skins\Hard-Steal but i love you so much right now xD edit: how would i make it stop if i pressed a button? i made a new timer so when the "start duping" button is pressed it will start another timer expandcollapse popupopt("TrayIconDebug",1) Opt("GUIONEVENTMODE", 1) Opt("WinTitleMatchMode",4) #include <GUIConstants.au3> #include <Date.au3> #include <XSkin.au3> #include <Misc.au3> Global $game, $skillkey, $mousekey, $x, $y, $ek, $delay1, $skilldelay, $pause, $t, $pk, $spot Global $Button1, $Button2, $Button3, $iHour, $AMPM, $iCHK, $iPid, $iCTime, $Secs, $Mins, $Hour, $Time, $timer Dim $dupe = 0 loadini() $XSkinGui = XSkinGUICreate("Dupe Helper", 183, 597, $Skin_Folder) $Group1 = GUICtrlCreateGroup("Cast Spots", 23, 423, 137, 105) $Radio1 = GUICtrlCreateRadio("Top Left", 32, 455, 97, 17) ;If $spot = 1 Then Return BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED $Radio2 = GUICtrlCreateRadio("Top Right", 32, 471, 97, 17) ;If $spot = 2 Then Return BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED $Radio3 = GUICtrlCreateRadio("Bottom Left", 32, 487, 97, 17) ;If $spot = 3 Then Return BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED $Radio4 = GUICtrlCreateRadio("Bottom Right", 32, 503, 97, 17) ;If $spot = 4 Then Return BitAND(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED $Radio5 = GUICtrlCreateRadio("Center", 32, 439, 97, 17) ;If $spot = 5 Then Return5 BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Exit", 23, 531, 137, 41, 0) GUICtrlSetOnEvent(-1, "Terminate") GUICtrlSetCursor ($Button1, 7) $Button2 = GUICtrlCreateButton("Start Dupe", 23, 330, 137, 41, 0) GUICtrlSetOnEvent(-1, "pause") $Button3 = GUICtrlCreateButton("Set Cast Spot", 23, 377, 137, 41, 0) GUICtrlSetOnEvent(-1, "iniload") $Group2 = GUICtrlCreateGroup("Time Spend In Game", 23, 23, 137, 57, $BS_CENTER) $ticker = GUICtrlCreateLabel("00:00:00", 70, 48) $Group4 = GUICtrlCreateGroup("Time Spend Duping", 23, 82, 137, 57, $BS_CENTER) $ticker2 = GUICtrlCreateLabel("00:00:00", 70, 105) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Current Time", 23, 140, 137, 57, $BS_CENTER) $iCTime = GUICtrlCreateLabel('' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _ , 33, 160, 120, 27, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label2 = GUICtrlCreateLabel("Made by: Ray Smith ", 23, 205, 134, 17, $SS_CENTER) $Label4 = GUICtrlCreateLabel("I take no blame if you get banned for breaking the rules. (duping, hacking, etc.)", 23, 286, 139, 41, $SS_CENTER) $Label5 = GUICtrlCreateLabel("Feel free to contact me: MasterGolbez37@Gmail.com Aim: Zephino ", 23, 225, 140, 60) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $XSkinGui) $timer = TimerInit() AdlibEnable("Timer", 50) WinMove ( "Dupe Helper", "", 800, 4) While 1 loadini() Sleep(1000) ;_AdlibManager() WEnd Func loadini() ;Other $game = IniRead("d2dupe.ini", "other", "game", "Error") $skillkey = IniRead("d2dupe.ini", "other", "skillkey", "Error") $mousekey = IniRead("d2dupe.ini", "other", "mousekey", "Error") $ek = IniRead("d2dupe.ini", "other", "endkey", "Error") $pk = IniRead("d2dupe.ini", "other", "sleepkey", "Error") $ik = IniRead("d2dupe.ini", "other", "inikey", "Error") $skin = IniRead("d2dupe.ini", "other", "skin", "Error") $Skin_Folder = @ScriptDir & $skin ;Spots To Cast $spot = IniRead("d2dupe.ini", "other", "spottocast", "Error") If $spot = 1 Then $x = IniRead("d2dupe.ini", "Coords", "topleftx", "Error") $y = IniRead("d2dupe.ini", "Coords", "toplefty", "Error") ElseIf $spot = 2 Then $x = IniRead("d2dupe.ini", "Coords", "toprightx", "Error") $y = IniRead("d2dupe.ini", "Coords", "toprighty", "Error") ElseIf $spot = 3 Then $x = IniRead("d2dupe.ini", "Coords", "botleftx", "Error") $y = IniRead("d2dupe.ini", "Coords", "botlefty", "Error") ElseIf $spot = 4 Then $x = IniRead("d2dupe.ini", "Coords", "botrightx", "Error") $y = IniRead("d2dupe.ini", "Coords", "botrighty", "Error") ElseIf $spot = 5 Then $x = IniRead("d2dupe.ini", "Coords", "centerx", "Error") $y = IniRead("d2dupe.ini", "Coords", "centery", "Error") EndIf ;Delays $delay1 = IniRead("d2dupe.ini", "delays", "maindelay", "Error") $skilldelay = IniRead("d2dupe.ini", "delays", "skilldelay", "Error") HotKeySet($ek, "Terminate") HotKeySet($pk, "pause") HotKeySet($ik, "loadini") EndFunc Func iniload() Opt("GUIOnEventMode", 1) If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "1" ) ElseIf BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "2" ) ElseIf BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "3" ) ElseIf BitAND(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "4" ) ElseIf BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED Then IniWrite ( "d2dupe.ini", "other", "spottocast", "5" ) EndIf ;Opt("GUIOnEventMode", 0) loadini() EndFunc Func Timer() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time ; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then GUICtrlSetData( $ticker, $Time) EndFunc Func Timer2() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time ; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then GUICtrlSetData( $ticker2, $Time) EndFunc Func dupestart() While $dupe = 1 ;MouseClick($mousekey, $x, $y, 1) sleep($skilldelay) ClickInControl($mousekey, $game, "", "", $x, $y) If $dupe = 0 Then ExitLoop Sleep(10) WEnd EndFunc Func Timercheck() If $dupe = 1 then $timer2 = TimerInit() AdlibEnable("Timer2", 50) Else AdlibDisable() $timer = TimerInit() AdlibEnable("Timer", 50) EndIf EndFunc Func pause() If $dupe = 0 Then GUICtrlSetData ($button2,"Stop Duping") $dupe = 1 ;Timercheck() Getready() Else GUICtrlSetData ($button2,"Start Duping") $dupe = 0 ;Timercheck() EndIf EndFunc ;Func _AdlibManager() ; Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':') ; If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _ ; Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _ ; GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM) ; EndIf ;EndFunc Func _IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc Func _GetHour($iHour) Switch $iHour Case 12 $AMPM = 'PM' Return $iHour Case 13 To 23 $AMPM = 'PM' Return $iHour - 12 Case 0 $AMPM = 'AM' Return 12 Case 1 To 11 $AMPM = 'AM' Return $iHour EndSwitch EndFunc Func _SwitchHour($iHour) Switch $iHour Case 12 If $AMPM = 'AM' Then Return 0 Else Return 12 EndIf Case 1 To 11 If $AMPM = 'PM' Then Return $iHour + 12 Else Return $iHour EndIf EndSwitch EndFunc Func Terminate() Exit 0 EndFunc func Getready() If WinActive($game) = 0 Then WinActivate($game) Sleep($delay1) WinMove($game, "", 0, 0, 800, 630) Sleep($delay1) MouseMove($x, $y, .5) Sleep($delay1) ControlSend($game, "", "", $skillkey) Sleep($delay1) dup$estart() EndFunc edit: AdlibDisable("Timer2") didnt work O.o edit2: added a function 2 start n stop the second timer... how can i make it so the first one never stops?? Edited January 25, 2007 by Golbez
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now