Sign in to follow this  
Followers 0
onestcoder

Pause not working

5 posts in this topic

When im run this and hit the pause button my tool tip comes up but the program doesn't pause.

$file = FileOpen("vars\enhancevars.txt", 0)
$speed = FileReadLine($file, 1)
$spellnumber = FileReadLine($file, 2)
FileClose($file)
Local $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")
Local $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002")
Local $resnumber = $resx + $resy
If $resnumber = 1400 Then
    $res = 1
ElseIf $resnumber = 1792 Then
    $res = 2
ElseIf $resnumber = 2016 Then
    $res = 0
ElseIf $resnumber = 2048 Then
    $res = 0
ElseIf $resnumber = 2240 Then
    $res = 0
ElseIf $resnumber = 2304 Then
    $res = 3
EndIf
If $res = 0 Then
    MsgBox(16, "Error", "Your FFXI resolution is not currently supported", 10)
    Exit
EndIf
If $res = 1 Then
    $resolution = 0
    $resolution2 = 0
EndIf
If $res = 2 Then
    $resolution = 168
    $resolution2 = 225
EndIf
If $res = 3 Then
    $resolution = 424
    $resolution2 = 481
EndIf
#include <GUIConstants.au3>
opt("GUIOnEventMode", 1)
Global $Paused = 0
Global $run = 0
Global $event = 0
If $speed = 1 Then
    $sleep1 = 1500
    $sleep2 = 5000
    $sleep3 = 15000
EndIf
If $speed = 2 Then
    $sleep1 = 500
    $sleep2 = 2000
    $sleep3 = 10000
EndIf
If $speed = 3 Then
    $sleep1 = 0
    $sleep2 = 0
    $sleep3 = 0
EndIf
$gui = GUICreate("Enhancer", 180, 100, 0, 0, -1, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
GUICtrlCreatePic("img\Obotz3.jpg", 5, 5, 170, 59)
$button_1 = GUICtrlCreateButton("Run", 5, 70, 50, 25)
GUICtrlSetOnEvent($button_1, "Running")
GUICtrlSetState($button_1, $GUI_FOCUS)
$n2 = GUICtrlCreateButton("Exit", 125, 70, 50, 25)
GUICtrlSetOnEvent($n2, "Terminate")
$p2 = GUICtrlCreateButton("Pause", 65, 70, 50, 25)
GUICtrlSetOnEvent($p2, "TogglePause")
GUISetState()
AutoItSetOption("SendKeyDelay", 40);
While 1
    While $run = 1
        Do
            AutoItSetOption("SendKeydownDelay", 250);
            If PixelGetColor(26, 577 + $resolution) > 16777000 And PixelGetColor(26, 577 + $resolution) < 16777300 And PixelGetColor(35, 571 + $resolution) > 16777000 And PixelGetColor(35, 571 + $resolution) < 16777300 And PixelGetColor(53, 567 + $resolution) > 16777000 And PixelGetColor(53, 567 + $resolution) < 16777300 Then
                Sleep(1000 + $sleep2)
                Send("^1")
                Sleep(500)
                Exit
                Terminate()
            EndIf
            If $spellnumber = 0 Then
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!1"); spell 1.
                    Send("!1")
                    Sleep(12000 + $sleep2)
                    $event = 0
                EndIf
            EndIf
            If $spellnumber = 1 Then
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!1"); spell 1.
                    Send("!1")
                    Sleep(6000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!2");spell 2.
                    Send("!2")
                    Sleep(6000 + $sleep2)
                    $event = 0
                EndIf
            EndIf
            If $spellnumber = 2 Then
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!1"); spell 1.
                    Send("!1")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!2");spell 2.
                    Send("!2")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!3");spell 3.
                    Send("!3")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
            EndIf
            If $spellnumber > 2 Then
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!1"); spell 1.
                    Send("!1")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!2");spell 2.
                    Send("!2")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!3");spell 3.
                    Send("!3")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
                If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
                    Sleep(2000)
                    Send("!4");spell 4.
                    Send("!4")
                    Sleep(4000 + $sleep2)
                    $event = 0
                EndIf
            EndIf
            If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 9000000 Then
                med();
                $event = 1;low mp.
            EndIf
        Until $event = 1
    WEnd
WEnd
Func med()
    Sleep(1000)
    Send("{ESCAPE 2}")
    Sleep(1500)
    Send("!h");down
    Sleep(60000)
    If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 8500000 Then
        Send("{ESCAPE 2}")
        Sleep(1500)
        Send("!h");down
    EndIf
    $event = 0
    Do
        Sleep(3000)
        If PixelGetColor(772 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(772 + $resolution2, 577 + $resolution) > 11000000 Then
            Send("{ESCAPE 2}")
            Sleep(1500)
            AutoItSetOption("SendKeydownDelay", 3000);
            Send("!h");up
            AutoItSetOption("SendKeydownDelay", 250);
            $event = 2;mp full.
        EndIf
    Until $event = 2
EndFunc  ;==>med
Func Running()
    If $run = 0 And $Paused = 1 Then
        TogglePause()
    Else
        $run = 1
    EndIf
EndFunc  ;==>Running
Func TogglePause()
    $Paused = Not $Paused
    $run = Not $run
    If $Paused = 0 Then
        ToolTip("")
    ElseIf $Paused = 1 Then
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    EndIf
EndFunc  ;==>TogglePause
; Exit function
Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try just using Global $Paused (without the ' = 0') and you'll need to fix this:

==> Variable used without being declared.:

If $res = 0 Then

If ^ ERROR

Edit:

And just use the Pause from the helpfile:

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try just using Global $Paused (without the ' = 0') and you'll need to fix this:

O thats cuz you don't have FFXI in your reg for it to get the information it needs to make the var

THank you for your help SmOke_N

Edited by onestcoder

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites

O thats cuz you don't have FFXI in your reg for it to get the information it needs to make the var

A suggestion if your going ot post something like this for help, is to define the $res with something other than a conditional statement. Also, see my edit above about the pause.

Local $res = ''
Local $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")
Local $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002")
Local $resnumber = $resx + $resy
If $resnumber = 1400 Then
    $res = 1
ElseIf $resnumber = 1792 Then
    $res = 2
ElseIf $resnumber = 2016 Then
    $res = 0
ElseIf $resnumber = 2048 Then
    $res = 0
ElseIf $resnumber = 2240 Then
    $res = 0
ElseIf $resnumber = 2304 Then
    $res = 3
EndIf
If $res = 0 Then
    MsgBox(16, "Error", "Your FFXI resolution is not currently supported", 10)
    Exit
ElseIf Not $res <> '' Then
    MsgBox(16, 'Error', 'You don't have FFXI in your Registry', 10)
    Exit
EndIf

Just a suggestion anyway.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Got it its fixed thank you. And I made the $res change also


Need a website: http://www.iconixmarketing.com

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