Sign in to follow this  
Followers 0
onestcoder

Exe into function

1 post in this topic

I need to change this exe into a fuction. Can anyone help?

see when i put the While into the fuction it says the $pause is invalide??? But i i run it as a exe it works fine, but i want it to be a function in my gui

;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
$file = FileOpen("includes\vars\partyvars.txt", 0)
$alt1 = FileReadLine($file, 2)
$alt2 = FileReadLine($file, 3)
$alt3 = FileReadLine($file, 4)
$alt4 = FileReadLine($file, 5)
$alt5 = FileReadLine($file, 6)
$alt6 = FileReadLine($file, 7)
$alt7 = FileReadLine($file, 8)
$alt8 = FileReadLine($file, 9)
$alt9 = FileReadLine($file, 10)
$alt1t = FileReadLine($file, 11)
$alt2t = FileReadLine($file, 12)
$alt3t = FileReadLine($file, 13)
$alt4t = FileReadLine($file, 14)
$alt5t = FileReadLine($file, 15)
$alt6t = FileReadLine($file, 16)
$alt7t = FileReadLine($file, 17)
$alt8t = FileReadLine($file, 18)
$alt9t = FileReadLine($file, 19)
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
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;Run(@ProgramFilesDir & "\PlayOnline\SquareEnix\PlayOnlineViewer/pol.exe")
Sleep(15000)
$title1 = WinGetTitle("")
WinWaitNotActive($title1)
Sleep(10000)
$title2 = WinGetTitle("")
HotKeySet("^0", "Terminate")
$run = 1
$event = 0
WinWaitActive($title2);
Sleep(60000);
AutoItSetOption("SendKeyDelay", 40);
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
While $run = 1
    Do
        AutoItSetOption("SendKeydownDelay", 250);
        If $pause = 1 Then
            If DriveStatus($drive) = "NOTREADY" Then
                Pause()
            EndIf
        EndIf
        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)
            Send("^1")
            Sleep(500)
            Exit
            Terminate()
        EndIf
        If PixelGetColor(733 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) > 11000000 Then
            If $alt1 = 1 Then
                Sleep(1000 + $alt1t)
                Send("!1")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt2 = 1 Then
                Sleep(1000 + $alt2t)
                Send("!2")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt3 = 1 Then
                Sleep(1000 + $alt3t)
                Send("!3")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt4 = 1 Then
                Sleep(1000 + $alt4t)
                Send("!4")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt5 = 1 Then
                Sleep(1000 + $alt5t)
                Send("!5")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt6 = 1 Then
                Sleep(1000 + $alt6t)
                Send("!6")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt7 = 1 Then
                Sleep(1000 + $alt7t)
                Send("!7")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt8 = 1 Then
                Sleep(1000 + $alt8t)
                Send("!8")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt9 = 1 Then
                Sleep(1000 + $alt9t)
                Send("!9")
            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
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
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("!h");down
    EndIf
    $event = 0
    Do
        Sleep(3000)
        If PixelGetColor(772 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(772 + $resolution2, 577 + $resolution) > 11000000 Then
            AutoItSetOption("SendKeydownDelay", 3000);
            Send("!h");up
            AutoItSetOption("SendKeydownDelay", 250);
            $event = 2;mp full.
        EndIf
    Until $event = 2
EndFunc  ;==>med
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
Func Pause()
    If $rest = 1 Then
        Send("!h");down
    EndIf
    While 1
        Sleep(5000)
        If DriveStatus($drive) = "READY" Then
            If $rest = 1 Then
                Sleep(250)
                AutoItSetOption("SendKeydownDelay", 3000);
                Send("!h");up
                AutoItSetOption("SendKeydownDelay", 250);
                Sleep(250)
            EndIf
            ExitLoop
        EndIf
        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)
            Send("^1")
            Sleep(500)
            Exit
            Terminate()
        EndIf
    WEnd
EndFunc  ;==>Pause
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
Func Terminate()
    Exit 0
EndFunc  ;==>Terminate
Exit

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