ken107

Script dont work Help pls!

9 posts in this topic

#1 ·  Posted (edited)

hey guys this is my script i dont know why it dont work hope someone can help me

 

#include <AutoItConstants.au3>


HotKeySet("{F6}", "Start")
HotKeySet("{ESC}", "Stop")

While 1
    Sleep(100)
WEnd

Func Start()
    While 1
        $SearchResult = PixelSearch(836, 921, 836, 921, 0x2F372A, 10) ;;Find Health pixel (Schwarz)
        If Not @error Then

            MouseMove(845, 901, 0) ;; Bewegt maus auf die einheit die low ist

            MouseClick($MOUSE_CLICK_LEFT) ;; Double Click on the target
            MouseClick($MOUSE_CLICK_LEFT)

            $Pixel = PixelSearch(31, 800, 349, 1018, 0xA8B0A3, 10) ;; Find Base Pixel (Weiß)
            If Then

                MouseMove($Pixel[0], $Pixel[1], 3) ;; Move Mouse to Weiß Pixel
                MouseClick($MOUSE_CLICK_RIGHT) ;;Double right click
                MouseClick($MOUSE_CLICK_RIGHT)

                Sleep(200)

                Do

                Until IsArray($SearchResult) = True
                Sleep(500)


            EndIf

            Sleep(100)

        WEnd
    WEnd
EndFunc    ;==>Start

Func Stop()
    Exit
EndFunc    ;==>Stop

 

ERROR:

(40) : ==> "Wend" statement with no matching "While" statement.:
WEnd

 

 

cant find my mistake :( maybe im too dumb ^^
ty for your help

 

Edited by Jos

Share this post


Link to post
Share on other sites



Welcome to the Forum.  :)

Use Tidy to see the error.

e.g.; the line

"  If Then "

is incorrect.

Also there is no second while. therefore the error message.

 

 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

Have a look at your Tidied source which shows your issue closing an If with a Wend.
There are other errors in you code which you can easily find by installing the Full SciTE4AutoIt3 package which runs au3check for you.

Jos

PS: Also please read our forum rules as this script seems to be for some sort of game?


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

Share this post


Link to post
Share on other sites

ty for the fast answer but now i got other error dunno is my while wrong?

 

 

 

 #include <AutoItConstants.au3>


HotKeySet("{F6}","Start")
HotKeySet("{ESC}","Stop")

While 1
Sleep(100)
WEnd

Func Start ()
         While 1
                  $SearchResult = PixelSearch ( 836, 921, 836, 921, 0x2F372A,10)        ;;Find Health pixel (Schwarz)
                  If Not @error Then

                  MouseMove(845, 901,0)    ;; Bewegt maus auf die einheit die low ist

                  MouseClick($MOUSE_CLICK_LEFT)    ;; Double Click on the target
                  MouseClick($MOUSE_CLICK_LEFT)

         While 2

                  $Pixel = PixelSearch ( 31, 800, 349, 1018, 0xA8B0A3,10 )        ;; Find Base Pixel (Weiß)

                     MouseMove($Pixel[0], $Pixel[1], 3)            ;; Move Mouse to Weiß Pixel
                     MouseClick($MOUSE_CLICK_RIGHT)                ;;Double right click
                     MouseClick($MOUSE_CLICK_RIGHT)

                     Sleep(200)

                     Do

                     Until IsArray ($SearchResult) = True
                     Sleep(500)


                     Sleep(100)

               WEnd
         WEnd                                   (row 40)
   EndFunc

Func Stop ()
   Exit
EndFunc

 

 

 

 

 

(40) : ==> "Wend" statement with no matching "While" statement.:
WEnd

Share this post


Link to post
Share on other sites

In SciTE press Ctrl+T and you'll see where the problem lies.

Also, read the forum rules. This looks like gameplay automation and those kinds of scripts are not allowed. (Find Health pixel, click target)

Share this post


Link to post
Share on other sites
38 minutes ago, InunoTaishou said:

In SciTE press Ctrl+T and you'll see where the problem lies.

Only after loading the full SciTE4AutoIt3 version. ;)

@ken107, please use the code (<>) box option to post scripts for readability.
Did you do as I suggested?

Jos

 


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

Share this post


Link to post
Share on other sites

triple post? great ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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