Bruntale Posted June 21, 2012 Share Posted June 21, 2012 Alright, well I tried using the While 1 and Wend to create a constant loop but it doesn't allow my functions to work, not sure what I am doing wrong at this point. I have tried it as many ways as I can, and it still won't allow any of the functions to work. MouseClick("left", 342, 381, 1, 0) sleep(4000) While 1 if checkrequest() Then sleep(300000) Else sleep(300000) endif WEnd That is my code as it sits when I gave up before I came here for help. It does the mouseclick fine, but when it gets to the checkrequest part it runs it, but it continues to run it where the checkrequest won't work, as that is a seperate function. MouseClick("left", 342, 381, 1, 0) sleep(4000) checkrequest() sleep(300000) checkrequest() sleep(300000) checkrequest() sleep(300000) checkrequest() sleep(300000) I even thought something like this would work, as I gave the functions 5 minutes between each before it ran the next. But again, no avail. I have hit a dead end and stretched my brain as far as I can. But any way I put the "While 1 and WEnd" or the "checkrequest()" strings, I have come up empty. While using each function I got it to do the checkrequest once, and then it fails. Any help in how I can get this to continously work would be very much appreciated. Link to comment Share on other sites More sharing options...
Bruntale Posted June 21, 2012 Author Share Posted June 21, 2012 Also, I have scoured the forums and even searched google before posting, but I have come up empty. Thanks for any help. Link to comment Share on other sites More sharing options...
RichardL Posted June 21, 2012 Share Posted June 21, 2012 The code you've shown does not show the problem, think the problem is in your checkrequest function. In the above code(s) replace checkrequest() with Beep(512, 40). This will show that this part is alright. Then debug checkrequest with ConsoleWrites, Beeps, etc. Richard. Link to comment Share on other sites More sharing options...
Kidney Posted June 21, 2012 Share Posted June 21, 2012 (edited) look at the code i made as an example of what you r trying to do. sleep(4000) While 1 if checkrequest() Then sleep(3000) Else checkfalse() endif WEnd Func checkrequest() MsgBox(0, "Test", "Testing loop...", 3) EndFunc Func checkfalse() MsgBox(0, "Failed", "If is False", 3) EndFunc now, here is something similar to what u r trying to do, but in a different way sleep(4000) $funcResult = True While 1 checkrequest() if $funcResult = True Then MsgBox(0, "True", $funcResult, 3) Else MsgBox(0, "False", $funcResult, 3) endif WEnd Func checkrequest() ;Some code $funcResult = Not $funcResult ;This will be done with an if statement somewhere in the function to tell whether or not the function returned successful or not EndFunc Edited June 21, 2012 by Kidney Link to comment Share on other sites More sharing options...
Bruntale Posted June 21, 2012 Author Share Posted June 21, 2012 I didn't expect to get answers so fast, thank you. I didn't think to look at my checkrequest() function as it works 100% if I don't put it in a continous loop. I will see if I can change anything there and keep testing it. And Kidney, that is sort of what I am doing. It runs through 5 statements and if one of them are true it ends the request, if they are not true then it sleeps and runs the function again to whatever I set the delay to. Link to comment Share on other sites More sharing options...
Bruntale Posted June 22, 2012 Author Share Posted June 22, 2012 (edited) func checkrequest() $request = "" if findstring(" ") then If request("") Then ElseIf request("") Then ElseIf request("") Then ElseIf request("") Then ElseIf request("") Then ElseIf request("") Then ElseIf request("") Then ElseIf request("") Then EndIf Else return 0 EndIf EndFunc That is my basic checkrequest() function that won't work if I put it in a continous loop. But it works fine if I don't put it in a loop and just run it once. Also, I was toying with the idea of using a keystroke to basically active the checkrequest() function every so often, and running the keystroke in the continous loop. Would that help? Or would it be to much? Edited June 22, 2012 by Bruntale Link to comment Share on other sites More sharing options...
Kidney Posted June 22, 2012 Share Posted June 22, 2012 put a msgbox in the checkrequest() just to see if it gets called or not. if it doesnt, place a msgbox at the beginning of the while loop to see if the loops is working. i would put it after the call for checkrequest() Link to comment Share on other sites More sharing options...
Bruntale Posted June 23, 2012 Author Share Posted June 23, 2012 Hmm, after playing with it for a day all of a sudden now my script won't even work. It runs, but the screen just blinks and I have touched nothing besides my first function. One more question, is there another way to locate text on the screen or is findstring() my only option? It just seems to sort of lag each time it runs. My checkrequest() function works 60% of the time. The other times is pretty much seems to lag out. 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