Jump to content

How to combine start/stop/pause all together


Recommended Posts

well what i'm trying to do here is make a hotkey function that will turn on and off the script... BUT when u push the hotkey again it will "PAUSE" the script first then stop it, so what i'm trying to say is the script will pause then stop and if u push the hotkey again when the script is off it will turn on and run the script... if i tap the hotkey again it will pause then stop the script...

so can any one help me? so far i only got this and cant seem to get the pause then stop part to fit in ....

P.S. i want this to be under 1 hotkey and not a hotkey for just pause

HotKeySet("{F4}", "ExitProg") 
HotKeySet("{F5}", "StartStop");Shift+s
GuiCreate("Program",218,68,332,219)
$label1=GuiCtrlCreateLabel("F5",9,30,141,15)
$label2=GuiCtrlCreateLabel("Test",115,30,105,15)
$label3=GuiCtrlCreateLabel("By Bryan",166,55,55,15)
GuiSetState()


$msg=GuiGetMsg()


Func ExitProg()  
    Exit 0;;Exits the program
EndFunc

Dim $On
$On = False

While 1
    While $On = True
    ;;My script
    WEnd
    Sleep(100)
WEnd

Func StartStop()
    If $On = False Then
        $On = True
    Else
    $On = False
    EndIf
EndFunc
Edited by BryanMc
Link to comment
Share on other sites

Hey, your doing ok your script already pauses and restarts on pressing f5, you just have no feedback from your program to show that it is.

#include <GUIConstantsEx.au3>

HotKeySet("{F4}", "ExitProg")
HotKeySet("{F5}", "StartStop");Shift+s
GuiCreate("Program",218,68,332,219)
$label1=GuiCtrlCreateLabel("F5",9,30,141,15)
$label2=GuiCtrlCreateLabel("Test",115,30,105,15)
$label3=GuiCtrlCreateLabel("By Bryan",166,55,55,15)
GuiSetState()

Func ExitProg()
    Exit 0;;Exits the program
EndFunc

Dim $On
$On = False

While 1
    $msg=GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE then Exit
    While $On = True
    ;;My script
        MsgBox(0, "Note", "This only apears for 1 sec while $On = True", 1)
    WEnd
    Sleep(100)
WEnd

Func StartStop()
    If $On = False Then
        $On = True
        GUICtrlSetData($label2, "Run Script")
    Else
    $On = False
    GUICtrlSetData($label2, "Stop Script")
    EndIf
EndFunc
GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

well whats happening is when i have my code in... i turn it on and hit the Hotkey again but it wont turn off... it keeps running... what am i doing wrong? but after the script that i turn on runs all the way till its done then i have a chance to stop it... am i doing something wrong? here is my WHOLE script i am working on...

HotKeySet("{F4}", "ExitProg") 
HotKeySet("{F5}", "StartStop")
HotKeySet("{F6}", "TogglePause")
GuiCreate("PyPQ Bonus Bot",218,68,332,219)
$label1=GuiCtrlCreateLabel("Shapphire",8,0,141,15)
$label2=GuiCtrlCreateLabel("F9",26,15,141,15)
$label3=GuiCtrlCreateLabel("Ruby",75,0,105,15)
$label4=GuiCtrlCreateLabel("F10",78,15,105,15)
$label5=GuiCtrlCreateLabel("Emerald",122,0,141,15)
$label6=GuiCtrlCreateLabel("F11",133,15,105,15)
$label7=GuiCtrlCreateLabel("Topaz",180,0,105,15)
$label8=GuiCtrlCreateLabel("F12",187,15,105,15)
$label9=GuiCtrlCreateLabel("By BryanMc",160,55,130,15)
GuiSetState()


$msg=GuiGetMsg()


Func ExitProg()  
    Exit 0;;Exits the program
EndFunc

Dim $On
$On = False
$Paused = False

    
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc


