Jump to content

weird error


Recommended Posts

Hi guys,

I have a strange problem. AutoIt is saying that there is no EndFunc in the script but there is. Can you guys help me out? Check the error I got down here.

Don't get frightened by the name "bankscript", it has nothing to do with this:P. This is the part of the script that creates the error:

Func _Terminate()
    Exit 0
EndFunc

Can you guys help me out. I really don't understand the problem. It was working fine earlier.

Berend Jan

Link to comment
Share on other sites

That is perfectly good code, maybe you saved it in the wrong format?

Did you save in ANSI?

Or some other one that might not work with say notepad? just a thought

maybe it has some other character in it that doesn't show.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

I know it is good coding:S I tried to add a ";" in front of it, but then it just goes to the next func and creates the same problem.

This is the complete script, maybe one of you guys can find my problem:(

Opt("TrayIconDebug", 1)

;=======VARIABLES===================================================================================


=============================

Global $LocEmail1 = "556"
Global $LocEmail2 = "456"
Global $LocWW1 = "556"
Global $LocWW2 = "485"
Global $LocBank1 = "105"
Global $LocBank2 = "678"
Global $LocStort1 = "850"
Global $LocStort2 = "495"
Global $Stortbedrag1 = "787"
Global $Stortbedrag2 = "523"
Global $Bankmoney = 200000000
Global $LocScrollDown1 = "1267"
Global $LocScrollDown2 = "130"
Global $LocScrollDown3 = "1267"
Global $LocScrollDown4 = "938"
Global $LocHoofd = "113, 195"
Global $LocDragGeld1 = "839"
Global $LocDragGeld2 = "839"
Global $LocDragGeld3 = "1010"
Global $LocDragGeld4 = "839"
Global $LocNotepadexit1 = "1268"
Global $LocNotepadexit2 = "10"
Global $LocLogout1 = "113"
Global $LocLogout2 = "871"
Global $LocAdresbalk1 = "1058"
Global $LocAdresbalk2 = "93"
Global $LocTarg1 = "121"
Global $LocTarg2 = "502"
Global $LocTrek1 = "699"
Global $LocTrek2 = "328"
Global $LocStringtarg1 = "177"
Global $LocStringtarg2 = "195"
Global $Target1 = "715"
Global $Target2 = "335"
Global $Hoofd1 = "303"
Global $Hoofd2 = "351"
Global $Hoofd3 = "519"
Global $Hoofd4 = "646"
Global $Verzend1 = "549"
Global $Verzend2 = "199"
Global $Schietbaan1 = ""
Global $Schietbaan2 = ""
Global $Kogels1 = ""
Global $Kogels2 = ""
Global $EndBank1 = "175"
Global $EndBank2 = "195"
Global $Mobstar1 = "639"
Global $Mobstar2 = "427"
Global $MobAdres = "www.mobstar.cc"
global $UserNumber = 0
Global $NumberOfUsers = IniRead ( 'Bankusers.ini', 'MobHeader', 'NumberOfUsers', 1)
Global $MobUser = IniRead ( 'Bankusers.ini', 'User' & $UserNumber, 'MobUser', "Unknown User" )
Global $MobPass = IniRead ( 'Bankusers.ini', 'User' & $UserNumber, 'MobPass', "" )
Global $Sleep = "7500"
Global $Minisleep = "500"
Global $Hiber = "3900000"

;=======KEYFUNC'S===============================================================================================


=================

Func _GetNextUser()
   For $I = 1 To $NumberOfUsers;Will loop 3 times, once for each user
          $MobUser = IniRead ( 'Bankusers.ini', 'User' & $I, 'MobUser', "Unknown User" )
    $MobPass = IniRead ( 'Bankusers.ini', 'User' & $I, 'MobPass', "" )
    _Login()
   Next
EndFunc

Func _Login ()
    Mouseclick ("left", $LocEmail1, $LocEmail2, 1)
    Send ( $MobUser )
    Mouseclick ("left", $LocWW1, $LocWW2, 1)
    Send ( $MobPass )
    Send ("{ENTER}")
    _CheckLogin()
EndFunc

Func _Bank()
;Mouseclick ("left", 421, 281, 1)
;Mouseclick ("left", 421, 314, 1)
;Sleep ($Sleep)
        Mouseclickdrag ("left", $LocScrollDown1, $LocScrollDown2, $LocScrollDown3, $LocScrollDown4)
    Mouseclickdrag ("left", $LocDragGeld1, $LocDragGeld2, $LocDragGeld3, $LocDragGeld4)
    Send ("^c")
    _characters()
EndFunc

Func _Logout()
    Mouseclick("Left", $LocAdresbalk1, $LocAdresbalk2, 1)
    Send ($MobAdres)
    Sleep (100)
    Send ("{ENTER}")
    _CheckMain()
EndFunc 

Func _StartStort()
    $Money = Number(ClipGet())
    ProcessClose("notepad.exe")
    WinActivate ("Mobstar - The Number One Online Mafia Game! - Microsoft Internet Explorer", "")
    Mouseclick ("left", $LocBank1, $LocBank2, 1)
    _CheckBank()
EndFunc

Func _Stort()
        If $Money >= 200000000 Then
            Sleep ($Sleep)
            Mouseclick ("left", $LocStort1, $LocStort2, 1)
            Send ($Bankmoney)
            Mouseclick ("left", $Stortbedrag1, $Stortbedrag2, 1)
            _EndBank()
        Else
            $LowMoney = $Money - 200000
            Sleep ($Sleep)
            Mouseclick ("left", $LocStort1, $LocStort2, 1)
            Send ($LowMoney)
            Mouseclick ("left", $Stortbedrag1, $Stortbedrag2, 1)
            _EndBank()
        EndIf
EndFunc

Func _Target()
    Mouseclick ("left", $LocTarg1, $LocTarg2, 1)
    Sleep ($Sleep)
    Mouseclick ("left", $LocTrek1, $LocTrek2, 1)
    Sleep ($Sleep)
;Mouseclick ("left", $LocStringtarg1, $LocStringtarg2, 2)
;Sleep (100)
;Send ("^c")
;$Target = String (ClipGet())
;If $Target = "Je " Then
;   _Logout()
;Else
    ;If $Target = "You " Then
    ;   _Logout()
    ;Else
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            Mouseclick ("left", $Target1, $Target2, 1)
            Sleep ($Minisleep)
            _Logout()
    ;EndIf
;EndIf
EndFunc

;=======LOOPS=======================================================================================


==============================

Func _Loop()
    sleep (2000)
    Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.mobstar.cc", "", @SW_MAXIMIZE)
    WinWaitActive("Mobstar - The Number One Online Mafia Game! - Microsoft Internet Explorer", "", 5)
    _GetNextUser()
    ProcessClose("IExplore.exe")
    Sleep ($Hiber)
;Shutdown (9)
    _Loop()
EndFunc

;=======EXTRA'S===============================================================================================


=====================

Func _Edit19()
    Run ("Notepad.exe")
    WinWaitActive ("Naamloos - Kladblok", "", 5)
    Send ("^v")
    Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{B


S}{BS}{BS}{BS}")
    Send ("^a")
    Send ("^c")
    _StartStort()
EndFunc

Func _Edit18()
    Run ("Notepad.exe")
    WinWaitActive ("Naamloos - Kladblok", "", 5)
    Send ("^v")
    Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}


