Jump to content

Can someone debug for me?


shoe7ess
 Share

Recommended Posts

Alright, I just got done creating this script that's used for a game I play. I've used autoit scripting for a little more than a year now, and I usually try and fix things as hard as I can without asking for help. But since I used a new concept, and got an error that shouldn't be an error, I need help finding out what is wrong. The error I get is: Line 0:

Func SelChar2 ()

Erro: "Func" statement has no matching "EndFunc"

I know what this error message means, but it makes no sense in this circumstance. First of all, there is nothing on "Line 0". Second of all, my Func SelChar () has an EndFunc. The script is posted below. Can someone help me?

The config file is attached to this thread if you need it.

;====================================================

Opt ("MouseCoordMode", 0)
AutoItSetOption ("WinTitleMatchMode", 4)

While 1

$SwitchTwo = HotKeySet ("{DELETE}", "SwitchTwo")

  Select 
    Case $SwitchTwo = 0
      SwitchTwo ()

EndSelect 

WEnd

$D2Path = IniRead ("PermerConfig.ini", "Diablo II Settings", "D2Path", "")

If $D2Path = "" Then
$D2Path = RegRead ("HKEY_CURRENT_USER\" & "Software\Blizzard Entertainment\Diablo II", "InstallPath")
EndIf

$D2Exe = IniRead ("PermerConfig.ini", "Diablo II Settings", "D2Exe", "EXE NOT FOUND")
$Parameter = IniRead ("PermerConfig.ini", "Diablo II Settings", "D2Parameter", Exit)
$Roomname = IniRead ("PermerConfig.ini", "Game Creation", "RoomName", "Permer111")
$Roompass = IniRead ("PermerConfig.ini", "Game Creation", "RoomPass", "111")
$AccountName = IniRead ("PermerConfig.ini", "Account 1 Settings", "Username", "Username not found")
$AccountPass = IniRead ("PermerConfig.ini", "Account 1 Settings", "Password", "Password not found")
$AccountName2 = IniRead ("PermerConfig.ini", "Account 2 Settings", "Username", "Username2 not found")
$AccountPass2 = IniRead ("PermerConfig.ini", "Account 2 Settings", "Password", "Password2 not found")
$AccountName3 = IniRead ("PermerConfig.ini", "Account 3 Settings", "Username", "Username3 not found")
$AccountPass3 = IniRead ("PermerConfig.ini", "Account 3 Settings", "Password", "Password3 not found")
$Character1 = IniRead ("PermerConfig.ini", "Mule Settings", "Character1", "0")
$Character2 = IniRead ("PermerConfig.ini", "Mule Settings", "Character2", "0")
$Character3 = IniRead ("PermerConfig.ini", "Mule Settings", "Character3", "0")
$Character4 = IniRead ("PermerConfig.ini", "Mule Settings", "Character4", "0")
$Character5 = IniRead ("PermerConfig.ini", "Mule Settings", "Character5", "0")
$Character6 = IniRead ("PermerConfig.ini", "Mule Settings", "Character6", "0")
$Character7 = IniRead ("PermerConfig.ini", "Mule Settings", "Character7", "0")
$Character8 = IniRead ("PermerConfig.ini", "Mule Settings", "Character8", "0")
$UseAcc2 = IniRead ("PermerConfig.ini", "Account 2 Settings", "UseAccount2", "0")
$UseAcc3 = IniRead ("PermerConfig.ini", "Account 3 Settings", "UseAccount3", "0")

$MessageBox = MsgBox (4, "Dolphin Kicker's D2 Mule Permer", "Welcome to Dolphin Kicker's Diablo II Mule Permer.  With this program, you can make up to 3 mule accounts permanent over night.  This program should not result in any bans or account deletions due to the fact that no packets are edited in the program.  After you have made sure you configured the Permer Config file, click yes to continue.")

If $MessageBox = 7 Then
    Exit
EndIf

;=====================================
;           Is D2 Running?
;=====================================
AdlibEnable ("CheckD2")

Func CheckD2 ()

If WinExists ("Diablo II") = 0 Then
    Exit
EndIf

If WinActive ("Diablo II") = 0 Then
    WinActivate ("Diablo II")
EndIf

Return

EndFunc


;=====================================
;            What to do.
;=====================================
StartD2 ()
Login1 ()
Skip ()
SelChar1 ()
Char1 ()
Leave ()
Skip ()
SelChar2 ()
Char2 ()
Leave ()
Skip ()
SelChar3 ()
Char3 ()
Leave ()
Skip ()
SelChar4 ()
Char4 ()
Leave ()
Skip ()
SelChar5 ()
Char5 ()
Leave ()
Skip ()
SelChar6 ()
Char6 ()
Leave ()
Skip ()
SelChar7 ()
Char7 ()
Leave ()
Skip ()
SelChar8 ()
Char8 ()
Menu ()

SkipAccount ()
Login2 ()
Skip ()
SelChar1 ()
Char1 ()
Leave ()
Skip ()
SelChar2 ()
Char2 ()
Leave ()
Skip ()
SelChar3 ()
Char3 ()
Leave ()
Skip ()
SelChar4 ()
Char4 ()
Leave ()
Skip ()
SelChar5 ()
Char5 ()
Leave ()
Skip ()
SelChar6 ()
Char6 ()
Leave ()
Skip ()
SelChar7 ()
Char7 ()
Leave ()
Skip ()
SelChar8 ()
Char8 ()
Menu ()

Login3 ()
Skip ()
SelChar1 ()
Char1 ()
Leave ()
Skip ()
SelChar2 ()
Char2 ()
Leave ()
Skip ()
SelChar3 ()
Char3 ()
Leave ()
Skip ()
SelChar4 ()
Char4 ()
Leave ()
Skip ()
SelChar5 ()
Char5 ()
Leave ()
Skip ()
SelChar6 ()
Char6 ()
Leave ()
Skip ()
SelChar7 ()
Char7 ()
Leave ()
Skip ()
SelChar8 ()
Char8 ()
Menu ()

EndScript ()

;==============================================
;              Done with script
;==============================================
Func EndScript ()
Exit
Return
EndFunc
;==============================================
;             StartD2 Function
;==============================================
Func StartD2 ()

Run ( $D2Path & "\" & $D2Exe & "" & $Parameter, $D2Path )

WinWaitActive ("Diablo II")

WinActivate ("Diablo II")

Return

EndFunc

;=============================================
;           Login to account 1
;=============================================

Func Login1 ()

MouseClick ("left", 473, 357, 2, 5)

Send ($AccountName)

Send ("{TAB}")

Sleep (200)

Send ($AccountPass)

Sleep (1000)

Send ("{ENTER}")

Sleep (60000)

Return

EndFunc

;=============================================
;           Login to account 2
;=============================================

Func Login2 ()

MouseClick ("left", 473, 357, 2, 5)

Send ($AccountName2)

Send ("{TAB}")

Sleep (200)

Send ($AccountPass2)

Sleep (1000)

Send ("{ENTER}")

Sleep (60000)

Return

EndFunc

;=============================================
;           Login to account 3
;=============================================

Func Login2 ()

MouseClick ("left", 473, 357, 2, 5)

Send ($AccountName3)

Send ("{TAB}")

Sleep (200)

Send ($AccountPass3)

Sleep (1000)

Send ("{ENTER}")

Sleep (60000)

Return

EndFunc


;============================================
;                Skip Perm
;============================================
Func Skip ()

Select
    Case $Character1 = 0
        Func SelChar2 ()
    Case $Character2 = 0
        Func SelChar3 ()
    Case $Character3 = 0
        Func SelChar4 ()
    Case $Character4 = 0
        Func SelChar5 ()
    Case $Character5 = 0
        Func SelChar6 ()
    Case $Character6 = 0
        Func SelChar7 ()
    Case $Character7 = 0
        Func SelChar8 ()
    Case $Character8
        Func Menu ()
EndSelect

Return

EndFunc

;============================================
;                  Skip Account
;============================================
Func SkipAccount ()

Select
    Case $UseAcc2 = 0
         Func Login3
    Case $UseAcc3 = 0
         Exit
EndSelect

Return

EndFunc

;======================================
;              Leave Game
;======================================

Func Leave ()

Send ("{ESC}")

Sleep (200)

MouseClick ("left", 400, 284, 1)

Sleep (20000)

Send ("{ESC}")

Sleep (60000)

;============================================
;               Game Creation
;============================================

Func CreateGame ()

Sleep (2000)

MouseClick ("left", 600, 480, 1)

Sleep (2000)

Send ($Roomname)

Sleep (1000)

Send ("{TAB}")

Sleep (1000)

Send ($Roompass)

Sleep (1000)

Send ("{ENTER}")

Sleep (65000)

Return

EndFunc

;============================================
;            Select Character 1
;============================================

Func SelChar1 ()

MouseClick ("left", 184, 158, 2, 1)

Return

EndFunc

;============================================
;            Select Character 2
;============================================

Func SelChar2 ()

MouseClick ("left", 456, 158, 2, 1)

Return

EndFunc SelChar2 ()

;============================================
;            Select Character 3
;============================================

Func SelChar3 ()

MouseClick ("left", 184, 251, 2, 1)

Return

EndFunc

;============================================
;            Select Character 4
;============================================

Func SelChar4 ()

MouseClick ("left", 456, 252, 2, 1)

Return

EndFunc

;============================================
;            Select Character 5
;============================================

Func SelChar5 ()

MouseClick ("left", 184, 345, 2, 1)

Return

EndFunc

;============================================
;            Select Character 6
;============================================

Func SelChar6 ()

MouseClick ("left", 456, 344, 2, 1)

Return

EndFunc

;============================================
;            Select Character 7
;============================================

Func SelChar7 ()

MouseClick ("left", 184, 436, 2, 1)

Return

EndFunc

;============================================
;            Select Character 8
;============================================

Func SelChar8 ()

MouseClick ("left", 456, 438, 2, 1)

Return

EndFunc

;============================================
;             Perm Character 1
;============================================

Func Char1 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 2
;=============================================

Func Char2 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 3
;=============================================

Func Char3 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 4
;=============================================

Func Char4 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 5
;=============================================

Func Char5 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 6
;=============================================

Func Char6 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 7
;=============================================

Func Char7 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;=============================================
;              Perm Character 8
;=============================================

Func Char8 ()

$t = 0

Do

MouseClick ("left", 600, 300, 1)

Sleep (3000)

MouseClick ("left", 200, 300, 1)

Sleep (3000)

$t = $t + 1

Until $t = 1200

Return

EndFunc

;============================================
;              Go to main menu
;============================================

Func Menu ()

Send ("{ESC}")

Sleep (65000)

MouseClick ("left", 408, 374, 1)

Sleep (15000)

Return

EndFunc


;============================================
;      Here's the script end switch
;============================================
Func SwitchTwo ()

Exit

EndFunc

PermerConfig.zip

Edited by shoe7ess
Link to comment
Share on other sites

  • Developers

Alright, I just got done creating this script that's used for a game I play.  I've used autoit scripting for a little more than a year now, and I usually try and fix things as hard as I can without asking for help.  But since I used a new concept, and got an error that shouldn't be an error, I need help finding out what is wrong.  The error I get is:  Line 0:

           Func SelChar2 ()

           Erro: "Func" statement has no matching "EndFunc"

I know what this error message means, but it makes no sense in this circumstance.  First of all, there is nothing on "Line 0".  Second of all, my Func SelChar () has an EndFunc.  The script is posted below.  Can someone help me?

The config file is attached to this thread if you need it.

<{POST_SNAPBACK}>

I guess you want to call function SelChar2() not Define it?

Just remove the Func infront of it ( and the others in the same function..

ps. error at line 0 is always reported when you are running a compiled script.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well, I fixed that part now, but now there is a problem in my create game function. It now looks like this:

;============================================

; Game Creation

;============================================

Func CreateGame

Sleep (2000)

MouseClick ("left", 600, 480, 1)

Sleep (2000)

Send ($Roomname)

Sleep (1000)

Send ("{TAB}")

Sleep (1000)

Send ($Roompass)

Sleep (1000)

Send ("{ENTER}")

Sleep (65000)

Return

EndFunc

;================================================

How can I take away the Func part but still allow it to be a function?

Link to comment
Share on other sites

before you continue i think you should really take time to look at: functions, loops and arrays to make your script the least bit legible, then post again.. ALOT of unnecessary script is in there.

<{POST_SNAPBACK}>

I know, but I'm not posting this so someone can tell me to make it shorter or easier to read, it's not going to make a difference in the finished script. I just need the problem fixed.
Link to comment
Share on other sites

I know, but I'm not posting this so someone can tell me to make it shorter or easier to read, it's not going to make a difference in the finished script.  I just need the problem fixed.

<{POST_SNAPBACK}>

this is how you learn, thats the problem with the game scripters, they come in, do a half assed job, try to get people to make their scripts for them and leave, all the while remaining as ignorant in scripting as when they first started. take my advice, fix that script up (shorten it) and you will easily be able to catch any problems as well as make it much more functional than it is now.

Roger! You son of a big pile o' Monkey Nuts.

Link to comment
Share on other sites

I know, but I'm not posting this so someone can tell me to make it shorter or easier to read, it's not going to make a difference in the finished script.  I just need the problem fixed.

<{POST_SNAPBACK}>

ok, can you at least edit the post to put the code into code tags?

Doing the other things would make it easier to find the part of the script that's causing the problem.

Have you checked out Au3Check that Tylo wrote and is included with the SciTE install set?

 

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

this is how you learn, thats the problem with the game scripters, they come in, do a half assed job, try to get people to make their scripts for them and leave, all the while remaining as ignorant in scripting as when they first started. take my advice, fix that script up (shorten it) and you will easily be able to catch any problems as well as make it much more functional than it is now.

<{POST_SNAPBACK}>

Aight, I don't make all game scripts. I'm a semi beginner programmer with autoit and I agree, I am ignorant in scripting, but I was not aiming at doing a halfassed job. And, how would doing more han I have to be considered halfassed?

Edit-* And by the way, this is the first time I've ever asked for help on my scripts.

Edited by shoe7ess
Link to comment
Share on other sites

ok, can you at least edit the post to put the code into code tags?

Doing the other things would make it easier to find the part of the script that's causing the problem.

Have you checked out Au3Check that Tylo wrote and is included with the SciTE install set?

 

<{POST_SNAPBACK}>

I'm not aware of it, could you give me a link to the download for it?
Link to comment
Share on other sites

this is how you learn, thats the problem with the game scripters, they come in, do a half assed job, try to get people to make their scripts for them and leave, all the while remaining as ignorant in scripting as when they first started. take my advice, fix that script up (shorten it) and you will easily be able to catch any problems as well as make it much more functional than it is now.

<{POST_SNAPBACK}>

and if you run Jdeb's Tidy it'll point you in the right direction for your func nesting errors... (and boy does it look ugly)

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

I guess you want to call function SelChar2() not Define it?

Just remove the Func infront of it ( and the others in the same function..

ps. error at line 0 is always reported when you are running a compiled script.

<{POST_SNAPBACK}>

um, yeah, what he said. you don't use "fun FunctionX" to use functionx, just to define it...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

ok, I'm heading home, must stop thinking about this, one last remark, even after fixing all the errors tidy picked up, au3check is showing a few functions that're defined multiple times and syntax error in the iniread...

>"C:\Program Files\AutoIt3\SciTe\au3check\au3check" "Z:\tools\autoit\test.au3"
AutoIt3 Syntax Checker v1.09, Copyright (c) Tylo, 2004

Z:\tools\autoit\test.au3
Z:\tools\autoit\test.au3(25,79) : ERROR: syntax error
$Parameter = IniRead("PermerConfig.ini", "Diablo II Settings", "D2Parameter", Exit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(258,14) : ERROR: Login2() already defined.
Func Login2()
~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(316,16) : ERROR: syntax error
         Login3
~~~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(399,9) : ERROR: syntax error
EndFunc SelChar2
~~~~~~~~^
Z:\tools\autoit\test.au3(405,1) : ERROR: syntax error
Func
^
Z:\tools\autoit\test.au3(85,11) : ERROR: SelChar3(): undefined function.
SelChar3 ()
~~~~~~~~~~^
Z:\tools\autoit\test.au3(144,9) : ERROR: Login3(): undefined function.
Login3 ()
~~~~~~~~^
>Exit code: 2   Time: 0.209

so, yeah, check out the scite installset, ctrl-f5 to au3check and go from there. doubleclicking an error takes you to the line where it is...

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

ok, I'm heading home, must stop thinking about this, one last remark, even after fixing all the errors tidy picked up, au3check is showing a few functions that're defined multiple times and syntax error in the iniread...

>"C:\Program Files\AutoIt3\SciTe\au3check\au3check" "Z:\tools\autoit\test.au3"
AutoIt3 Syntax Checker v1.09, Copyright (c) Tylo, 2004

Z:\tools\autoit\test.au3
Z:\tools\autoit\test.au3(25,79) : ERROR: syntax error
$Parameter = IniRead("PermerConfig.ini", "Diablo II Settings", "D2Parameter", Exit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(258,14) : ERROR: Login2() already defined.
Func Login2()
~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(316,16) : ERROR: syntax error
         Login3
~~~~~~~~~~~~~~~^
Z:\tools\autoit\test.au3(399,9) : ERROR: syntax error
EndFunc SelChar2
~~~~~~~~^
Z:\tools\autoit\test.au3(405,1) : ERROR: syntax error
Func
^
Z:\tools\autoit\test.au3(85,11) : ERROR: SelChar3(): undefined function.
SelChar3 ()
~~~~~~~~~~^
Z:\tools\autoit\test.au3(144,9) : ERROR: Login3(): undefined function.
Login3 ()
~~~~~~~~^
>Exit code: 2    Time: 0.209

so, yeah, check out the scite installset, ctrl-f5 to au3check and go from there.  doubleclicking an error takes you to the line where it is...

<{POST_SNAPBACK}>

alright, i did this, and i can run the compiled script, but it won't run the process i'm telling it to run.
Link to comment
Share on other sites

alright, i did this, and i can run the compiled script, but it won't run the process i'm telling it to run.

<{POST_SNAPBACK}>

what? What did you do?

I'm not going to start guessing what you mean, you're going to have to be a bit more descriptive...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

well

;=============================================
;            Login to account 3
;=============================================

Func Login2 ()

MouseClick ("left", 473, 357, 2, 5)

Send ($AccountName3)

Send ("{TAB}")

Sleep (200)

Send ($AccountPass3)

Sleep (1000)

Send ("{ENTER}")

Sleep (60000)

Return

EndFunc
is that function supposed to be named Login3 or no?
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
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...