Jump to content
Sign in to follow this  
Dragon10660

hmm im a lil lost

Recommended Posts

Dragon10660

i got this program im working on makeing it press button every 1hr or 30 mins or 20mins

so heres the code

#include <GUIConstants.au3>

Global $DodgeButton = False
Global $DrugButton = False
Global $ExpButton = False
Global $MoveButton = False

Global $DodgeTimer, $DrugTimer, $ExpTimer, $MoveTimer




GUISetState()
$Form1_1 = GUICreate("Silkroad Event Scroll User V 1.4", 633, 494, 191, 142)
$Settings = GUICtrlCreateTabItem("Settings")

$DodgeLabel = GUICtrlCreateLabel("Dodging Scroll", 0, 48, 73, 17)
$DrugLabel = GUICtrlCreateLabel("Drug Scroll", 0, 88, 56, 17)
$SpLabel = GUICtrlCreateLabel("Sp/Exp Scroll", 0, 128, 69, 17)
$MovingLabel = GUICtrlCreateLabel("Moving Scroll", 0, 168, 68, 17)
$DodgeButton = GUICtrlCreateButton("Dodge Start", 85, 48, 73, 17)
$DrugButton = GUICtrlCreateButton("Drug Start", 85, 88, 73, 17)
$SpButton = GUICtrlCreateButton("Sp/Exp Start", 85, 128 , 73, 17)
$MovingButton = GUICtrlCreateButton("Moving Scroll", 85, 168 , 73, 17)



$getstartitem = TrayCreateItem("Getting Started")
$buttonitem  = TrayCreateItem("EveryThing To Know")
$versionitem    = TrayCreateItem("Version Info")
$credititem  = TrayCreateItem("Credits")
$aboutitem      = TrayCreateItem("About")
$changelogitem  = TrayCreateItem("Change Log")
$exititem      = TrayCreateItem("Exit")


While 1
    _PerformActions()
    Sleep(10);Always put a Sleep in your main loop, otherwise the CPU is stressed
WEnd


Func _Switch()
    
;----- Toggle actions -----
    Switch @HotKeyPressed;which hotkey was pressed?...
        
        Case "$DodgeButton";toggle Dodge
            $DodgeButton = Not $DodgeButton
        Case "$DrugButton";toggle Drug
            $DrugButton = Not $DrugButton
        Case "$SpButton";toggle Exp
            $SpButton = Not $SpButton
        Case "$MoveButton"
            $MoveButton = Not $MoveButton
    EndSwitch
EndFunc

Func _PerformActions()


    
;----- Check Dodge -----
    If $DodgeButton = True And TimerDiff($DodgeTimer) > 3600000 Then; Timer Set To 1hr
        $DodgeTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Dodge Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("6")
    EndIf
    
;----- Check Drug -----
    If $DrugButton = True And TimerDiff($DrugTimer) > 1800000 Then; Timer Set To 30mins
        $DrugTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Drug Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("7")
    EndIf 
    

;----- Check Exp -----
    If $SpButton = True And TimerDiff($ExpTimer) > 1200000 Then; Timer Set To 20mins
        $ExpTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Sp Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("8")
    EndIf
    
    
;----- Check Move -----
    If $MoveButton = True And TimerDiff($MoveTimer) > 1200000 Then; Time Set To 20mins
        $MoveTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Sp Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("9")
    EndIf
    
EndFunc;==>_PerformActions



GUISetState()

    While 1
        $msg = GUIGetMsg()
    
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

i need makeing it so when i press the button it starts that timer for each one

but i want to beable to say i press 1 button then another will it cancel each other out or do both?

Share this post


Link to post
Share on other sites
andybiochem

????????????

Why did you remove the HotKeySets from the start?

http://www.autoitscript.com/forum/index.ph...mp;#entry671524

This doesn't make sense anymore:

;----- Toggle actions -----
    Switch @HotKeyPressed;which hotkey was pressed?...
        
        Case "$DodgeButton";toggle Dodge
            $DodgeButton = Not $DodgeButton
        Case "$DrugButton";toggle Drug
            $DrugButton = Not $DrugButton
        Case "$SpButton";toggle Exp
            $SpButton = Not $SpButton
        Case "$MoveButton"
            $MoveButton = Not $MoveButton
    EndSwitch
EndFunc

"$DodgeButton" is not a key, etc


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites
Dragon10660

????????????

Why did you remove the HotKeySets from the start?

http://www.autoitscript.com/forum/index.ph...mp;#entry671524

This doesn't make sense anymore:

;----- Toggle actions -----
    Switch @HotKeyPressed;which hotkey was pressed?...
        
        Case "$DodgeButton";toggle Dodge
            $DodgeButton = Not $DodgeButton
        Case "$DrugButton";toggle Drug
            $DrugButton = Not $DrugButton
        Case "$SpButton";toggle Exp
            $SpButton = Not $SpButton
        Case "$MoveButton"
            $MoveButton = Not $MoveButton
    EndSwitch