{BS}{BS}")
    Send ("^a")
    Send ("^c")
    _StartStort()
EndFunc

Func _Edit17()
    Run ("Notepad.exe")
    WinWaitActive ("Naamloos - Kladblok", "", 5)
    Send ("^v")
    Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{B


S}")
    Send ("^a")
    Send ("^c")
    _StartStort()
EndFunc

Func _Edit16()
    Run ("Notepad.exe")
    WinWaitActive ("Naamloos - Kladblok", "", 5)
    Send ("^v")
    Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    Send ("^a")
    Send ("^c")
    _StartStort()
EndFunc

Func _Edit15()
    Run ("Notepad.exe")
    WinWaitActive ("Naamloos - Kladblok", "", 5)
    Send ("^v")
    Send ("{LEFT}{LEFT}{LEFT}{BS}{LEFT}{LEFT}{LEFT}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    Send ("^a")
    Send ("^c")
    _StartStort()
EndFunc

Func _characters()
If StringLen (ClipGet()) = 19 Then
    _Edit19()
Else
    If StringLen (ClipGet()) = 18 Then
        _Edit18()
    Else
        If StringLen (ClipGet()) = 17 Then
            _Edit17()
        Else
            If StringLen (ClipGet()) = 16 Then
                _Edit16()
            Else
                If StringLen (ClipGet()) < 15 Then                              
                    _Logout()   
                Else 
                    _Edit15()
                EndIf
            EndIf
        EndIf   
    EndIf
EndIf
EndFunc

Func _Start()
EndFunc

;========WAITFORPAGE================================================================================


==============================

Func _CheckLogin()
    Mouseclickdrag ("left", $Hoofd1, $Hoofd2, $Hoofd3, $Hoofd4)
    Send("^c")
    $String = StringLen (Clipget())
    If $String >=0 Then
        _Bank()
    Else
        _CheckLogin()
    EndIf
EndFunc

Func _CheckBank()
    Sleep ($Minisleep)
    Mouseclick("left",$Verzend1, $Verzend2, 2)
    Send("^c")
    $Verzend = Clipget()
    If $Verzend = "Verzend" Then
        _Stort()
    Else
        _CheckBank()
    EndIf
EndFunc

Func _EndBank()
    Sleep ($Minisleep)
    Mouseclick("left",$EndBank1, $EndBank2, 2)
    Send("^c")
    $EndBank = Clipget()
    If $EndBank = "" Then
        _EndBank()
    Else
        If $EndBank = "Je " Then
            _Logout()
        Else
            If $EndBank = " " Then
                _Logout()
            Else
                _EndBank()
            EndIf
        EndIf
    EndIf
EndFunc

Func _CheckTarget()
    Sleep ($Minisleep)
    Mouseclick("left",$Schietbaan1, $Schietbaan2, 2)
    Send("^c")
    $Schietbaan = Clipget()
EndFunc

Func _CheckKogels()
    Sleep ($Minisleep)
    Mouseclick("left",$Kogels1, $Kogels2, 2)
    Send("^c")
    $Kogels = Clipget()
EndFunc

Func _CheckMain()
    Sleep ($Minisleep)
    Mouseclick("left",$Mobstar1, $Mobstar2, 2)
    Send("^c")
    $Mobstar = Clipget()
    If $Mobstar = "Mobstar" Then
        _Start()
    Else
        _CheckMain()
    EndIf

;========CALCULATIONS===============================================================================


==============================

;========MENU'S===============================================================================================


====================

Func _SleepStart()
    $Minutes = InputBox ( "Opstarten scripts", "Na hoeveel minuten wil je dat het bankscript wordt opgestart? Voer alleen numerieke karakters in!", "120", " M3", -1, 150)
    $Result = $Minutes * 60000
    If @error = 1 Then Exit
;MsgBox (0,"", $Result)
    Sleep ($Result)
EndFunc

;========SCRIPT=====================================================================================


==============================

Global $Paused
HotKeySet("{PAUSE}", "_TogglePause")
HotKeySet("{ESC}", "_Terminate")

Func _TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        Tooltip('Script is "Paused"', 0, 0)
    WEnd
    Tooltip("")
EndFunc

Func _Terminate()
    Exit 0
EndFunc

_SleepStart()
_Loop()

Berend Jan

Link to comment
Share on other sites

I've noticed that AutoIt doesn't always gives you the correct error.

Check out these examples:

; "Error: "If" statement has no matching "EndIf" statement."
If 1 = 2 Then
Func 1()
EndIf


; "Error: "Wend" statement with no matching "While" statement."
Func 2()
   While 1

     If 1 = 2 Then
        MsgBox(64,"","Whoooah !")
        Exit

   WEnd
EndFunc


; "Error: "EndSelect" statement with no matching "Select" statement."
Func 3()
   Select
   Case 1 = 2
       If 1 = 2 Then
           MsgBox(64,"","Whoooah !")
           Exit

   EndSelect
EndFunc

Maybe that's also the case in your code..

Link to comment
Share on other sites

I've noticed that AutoIt doesn't always gives you the correct error.

Check out these examples:

; "Error: "If" statement has no matching "EndIf" statement."
If 1 = 2 Then
Func 1()
EndIf
; "Error: "Wend" statement with no matching "While" statement."
Func 2()
   While 1

     If 1 = 2 Then
        MsgBox(64,"","Whoooah !")
        Exit

   WEnd
EndFunc
; "Error: "EndSelect" statement with no matching "Select" statement."
Func 3()
   Select
   Case 1 = 2
       If 1 = 2 Then
           MsgBox(64,"","Whoooah !")
           Exit

   EndSelect
EndFunc

Maybe that's also the case in your code..

<{POST_SNAPBACK}>

but in those codes there somethin not logical in it: 1 = 2.. that's never the case... Is that what you are implying? Because I can't find anything like that in my script :(

Berend Jan

Link to comment
Share on other sites

Exit(0) ?

<{POST_SNAPBACK}>

doesn't even matter, since it starts with the _SleepStart() func. Gives the problem there right away. When I shut Sleepstart of by adding ; in front of it it does the same for _TogglePause() and after that _Terminate(). And so on and so on.

And Exit 0 did use to work earlier.

Berend Jan

Link to comment
Share on other sites

Hehe, that has nothing to do with the errors. Just change it and you'll see.

I were just making a point (If there is a missing EndIf then 1 equals 2)

It's just my way of telling a bad joke to AutoIt.exe :(

but in those codes there somethin not logical in it: 1 = 2.. that's never the case... Is that what you are implying? Because I can't find anything like that in my script :(

Berend Jan

<{POST_SNAPBACK}>

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