Sign in to follow this  
Followers 0
vin

Restart script with a function

3 posts in this topic

#1 ·  Posted (edited)

Im pretty much new to autoit so bare with me :)

anyway, im making a tool for a game to drop items and so far.. this is how it goes. when you start it, it creates a GUI with 3 buttons, one to "stop" the dropper if it is currently dropping, one to "begin" dropping, and one to exit.. all of the buttons are linked to a specific function. the stop function is Idle(), the drop function is Dropper(), and the exit function is Terminate().

what im trying to do is have the Idle function stop the dropper function but i can't seem to get it to work.

heres the full code

#include <GUIConstants.au3>
$Form1 = GUICreate("PoohBear's Turbo Dropper", 308, 223, 240, 159)
GUISetBkColor(0x000000)
GUICtrlCreateLabel("PoohBear's Turbo Dropper", 8, 8, 281, 43)
GUICtrlSetFont(-1, 22, 800, 2, "Pristina")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Pic1 = GUICtrlCreatePic("D:\Documents and Settings\Vin\My Documents\My Pictures\tiggerNpooh.gif", 8, 64, 161, 129)
$Button1 = GUICtrlCreateButton("Drop (Shift+Alt+A)", 184, 64, 100, 35)
$Button2 = GUICtrlCreateButton("Exit", 184, 160, 100, 35)
$Button3 = GUICtrlCreateButton("Pause (Shift+Alt+S)", 184, 112, 100, 35)
GUISetState(@SW_SHOW)


Global $Paused
HotKeySet("+!s", "Idle")
HotKeySet("+!a", "Dropper")

HotKeySet("{ESC}", "Terminate")
Dim $loop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Dropper()
        Case $msg = $Button2
            Terminate()
        Case $msg = $Button3
            Idle()
    EndSelect
Wend

Func Idle()
    $loop = Not $loop
    $i = 50
    TrayTip("PoohBear's Turbo Dropper",'Dropper is paused. =)',5000000)

EndFunc


Func Dropper()
    Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)
    WinWait("[Conquer2.0]","")
    If Not WinActive("[Conquer2.0]","") Then WinActivate("[Conquer2.0]","")
    WinWaitActive("[Conquer2.0]","")
    Dim $i
    $i = 1
            While $loop
                While $i <= 20
                TrayTip("PoohBear's Turbo Dropper", "Dropping item " & $i & "/20 =)",5000)  
                MouseMove(589,52,0)
                MouseDown("left")
                MouseMove(588,52,0)
                MouseUp("left")
                Sleep(100)
                MouseMove(415,144,0)
                MouseDown("left")
                MouseMove(409,156,0)
                MouseUp("left")
                Sleep(500)
                $i = $i + 1
                
                WEnd
                $loop = Not $loop
            WEnd
    Idle()
EndFunc

Func Terminate()
    Exit 0
EndFunc
Edited by vin

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Nice first post...

maybe..

#include <GUIConstants.au3>

Dim $i, $loop, $Paused

HotKeySet("+!s", "Idle")
HotKeySet("+!a", "Dropper")
HotKeySet("{ESC}", "Terminate")

$Form1 = GUICreate("PoohBear's Turbo Dropper", 308, 223, 240, 159)
GUISetBkColor(0x000000)
GUICtrlCreateLabel("PoohBear's Turbo Dropper", 8, 8, 281, 43)
GUICtrlSetFont(-1, 22, 800, 2, "Pristina")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Pic1 = GUICtrlCreatePic("D:\Documents and Settings\Vin\My Documents\My Pictures\tiggerNpooh.gif", 8, 64, 161, 129)
$Button1 = GUICtrlCreateButton("Drop (Shift+Alt+A)", 184, 64, 100, 35)
$Button2 = GUICtrlCreateButton("Exit", 184, 160, 100, 35)
$Button3 = GUICtrlCreateButton("Pause (Shift+Alt+S)", 184, 112, 100, 35)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Dropper()
        Case $msg = $Button2
            Terminate()
        Case $msg = $Button3
            Idle()
    EndSelect
    If $loop And $i <= 20 Then
        TrayTip("PoohBear's Turbo Dropper", "Dropping item " & $i & "/20 =)", 5000)
        MouseMove(589, 52, 0)
        MouseDown("left")
        MouseMove(588, 52, 0)
        MouseUp("left")
        Sleep(100)
        MouseMove(415, 144, 0)
        MouseDown("left")
        MouseMove(409, 156, 0)
        MouseUp("left")
        Sleep(500)
        $i = $i + 1
    EndIf