EndFunc

"$DodgeButton" is not a key, etc

well here the origanal code i reedited

Global $Paused = False
Global $Dodge = False
Global $Drug = False
Global $Exp = False
Global $Move = False

Global $DodgeTimer, $DrugTimer, $ExpTimer, $MoveTimer

HotKeySet("{F5}", "_Switch");"TogglePause"
HotKeySet("{F1}", "_Switch");"DodgeStart"
HotKeySet("{F2}", "_Switch");"DrugStart"
HotKeySet("{F3}", "_Switch");"ExpStart"
HotKeySet("{F6}", "_Switch");"MoveStart"
HotKeySet("{ESC}", "Terminate");"Terminate" / Exit

ToolTip('F5=Pause ESC=Exit F1=Dodge F2=Drug F3=Sp F6=Move"', 0, 0)

Opt("TrayMenuMode",1)
$getstartitem = TrayCreateItem("Getting Started")
$buttonitem  = TrayCreateItem("EveryThing To Know")
$versionitem    = TrayCreateItem("Version Info")
$credititem  = TrayCreateItem("Credits")
$aboutitem      = TrayCreateItem("About")
$changelogitem  = TrayCreateItem("Change Log")
$exititem      = TrayCreateItem("Exit")




While 1
    _PerformActions()
    Sleep(10);Always put a Sleep in your main loop, otherwise the CPU is stressed
    $msg = TrayGetMsg()
    
Select
    Case $msg = 0
            ContinueLoop
        Case $msg = $getstartitem   
            MsgBox(64,"How This Program Works","Go Ahead And Press What Ever HotKey Btw U Can Run 1-4 Scrolls At One Time U want Between DodgingScroll|DrugOfTyphoon|Exp/SpScroll   [Note] It Will Use Until u Quit Program Times Are Correct For Scrolls.")
        Case $msg = $versionitem
            MsgBox(64,"Version","Version 1.3 Copyighted  By ¤Dragon10660¤ ©")
        Case $msg = $credititem 
            MsgBox(64,"Credits","Made By ¤Dragon10660¤ Thanks Hussert For Your Help Thnx Bro And Epvpers For Ur Site ")
        Case $msg = $aboutitem
            Msgbox(64,"About","Scroll User Is A Program Made For Silkroad Drugs/Scrolls")
        Case $msg = $buttonitem 
            MsgBox(64,"EveryThing You Need To Know","F1 Dodging Scroll Slot 6 | F2 DrugOfTyphoon Slot 7 | F3 Sp/Exp Scroll Slot 8 | F6 Moving Scroll Slot 9")
        Case $msg = $changelogitem  
            MsgBox(64,"Change Log","Version 1.1---Fixed Bug With only useing 1 Scroll---Version 1.2 Added Moving Scroll Version 1.3---Reorganized The Code To Work Better And Faster")    
        Case $msg = $exititem
            ExitLoop
    EndSelect
    

WEnd

Func _Switch()
    
;----- Toggle actions -----
    Switch @HotKeyPressed;which hotkey was pressed?...
        Case "{F5}";toggle pause
            $Paused = Not $Paused
        Case "{F1}";toggle Dodge
            $Dodge = Not $Dodge
        Case "{F2}";toggle Drug
            $Drug = Not $Drug
        Case "{F3}";toggle Exp
            $Exp = Not $Exp
        Case "{F6}";toggle Move
            $Move = Not $Move
    EndSwitch

EndFunc;==>_Switch


Func _PerformActions()

;----- Check Paused -----
    If $Paused = True Then
        ToolTip('Script is "Paused"', 0, 0)
        Return
    EndIf
    
    
;----- Check Dodge -----
    If $Dodge = True And TimerDiff($DodgeTimer) > 3600000 Then; Timer Set To 1hr
        $DodgeTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Dodge Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("6")
    EndIf
    
;----- Check Drug -----
    If $Drug = True And TimerDiff($DrugTimer) > 1800000 Then; Timer Set To 30mins
        $DrugTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Drug Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("7")
    EndIf 
    

;----- Check Exp -----
    If $Exp = True And TimerDiff($ExpTimer) > 1200000 Then; Timer Set To 20mins
        $ExpTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Sp Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("8")
    EndIf
    
    
;----- Check Move -----
    If $Move = True And TimerDiff($MoveTimer) > 1200000 Then; Time Set To 20mins
        $MoveTimer = TimerInit()
        WinActivate("SRO_Client")
        ToolTip('Sp Started"', 0, 0)
        Send("{F4}")
        Sleep("1500")
        Send("9")
    EndIf
    
EndFunc;==>_PerformActions


    
    
    GUISetState()     ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example





Func Terminate()
    Exit 0
EndFunc;==>Terminate

but i need a GUI So i can have For hotkey so

infact i dont need hotkeys i need buttons

cause i need for then 12 hotkey to start them ^_^

so i made up my mind to try and make buttons

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×