While 1
    While $On = True
      WinActivate("MapleStory")
        Send("{RIGHT down}")
            Sleep (9000)
        Send("{RIGHT up}")
        Send("{SPACE 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (3000)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
            Sleep (500)
        Send("{LEFT down}")
        Send("{UP down}")
            Sleep (3000)
        Send("{LEFT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (1000)
        Send("{RIGHT 3}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
        Send("{RIGHT down}")
        Send("{UP down}")
            Sleep (6000)
        Send("{RIGHT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (500)
        Send("{RIGHT 12}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{z 100}")

        Send("{DOWN down}")
        Send("{LALT 2}")
            Sleep (500)
        Send("{DOWN up}")
        Send("{RIGHT down}")
            Sleep (600)
        Send("{RIGHT Up}")
            Sleep (500)
        Send("{UP 5}")
            Sleep (1500)
    WEnd
    Sleep(100)
WEnd

Func StartStop()
    If $On = False Then
        $On = True
    Else
        $Paused = False
        $On = False
    EndIf
EndFunc
Edited by BryanMc
Link to comment
Share on other sites

If you want it so the first press of f5 runs the script, the next press pauses and the next stops it, the final one starting from the begining you'd have to do something like this.

#include <GUIConstantsEx.au3>

HotKeySet("{F4}", "ExitProg")
HotKeySet("{F5}", "StartStop");Shift+s
GuiCreate("Program",218,68,332,219)
$label1=GuiCtrlCreateLabel("F5",9,30,141,15)
$label2=GuiCtrlCreateLabel("Test",115,30,105,15)
$label3=GuiCtrlCreateLabel("By Bryan",166,55,55,15)
GuiSetState()

Func ExitProg()
    Exit 0;;Exits the program
EndFunc

Dim $On, $Pause
$On = False
$Pause = False

While 1
    $msg=GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE then Exit
    While $On = True
    ;;My script
        If $On Then MsgBox(0, "Note1", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note2", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note3", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note4", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note5", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note6", "This only apears for 1 sec while $On = True", 1)
    WEnd
    Sleep(100)
WEnd

Func StartStop()
    If $On = False Then
        $On = True
        GUICtrlSetData($label2, "Run Script")
    Else
        If $Pause Then
            $On = False
            $Pause = False
            GUICtrlSetData($label2, "Stop Script")
        Else
            $Pause = True
            _Pause()
        EndIf
    EndIf
EndFunc

Func _Pause()
    GUICtrlSetData($label2, "Pause Script")
    While $Pause
        Sleep(100)
    WEnd
EndFunc
GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

If you want it so the first press of f5 runs the script, the next press pauses and the next stops it, the final one starting from the begining you'd have to do something like this.

#include <GUIConstantsEx.au3>

HotKeySet("{F4}", "ExitProg")
HotKeySet("{F5}", "StartStop");Shift+s
GuiCreate("Program",218,68,332,219)
$label1=GuiCtrlCreateLabel("F5",9,30,141,15)
$label2=GuiCtrlCreateLabel("Test",115,30,105,15)
$label3=GuiCtrlCreateLabel("By Bryan",166,55,55,15)
GuiSetState()

Func ExitProg()
    Exit 0;;Exits the program
EndFunc

Dim $On, $Pause
$On = False
$Pause = False

While 1
    $msg=GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE then Exit
    While $On = True
    ;;My script
        If $On Then MsgBox(0, "Note1", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note2", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note3", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note4", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note5", "This only apears for 1 sec while $On = True", 1)
        If $On Then MsgBox(0, "Note6", "This only apears for 1 sec while $On = True", 1)
    WEnd
    Sleep(100)
WEnd

Func StartStop()
    If $On = False Then
        $On = True
        GUICtrlSetData($label2, "Run Script")
    Else
        If $Pause Then
            $On = False
            $Pause = False
            GUICtrlSetData($label2, "Stop Script")
        Else
            $Pause = True
            _Pause()
        EndIf
    EndIf
EndFunc

Func _Pause()
    GUICtrlSetData($label2, "Pause Script")
    While $Pause
        Sleep(100)
    WEnd
EndFunc

ok thanks so much
Link to comment
Share on other sites

how do i set these 2 scripts to work ... i cant seem to get them working ... >.<

HotKeySet("{F4}", "ExitProg")
HotKeySet("{F7}", "Emerald")
HotKeySet("{F8}", "Topaz")

GuiCreate("Bot",218,68,332,219)
$label5=GuiCtrlCreateLabel("Emerald",122,0,141,15)
$label6=GuiCtrlCreateLabel("F7",133,15,105,15)
$label7=GuiCtrlCreateLabel("Topaz",180,0,105,15)
$label8=GuiCtrlCreateLabel("F8",187,15,105,15)
$label9=GuiCtrlCreateLabel("By BryanMc",160,55,130,15)
GuiSetState()

$msg=GuiGetMsg()
$Shapphire1 = False
$Ruby1 = False
$Emerald1 = False
$Topaz1 = False


Func ExitProg()  
    Exit 0;;Exits the program
EndFunc


;Emerald
While 1
    While $Emerald1 = True
        Send("{RIGHT down}")
            Sleep (9000)
        Send("{RIGHT up}")
        Send("{SPACE 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (3000)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
            Sleep (500)
        Send("{LEFT down}")
        Send("{UP down}")
            Sleep (3000)
        Send("{LEFT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (1000)
        Send("{RIGHT 3}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
        Send("{RIGHT down}")
        Send("{UP down}")
            Sleep (6000)
        Send("{RIGHT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (500)
        Send("{RIGHT 12}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{z 100}")

        Send("{DOWN down}")
        Send("{LALT 2}")
            Sleep (500)
        Send("{DOWN up}")
        Send("{RIGHT down}")
            Sleep (600)
        Send("{RIGHT Up}")
            Sleep (500)
        Send("{UP 5}")
            Sleep (1500)
    

    WEnd
WEnd

;Topaz
While 1
    While $Topaz1 = True
        Send("{RIGHT down}")
            Sleep (9000)
        Send("{RIGHT up}")
        Send("{SPACE 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (3000)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
            Sleep (500)
        Send("{LEFT down}")
        Send("{UP down}")
            Sleep (3000)
        Send("{LEFT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (1000)
        Send("{RIGHT 3}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
        Send("{RIGHT down}")
        Send("{UP down}")
            Sleep (6000)
        Send("{RIGHT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (500)
        Send("{RIGHT 12}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{z 100}")

        Send("{DOWN down}")
        Send("{LALT 2}")
            Sleep (500)
        Send("{DOWN up}")
        Send("{RIGHT down}")
            Sleep (600)
        Send("{RIGHT Up}")
            Sleep (500)
        Send("{UP 5}")
            Sleep (1500)
    WEnd
WEnd






Func Emerald()
    If $Emerald1 = False Then
        $Emerald1 = True
    Else
        $Emerald1 = False
    EndIf
EndFunc

Func Topaz()
    If $Topaz1 = False Then
        $Topaz1 = True
    Else
        $Topaz1 = False
    EndIf
EndFunc
Link to comment
Share on other sites

GuiCreate("PyPQ Bonus Bot",218,68,332,219)

Have noticed the inclusion of the word bot into your scripts , please read Game Bots

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.
Link to comment
Share on other sites

Have noticed the inclusion of the word bot into your scripts , please read Game Bots

P.S. this is for a non multiplayer game and its offline i'm just naming the script as bot just to clarify that its what it is to me...

this is for a flash emu that i have created a while back... hope that cearifys things up a bit.... any help?

Edited by BryanMc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...