Sign in to follow this  
Followers 0
some1

Error when using EndFunc

5 posts in this topic

Hey, I am writin' a bot for the mmo EVE-online. It's gonna do all the boring mining part.

Here is a piece of the code (one of the places where I have problems with the EndFunc statement):

;;===============================================
;; Mine;
;;===============================================

Func Mine()
    $Status = "Mining"
    GUICtrlSetData($LabelStatus, $Status)
    $TimeInit = TimerInit()
        call("DetectStep")
    
    While 1
        
        Select
            Case $Step = 1
                Call("Undock")
            Case $Step = 2
                Call("WarpToBelt")
            Case $Step = 3
                Call("TargetApproachLock")
            Case $Step = 4
                Call("ActivateLasers")
            Case $Step = 5
                Call("DockStation")
            Case $Step = 6
                Call("MoveCargo")
        Endselect
        
        If $CyclesDone => GUICtrlRead($InputCycles) Then
                EndFunc
        EndIf
        
    WEnd

EndFunc

As you can see, I am primarily using functions to make it do what I want... But when using EndFunc more than once, I get some problems. In the above code I need the function to end when a predefined number of mining-cycles have been made.... but if I run the script as it stands there, I get an:

EndFunc

Error: "Func" statement has no matching "EndFunc".

Can you help me adjust my code so it will work???

Or should I do it in another way?

Btw: I searched the forum ;P

Share this post


Link to post
Share on other sites



Replace EndFunc with return

Share this post


Link to post
Share on other sites

or replace it with exitloop

Share this post


Link to post
Share on other sites

They are referring to this end func btw:

If $CyclesDone => GUICtrlRead($InputCycles) Then
                EndFunc
        EndIfoÝ÷ جƥ'è­ëÞ¯!nÇîÉÚë-jצz{mêÞ«-¡·¨µwEºw,µ«^éíz÷§ú'zí颲åÉÆ¥çbÚrب^ªZ®ØºV«rÝب+&zÔ¨¶¬².×hØ­)äjëh×6  
      If $CyclesDone => GUICtrlRead($InputCycles) Then ExitLoop

Share this post


Link to post
Share on other sites

The help-file:

ExitLoop will break out of a While, Do or For loop.

ExitLoop is useful when you would otherwise need to perform error checking in both the loop-test and the loop-body.

But return works fine thanks :)

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