Jump to content

Func in Func


Recommended Posts

What can I do to fix this???

;### Tidy Error: Level error -> "Func" Not closed before Func statement.

;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.

Func bardexe()
    $file = FileOpen("Include\bardvars.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)
    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 $alt1 = 1 Then
                Sleep(4000 + $alt1t)
                Send("!1")
            EndIf
            If $alt2 = 1 Then
                Sleep(4000 + $alt2t)
                Send("!2")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt3 = 1 Then
                Sleep(4000 + $alt3t)
                Send("!3")
            EndIf
            If $alt4 = 1 Then
                Sleep(4000 + $alt4t)
                Send("!4")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt5 = 1 Then
                Sleep(4000 + $alt5t)
                Send("!5")
            EndIf
            If $alt6 = 1 Then
                Sleep(4000 + $alt6t)
                Send("!6")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt7 = 1 Then
                Sleep(4000 + $alt7t)
                Send("!7")
            EndIf
            If $alt8 = 1 Then
                Sleep(4000 + $alt8t)
                Send("!8")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt9 = 1 Then
                Sleep(4000 + $alt9t)
                Send("!9")
            EndIf
        Until $event = 1
    WEnd
;### Tidy Error: Level error -> "Func" Not closed before Func statement.
;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
    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
;### Tidy Error: Level error -> "Func" Not closed before Func statement.
;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
    Func Terminate()
        Exit 0
    EndFunc  ;==>Terminate
    Exit
EndFunc  ;==>Terminate

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

Link to comment
Share on other sites

Hi,

you cannot start a new Func within an old one. This Code is comilable. But if it does what you want???

Hope that helps!

So long,

Mega

; Moved outside !!!! 
$run = 1
    $event = 0
    $drive = 0
    $resolution = 0
    $rest = 0
    

Func bardexe()
    $file = FileOpen("Include\bardvars.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)
    Sleep(15000)
    $title1 = WinGetTitle("")
    WinWaitNotActive($title1)
    Sleep(10000)
    $title2 = WinGetTitle("")
    HotKeySet("^0", "Terminate")

    WinWaitActive($title2);
    Sleep(60000);
    AutoItSetOption("SendKeyDelay", 40);
    $pause = 0
    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 $alt1 = 1 Then
                Sleep(4000 + $alt1t)
                Send("!1")
            EndIf
            If $alt2 = 1 Then
                Sleep(4000 + $alt2t)
                Send("!2")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt3 = 1 Then
                Sleep(4000 + $alt3t)
                Send("!3")
            EndIf
            If $alt4 = 1 Then
                Sleep(4000 + $alt4t)
                Send("!4")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt5 = 1 Then
                Sleep(4000 + $alt5t)
                Send("!5")
            EndIf
            If $alt6 = 1 Then
                Sleep(4000 + $alt6t)
                Send("!6")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt7 = 1 Then
                Sleep(4000 + $alt7t)
                Send("!7")
            EndIf
            If $alt8 = 1 Then
                Sleep(4000 + $alt8t)
                Send("!8")
            EndIf
            If $pause = 1 Then
                If DriveStatus($drive) = "NOTREADY" Then
                    Pause()
                EndIf
            EndIf
            If $alt9 = 1 Then
                Sleep(4000 + $alt9t)
                Send("!9")
            EndIf
        Until $event = 1
    WEnd
EndFunc
    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

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...