TomaSzz Posted May 26, 2010 Share Posted May 26, 2010 (edited) im wondering how to make like u have func and it calls other func ,but when it calls bk to first one.. it wont call it at start of first pixel search.. it will continue the Func 1() at where it left off for example at second pixel search it called 6 and func 6() called bk to func 1() and so func 1() will continue form last pixelsearch.. if u gett me example: Func 1() While 1 searchpixel("............") if not @eror then send("...") Call("5") searchpixel("............") if not @eror then send("...") Call("6") searchpixel("............") if not @eror then send("...") Call("7") EndFunc Func 5() send("..") [color="#FF0000"]Call("1") ;but how to make it continue the func1 at where it left of there?[/color] endfunc func 6() send("") [color="#FF0000"]Call("1") ;but how to make it continue the func1 at where it left of there?[/color] endfunc func 7() send("") [color="#FF0000"]Call("1") ;but how to make it continue the func1 at where it left of there?[/color] endfunc Edited May 26, 2010 by TomaSzz Link to comment Share on other sites More sharing options...
AlmarM Posted May 26, 2010 Share Posted May 26, 2010 You mean like $Color = "#FF0000" Call("1") ? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 hmm not rly.. i mean like... when Func 1() will call func 5() from middle of Func 1() .. func5 will do its job ,but when func 5() will call bk to Func 1() ..func 1() wont start from begining,but continue from it left off at last call... get me now? Link to comment Share on other sites More sharing options...
JohnOne Posted May 26, 2010 Share Posted May 26, 2010 donr call the function, use Return, it will do what you want. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
AlmarM Posted May 26, 2010 Share Posted May 26, 2010 Aah, ok. Uhm... Mayby this could be useful? MyFunc1(1) Func MyFunc1($Value) If $Value < 5 Then MsgBox(64, "", "Value is still smaller as 5! [" & $Value & "]") MyFunc2($Value) Else MsgBox(64, "", "Value equals to 5! [" & $Value & "]") Exit EndIf EndFunc Func MyFunc2($Value) $Value += 1 MyFunc1($Value) EndFunc Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 Aah, ok. Uhm... Mayby this could be useful? MyFunc1(1) Func MyFunc1($Value) If $Value < 5 Then MsgBox(64, "", "Value is still smaller as 5! [" & $Value & "]") MyFunc2($Value) Else MsgBox(64, "", "Value equals to 5! [" & $Value & "]") Exit EndIf EndFunc Func MyFunc2($Value) $Value += 1 MyFunc1($Value) EndFunc i totaly dont get this script maybe in simpler way? Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 donr call the function, use Return, it will do what you want.so for example i write this Return("1")? Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 would this return work for like 3Funcs? like this: Func 1() something here.... Call("2") EndFunc func 2() sumtin here... Call("3") endfunc Func 3() sumtin here.. and return to first func to where it left off... endfunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2010 Moderators Share Posted May 26, 2010 TomaSzz,You are getting yourself and us very confused here. Look at this short script - when you run it you return to Func _1 and continue the function where you left off:_1() Func _1() ConsoleWrite("Starting 1" & @CRLF) _2() ConsoleWrite("Continuing 1" & @CRLF) Return EndFunc Func _2() ConsoleWrite("Starting 2" & @CRLF) _3() Return EndFunc Func _3() ConsoleWrite("Starting 3" & @CRLF) Return EndFuncThe Return commands are not really necessary, but they do not harm. Note you do not need Call - you just use the function name. Does that make it clearer? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 ok but...as far as i understand return function returns u to previous func? dont it? and waat i want to make is like 3rd func to call 1st func but not start the 1st func from beginning,just keep going as where it finished Link to comment Share on other sites More sharing options...
cageman Posted May 26, 2010 Share Posted May 26, 2010 Return means it returns to the moment after the function was called so in your case it would be the previous function yes. Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 ow damn... i want to return to first func not second Link to comment Share on other sites More sharing options...
cageman Posted May 26, 2010 Share Posted May 26, 2010 (edited) Just realized i understood you wrong. _1() Func _1() ConsoleWrite("Starting 1" & @CRLF) _2() ConsoleWrite("Continuing 1" & @CRLF) Return EndFunc Func _2() ConsoleWrite("Starting 2" & @CRLF) _3() Return EndFunc Func _3() ConsoleWrite("Starting 3" & @CRLF) Return EndFunc look at this code from Melba. What happens is call function 1 print starting 1 call function 2 print starting 2 call function 3 print starting 3 return to where function 2 was return to where function 1 was print continuing return at the point where function 1 was called (in this program it means no code left to be executed) hope this info helps. try to read the code and my text with it. Edited May 26, 2010 by cageman Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2010 Moderators Share Posted May 26, 2010 TomaSzz,Have you run the code?What is happening within it is as follows:- Start Func _1- Interrrupt Func _1 to run Func _2- Start Func _2- Func _2 now runs Func _3- Start Func _3- End Func _3 which returns you to the calling point in Func _2- End Func _2 (because there is nothing left to run) and return to the calling point in Func _1- Continue running Func _1 until it ends.That is what you said you wanted to happen. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 No hard feelings, but do you understand what we are saying? _1() Func _1() ConsoleWrite("Starting 1" & @CRLF) _2() ConsoleWrite("Continuing 1" & @CRLF) Return EndFunc Func _2() ConsoleWrite("Starting 2" & @CRLF) _3() Return EndFunc Func _3() ConsoleWrite("Starting 3" & @CRLF) _1() Return EndFunc this would create an endless loop that would go through the functions like: 1 --> 2 --> 3 --> 1 --> 2 --> 3.. you really want this? lets hope it helps ye now i get it so i just add like in my script i got Func 1() and Func 3() so if i just add at func 3 that Func 3() some stuff of my own here with Send and sleep lines.. _1() Return endfunc this would do huh? TomaSzz, Have you run the code? What is happening within it is as follows: - Start Func _1 - Interrrupt Func _1 to run Func _2 - Start Func _2 - Func _2 now runs Func _3 - Start Func _3 - End Func _3 which returns you to the calling point in Func _2 - End Func _2 (because there is nothing left to run) and return to the calling point in Func _1 - Continue running Func _1 until it ends. That is what you said you wanted to happen. M23 ye but ur second func has nothing in it... and mine does Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2010 Moderators Share Posted May 26, 2010 TomaSzz, ye now i get itNo you do not!. If you call Func _1 again from within Func _3 you will get into an infinite recursive loop and crash. ur second func has nothing in it... and mine doesAnd here is a way to get over that: _1() Func _1() ConsoleWrite("Starting 1" & @CRLF) _2() ConsoleWrite("Continuing 1" & @CRLF) EndFunc Func _2() ConsoleWrite("Starting 2" & @CRLF) If _3() = 1 Then Return Else ConsoleWrite("Continuing 2" & @CRLF) EndIf EndFunc Func _3() ConsoleWrite("Starting 3" & @CRLF) Return 1 EndFunc Now you miss the rest of Func _2 when you return from Func _3 - unless you do not want to, of course, when you use Return 0. Are we getting closer? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 (edited) ok so what this now does is...it will do func 1 then func 2 then func3 and return to func 1 by going to func 2 and skipping it? and why there is _2() in func 1 after second console write? Edited May 26, 2010 by TomaSzz Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2010 Moderators Share Posted May 26, 2010 TomaSzz,Yes. You can decide within Func _3 whether to skip the rest of Func _2 or not - it all depends on the Return value. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TomaSzz Posted May 26, 2010 Author Share Posted May 26, 2010 (edited) Func 11() $coord = PixelSearch(383, 6, 496, 19, 0x6F0000, 4) If Not @error Then Call("1") Else Target() Return EndIf EndFunc where would i put this part then? If _3() = 1 Then Return Else here? Func 11() $coord = PixelSearch(383, 6, 496, 19, 0x6F0000, 4) If Not @error Then If _3() = 1 Then Return Else Call("1") Else Target() Return EndIf EndFunc ow wait ..i think its like this aint it? Func 11() $coord = PixelSearch(383, 6, 496, 19, 0x6F0000, 4) If Not @error Then Call("1") Else Target() Return EndIf If _3() = 1 Then Return Else EndIf EndFunc Edited May 26, 2010 by TomaSzz Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2010 Moderators Share Posted May 26, 2010 TomaSzz,Where did Func 11 come from? How can we help you if you keep introducing new segments of you script? I cannot possibly tell you where to put anything in those few lines.My young friend, if you need 11 nested functions to do what you are trying to do, you are almost certainly going about it the wrong way. Why not try to write down what you want to do so you can get a logic flow - rather like the one I used a few posts above? Having one of those makes coding a lot easier. So try and explain what you want to do. Use small phrases (as I did) and take great care when you get to If lines. I know you want to code NOW - but you will only get real spaghetti code which you will never debug unless you get it straight in your head what you actually want the code to do.Over to you - take your time, it is the only way. Once you have it straight, we can help you code it properly. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now