Jump to content
Sign in to follow this  
Deni

endfunc prob....

Recommended Posts

Deni

Yo!

Im kinda new here ( not really but never posted... Forgot of the site and the program). But now im on again due i heard that my friend started to make scripts with autoit3. So i tought i give it one more chance.

But i made a whole good script for a web game ( Impulse.nu ) but i get a error in the middle of the script... It says that

C:\Documents and Settings\ERM!!!!!\Mina dokument\Denis Dokument\Impulse.au3 (51) : ==> "Func" statement has no matching "EndFunc".:
func para()

Heres that part of the script.

func para()
         $para = 0 Then
         MouseClick("left", 942, 105)
         Send("http://www.impulse.nu/?sida=stan/stan&bankomat=in&q=")
         MouseClick("left", 1014, 690, 2)
         Sleep(300)
         MouseClick("left", 203, 541)
         Send(10000); Skriver hur mkt pengar du ska ta ut
         MouseClick("left", 305, 546)
         sleep(700)
         para()
             EndFunc
     EndIf

Help please never got this prob on autoit2.

any ideas how i can fix it ?

Thanks

Denis

Edited by Deni

Share this post


Link to post
Share on other sites
Mat

i presume you want:

func para()
         If $para = 0 Then
              MouseClick("left", 942, 105)
              Send("http://www.impulse.nu/?sida=stan/stan&bankomat=in&q=")
              MouseClick("left", 1014, 690, 2)
              Sleep(300)
              MouseClick("left", 203, 541)
              Send(10000); Skriver hur mkt pengar du ska ta ut
              MouseClick("left", 305, 546)
              sleep(700)
              para(); messy, but will work. be careful to add in a hotkey to end the script though, as you are creating an infinite loop here
         EndIf
EndFunc

the problem was with your if test, not the function tags. this can get quite confusing!!

MDiesel

edit: beat melba off the mark, and we ended up with identical scripts too!!

edit2: and we both commented on the infinite loop too!!

Edited by mdiesel

Share this post


Link to post
Share on other sites
Melba23

Deni,

You could try changing your code so that the Func...EndFunc and If...EndIf are properly nested:

Func para()
    If $para = 0 Then
        MouseClick("left", 942, 105)
        Send("http://www.impulse.nu/?sida=stan/stan&bankomat=in&q=")
        MouseClick("left", 1014, 690, 2)
        Sleep(300)
        MouseClick("left", 203, 541)
        Send(10000); Skriver hur mkt pengar du ska ta ut
        MouseClick("left", 305, 546)
        sleep(700)
        para()
    EndIf
EndFunc

I presume function para() is defined elsewhere and you have some way of exiting this infinite loop? ;-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Deni

OKey guys will try.

Melba23 i tryed that didint work..

Thanks for fast response too.

Share this post


Link to post
Share on other sites
Deni

Sry for bump but u guys maybe wouldent see that i have posted again ( edited )

I tryed both of your ideas but non of them worked...

I will put out the whole script in this post.

; Gjord av Denis.
; Far ej användas utan mitt tillstand!!!!
; Var inloggad pa impulse