WEnd

Func Idle()
    $loop = Not $loop
    $i = 50
    TrayTip("PoohBear's Turbo Dropper", 'Dropper is paused. =)', 5000000)
EndFunc   ;==>Idle


Func Dropper()
    Opt("WinWaitDelay", 100)
    Opt("WinTitleMatchMode", 4)
    Opt("WinDetectHiddenText", 1)
    Opt("MouseCoordMode", 0)
    WinWait("[Conquer2.0]", "")
    If Not WinActive("[Conquer2.0]", "") Then WinActivate("[Conquer2.0]", "")
    WinWaitActive("[Conquer2.0]", "")
    $i = 1
    $loop = True
EndFunc   ;==>Dropper

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

*********** Not Tested

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Nice first post...

maybe..

#include <GUIConstants.au3>

Dim $i, $loop, $Paused

HotKeySet("+!s", "Idle")
HotKeySet("+!a", "Dropper")
HotKeySet("{ESC}", "Terminate")

$Form1 = GUICreate("PoohBear's Turbo Dropper", 308, 223, 240, 159)
GUISetBkColor(0x000000)
GUICtrlCreateLabel("PoohBear's Turbo Dropper", 8, 8, 281, 43)
GUICtrlSetFont(-1, 22, 800, 2, "Pristina")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Pic1 = GUICtrlCreatePic("D:\Documents and Settings\Vin\My Documents\My Pictures\tiggerNpooh.gif", 8, 64, 161, 129)
$Button1 = GUICtrlCreateButton("Drop (Shift+Alt+A)", 184, 64, 100, 35)
$Button2 = GUICtrlCreateButton("Exit", 184, 160, 100, 35)
$Button3 = GUICtrlCreateButton("Pause (Shift+Alt+S)", 184, 112, 100, 35)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            Dropper()
        Case $msg = $Button2
            Terminate()
        Case $msg = $Button3
            Idle()
    EndSelect
    If $loop And $i <= 20 Then
        TrayTip("PoohBear's Turbo Dropper", "Dropping item " & $i & "/20 =)", 5000)
        MouseMove(589, 52, 0)
        MouseDown("left")
        MouseMove(588, 52, 0)
        MouseUp("left")
        Sleep(100)
        MouseMove(415, 144, 0)
        MouseDown("left")
        MouseMove(409, 156, 0)
        MouseUp("left")
        Sleep(500)
        $i = $i + 1
    EndIf
WEnd

Func Idle()
    $loop = Not $loop
    $i = 50
    TrayTip("PoohBear's Turbo Dropper", 'Dropper is paused. =)', 5000000)
EndFunc   ;==>Idle
Func Dropper()
    Opt("WinWaitDelay", 100)
    Opt("WinTitleMatchMode", 4)
    Opt("WinDetectHiddenText", 1)
    Opt("MouseCoordMode", 0)
    WinWait("[Conquer2.0]", "")
    If Not WinActive("[Conquer2.0]", "") Then WinActivate("[Conquer2.0]", "")
    WinWaitActive("[Conquer2.0]", "")
    $i = 1
    $loop = True
EndFunc   ;==>Dropper

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

*********** Not Tested

8)

THANKS! although what you provided didn't work.. i took your idea of the If ... AND... Then.. i was looking for somethign but didn't know AND was all you needed :) woot works :D

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  
Followers 0