Sign in to follow this  
Followers 0
doyoulikecheese

Help with debugging...

3 posts in this topic

The debugger (ctrl+f5) says I have a missing 'wend' in a function of this little script I made, but I can't seem to see where.

Here is the script:

----------------------------------------------

Sleep (10000)

While 1=1

func bot()

func cc()

WEnd

func attackpickup()

($i=0

while $i<=9

send ("{LCTRL down}")

sleep (10000)

send ("{LCTRL up}")

sleep (250)

send ("{Z down}")

sleep (5000)

send ("{Z up}")

sleep (500)

$i=$i+1

wend)

endfunc

func special()

($p = 0

while $p<=1

send ("{RSHIFT down}")

sleep (7500)

send ("{RSHIFT up}")

sleep (250)

send ("{Z down}")

sleep (3750)

send ("{Z up}")

sleep (250)

send ("{END}")

sleep (500)

send ("{DEL}")

sleep (500)

$p=$p+1

wend)

endfunc

func bot()

($b=0

while $b<=1

func attackpickup()

func special()

func attackpickup()

$b=$b+1

wend)

endfunc

func cc()

(Sleep (2000)

Send ({ESC})

Sleep (750)

Send ({ENTER})

Sleep (750)

Send ({RIGHT})

Sleep (100)

Send ({ENTER}))

endfunc

------------------------------------------------

Thank you all very much.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

(Hint [_autoit_] Code here [/_autoit_] without the 4 _ will make it more pretty to read)

First of all just use

While 1
    .....
    .....
WEndoÝ÷ Ù«­¢+ÙÕ¹½Ð ¤(%1½°ÀÌØíôÀ(%]¡¥±ÀÌØí±ÐìôÄ($%ÑÑ­Á¥­ÕÀ ¤($%ÍÁ¥° ¤($%ÑÑ­Á¥­ÕÀ ¤($$ÀÌØí¬ôÄ(%]¹)¹Õ¹oÝ÷ Ù«­¢+ÙÕ¹ÑÑ­Á¥­ÕÀ ¤(%1½°ÀÌØí¤ôÀ(%]¡¥±ÀÌØí¤±Ðìôä($%M¹ ÅÕ½Ðíí1
QI0½Ý¹ôÅÕ½Ðì¤($%M±À ÄÀÀÀÀ¤($%M¹ ÅÕ½Ðíí1
QI0ÕÁôÅÕ½Ðì¤($%M±À ÈÔÀ¤($%M¹ ÅÕ½Ðííh½Ý¹ôÅÕ½Ðì¤($%M±À ÔÀÀÀ¤($%M¹ ÅÕ½ÐííhÕÁôÅÕ½Ðì¤($%M±À ÔÀÀ¤($$ÀÌØí¤¬ôÄ(%]¹)¹Õ¹oÝ÷ Ù«­¢+ÙÕ¹ÍÁ¥° ¤(%1½°ÀÌØíÀôÀ(%]¡¥±ÀÌØíÀ±ÐìôÄ($%M¹ ÅÕ½ÐííIM!%P½Ý¹ôÅÕ½Ðì¤($%M±À ÜÔÀÀ¤($%M¹ ÅÕ½ÐííIM!%PÕÁôÅÕ½Ðì¤($%M±À ÈÔÀ¤($%M¹ ÅÕ½Ðííh½Ý¹ôÅÕ½Ðì¤($%M±À ÌÜÔÀ¤($%M¹ ÅÕ½ÐííhÕÁôÅÕ½Ðì¤($%M±À ÈÔÀ¤($%M¹ ÅÕ½Ðíí9ôÅÕ½Ðì¤($%M±À ÔÀÀ¤($%M¹ ÅÕ½Ðíí1ôÅÕ½Ðì¤($%M±À ÔÀÀ¤($$ÀÌØíÀ¬ôÄ(%]¹)¹Õ¹oÝ÷ Ù«­¢+ÙÕ¹ ¤(%M±À ÈÀÀÀ¤(%M¹£qíM
÷t¤(%M±À ÜÔÀ¤(%M¹£qí9QI÷t¤(%M±À ÜÔÀ¤(%M¹£qíI%!Q÷t¤(%M±À ÄÀÀ¤(%M¹£qí9QI÷t¤)¹Õ¹
Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The debugger (ctrl+f5) says I have a missing 'wend' in a function of this little script I made, but I can't seem to see where.

Here is the script:

An easy way to find you mistake(s) is to run Tidy ..

In this case it sees a lot of problems:

Sleep(10000)
While 1 = 1
;### Tidy Error -> while Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func bot()
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
        Func cc()
        WEnd

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
        Func attackpickup()
            ($i = 0
            While $i <= 9
                Send("{LCTRL down}")
                Sleep(10000)
                Send("{LCTRL up}")
                Sleep(250)
                Send("{Z down}")
                Sleep(5000)
                Send("{Z up}")
                Sleep(500)
                $i = $i + 1
                WEnd)
;### Tidy Error -> "endfunc" is closing previous "while"
            EndFunc   ;==>attackpickup

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
            Func special()
                ($p = 0
                While $p <= 1
                    Send("{RSHIFT down}")
                    Sleep(7500)
                    Send("{RSHIFT up}")
                    Sleep(250)
                    Send("{Z down}")
                    Sleep(3750)
                    Send("{Z up}")
                    Sleep(250)
                    Send("{END}")
                    Sleep(500)
                    Send("{DEL}")
                    Sleep(500)
                    $p = $p + 1
                    WEnd)
;### Tidy Error -> "endfunc" is closing previous "while"
                EndFunc   ;==>special

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
                Func bot()
                    ($b = 0
                    While $b <= 1
;### Tidy Error -> while Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
                        Func attackpickup()
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
                            Func special()
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
                                Func attackpickup()
                                    $b = $b + 1
                                    WEnd)
                                EndFunc   ;==>attackpickup

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
                                Func cc()
                                    (Sleep(2000)
                                    Send(â{ESC}â)
                                    Sleep(750)
                                    Send(â{ENTER}â)
                                    Sleep(750)
                                    Send(â{RIGHT}â)
                                    Sleep(100)
                                    Send(â{ENTER}â))
                                EndFunc   ;==>cc

Main reason is that you cannot have Func...EndFunc inside a While...Wend loop..

To "call" a Func you don't use "Func bot()" but just "bot()"

To end a While you use "Wend" not "Wend)"

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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