Richard81 0 Posted July 16, 2015 Hello guys, I explain my little problemI have a funcion, when an IF statement is true, it writes in console something and then "return" to another script, when IF is false, it goes on in the same script.Sometimes, I can't understand why, even if the "return" is applied, before going to the other script, the next instruction (a ConsoleWrite) of the same script is written in the console.Could it be a bug?Sometimes, in an unpredictable way, even PixelSearch doesn't work well.Any advise?Thanks in advance Share this post Link to post Share on other sites
SadBunny 130 Posted July 16, 2015 Yes, it is probably a bug. My advise would be to post some actual code so we can help you find it. Roses are FF0000, violets are 0000FF... All my base are belong to you. Share this post Link to post Share on other sites
Richard81 0 Posted July 30, 2015 (edited) expandcollapse popupLocal $win = False If IsArray($coord1) Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - Ho vinto! Al primo controllo" & @LF) $win = True _Importo($puntata[0]) Return Else $coord = PixelSearch(815, 500, 850, 505, '0xBC4B3B') If IsArray($coord) Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - Ho perso! Al primo controllo " & @LF) Switch $tic Case 1 _Tic2() Case 2 _Tic3() Case 3 _Tic4() Case 4 _Tic5() Case 5 _Tic1($func) EndSwitch Else ConsoleWrite ("Sono DALTONICO! " & @LF) Sleep(200) EndIf EndIf Local $coord2 = PixelSearch(815, 520, 850, 525, '0x35AA47') If IsArray($coord2) Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - Ho vinto! Al secondo controllo" & @LF) $win = True _Importo($puntata[0]) Return Else $coord2 = PixelSearch(815, 500, 850, 525, '0xBC4B3B') If IsArray($coord2) Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - Ho perso! Al secondo controllo " & @LF) Switch $tic Case 1 _Tic2() Case 2 _Tic3() Case 3 _Tic4() Case 4 _Tic5() Case 5 _Tic1($func) EndSwitch Else If $win = False Then ConsoleWrite ("Sono DALTONICO VERAMENTE! " & @LF) Sleep(200) Return EndIf EndIf That's the code.Sometimes I found written some statement after call the first "Return", as the code goes on even if should end the function.Even pixelsearch goes wrong sometimes.Any advise of how can I code more strict controls?Thanks in advance Edited July 30, 2015 by Melba23 Added code tags and merged posts Share this post Link to post Share on other sites