global $paused
HotKeySet("{F3}", "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
                

WinWaitActive("Impulse - The battle for power")
$para; Pengar pa blatte sprak typ hehe
$baxa; Tjuva
$snattevilja; LOL ( Energi )
$liv; Som kebab :P

Sleep(1000)
$lvl = InputBox("Välj Niva Jao!", "baxa1 för juvel butiken ( Mer kommer i nästa version sa sluta klaga"
sleep(300)

If $lvl = "rob1" Then
    rob1()
EndIf

Func snattevilja()
    $sattevilja = 0 Then
WinWaitActive("Impulse - The battle for power")
MouseClick("left", 942, 105)
Send("http://www.impulse.nu/?sida=stan/frukter&kop=1")
     Sleep(400)
     If WinActivate("Internet Explorer", "Du köpte") Then
     Send("{Enter}")
     Sleep(300)  
 ElseIf
    Func para()
    If $para = 0 Then
        MouseClick("left", 942, 105)
        Send("http://www.impulse.nu/?sida=stan/stan&bankomat=in&q=")
        MouseClick("left", 1014, 690, 2)
        Sleep(300)
        MouseClick("left", 203, 541)
        Send(10000); Skriver hur mkt pengar du ska ta ut
        MouseClick("left", 305, 546)
        sleep(700)
        para()
    EndIf
EndFunc
     
If $lvl = "baxa1" Then
        baxa1()
    EndIf
    EndFunc
    
    
    
Func baxa1()
    While $baxa1 = 1
    Sleep(500)
    MouseClick("left", 942, 105)
    Send("http://www.impulse.nu/?sida=jobb/olagliga_jobb&q=juvelbutik&p=redo")
    Sleep(200)
    If WinActivate("Internet Explorer", "Du har tjänat")
        sleep(200)
        Send("{Enter}")
        sleep(300)
        Send("{Enter}")
        Sleep(300)
    If
        WinActivate("Internet Explorer", "Du har inte") Then
        Send("{Enter}")
        $snattevilja = 0
        $baxa = 0
        snattevilja()
    Else
    Send("{Enter}")
         Sleep(200)
         If WinActivate("Internet Explorer", "Du har gatt") Then
             Send("{Enter}")
             Sleep(500)
         EndIf
         Sleep(500)
     $finkan = PixelSearch( 175, 430, 191, 501, 0xCA660B, 5, 2 )
     $para = $para + 1
     If @error Then
        ;Ofta inget sa klart
     Else
        MouseClick("left",$finkan[0],$finkan[1])
        Sleep(1000)
        Send("{ENTER}")
        Sleep(1000)
        MouseClick("left", 942, 105)
        Sleep(100)
        Send("http://www.impulse.nu/?sida=vakter&q=fri")
        Sleep(300)
        Send("{ENTER}")
        Sleep(500)
        If WinActivate("Internet Explorer","Du har inte") Then
            finkan4eva()
        EndIf
        If $para = 20 Then 
            Sleep(200)
            MouseClick("left", 942, 105)
            Sleep(100)
            Send("http://www.impulse.nu/?sida=stan/stan&bankomat=in&q=")
            Sleep(100)
            Send("{ENTER}")
            Sleep(100)
            MouseClick("left", 1014, 690, 2)
            Sleep(300)
            MouseClick("left", 203, 541)
            Sleep(100)
            Send("10000")
            Sleep(300)
            MouseClick("left", 305, 546)
            If WinActivate("Internet Explorer", "Du har inte") Then
                Send("{ENTER}")
            EndIf
            $para = 0
        EndIf
        EndIf
WEnd
EndFunc
While 1
    Sleep(100)
WEnd








Func finkan4ever()
;Om du inte har rad i finkan, stannar den automatisk i 200 sekunder (sparar CPU kraft o.s.v)
    Send("{ENTER}")
    Sleep(200000)
    $money = 19;19! Nästan 20! Nästa gang pa baxa kommer det plussas pa till 20 och da kommer detta aktiveras sa den tar ut pengar
            If $lvl = "rob1" Then
    rob1()
EndIf
EndFunc
Edited by Deni

Share this post


Link to post
Share on other sites
Jos

OKey guys will try.

Melba23 i tryed that didint work..

Thanks for fast response too.

Run your script through Tidy.exe and see what it tells you....

Jos


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
Deni

Run your script through Tidy.exe and see what it tells you....

Jos

Dunno whats that ^^

Share this post


Link to post
Share on other sites
Melba23

Deni,

Looking again at your code, I see you have an infinite recursive loop here = big, big trouble. Do you really need to call the function recursively? Surely you must have an exit strategy?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Deni

Deni,

Looking again at your code, I see you have an infinite recursive loop here = big, big trouble. Do you really need to call the function recursively? Surely you must have an exit strategy?

M23

Well yea i dont know how to explain exaclty why i need it but its a game that you steal and etc. So this buys energy whole time and so on

Share this post


Link to post
Share on other sites
Mat

your nesting is once again the problem, you cannot nest functions inside of other functions as you are doing. neither can if tests run across functions.

MDiesel

Edited by mdiesel

Share this post


Link to post
Share on other sites
Deni

ok but first i will try tidy hold on.

Share this post


Link to post
Share on other sites
Jos

Well yea i dont know how to explain exaclty why i need it but its a game that you steal and etc. So this buys energy whole time and so on

sure, well I am pretty sure recursion is not needed in this func .... but whatever works for you as long as you don't complain about the script being closed when the recursion levels get too high.

Your posted code is a clear indication you need to learn some basics first before continuing.

Jos

Edited by Jos

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
Deni

Install the full SciTE4AutoIt3 installer, Open your script in SciTE and hit Ctrl+T.

Thanks Jos ;) It told me what to do and corrected my script

Big thanks for you and your others taht tryed to help.

And i'm still learning from another script due i think its easier but thanks anyway.

Close or something cause we got a fix here ^_^'

One More thing what the hell is SYntax error ?!

Edited by Deni

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  

×