Jump to content


Moving withing from a label to another label and back


  • Please log in to reply
2 replies to this topic

#1 Drugoy

Drugoy
  • Guests

Posted 19 July 2012 - 05:24 PM

Hi,
I'm stuck with my code: when some lines of code that are inside of a labeled block of code get executed and then I need to go to another label, execute it and GET BACK TO FIRST label - the script actually stops, instead of continuing to execute lines after "goto somelabel".

Here is an example code of what I am talking about:
Coordmode, mouse, screen
goto textnbox
textnbox:
	Send Cursor will move to the top left corner of the screen in...`n5...`n4...`n3...`n2...`n1...
	goto move
	msgbox, Done!
Return

move:
	MouseMove, 0, 0
Return

The problem is that line "msgbox, Done!" doesn't get executed. Why?
label "move" ends up with "return", why doesn't the script actually go back to the next line after 2nd "goto"?

#2 Pulover

Pulover
  • Members
  • 1251 posts

Posted 19 July 2012 - 05:27 PM

Maybe you meant to use Gosub instead of Goto.

Jumps to the specified label and continues execution until Return is encountered.



#3 Drugoy

Drugoy
  • Guests

Posted 19 July 2012 - 05:29 PM

Aw, damn.
Thanks.