The_Lorax Posted October 9, 2005 Share Posted October 9, 2005 (edited) Func pullcards() Dim $z = 1, $crdpixl While $z = 1 $crdpixl = PixelGetColor(465, 120) If $crdpixl = 16777215 Then $cardcounter = $cardcounter + 1 If $cardcounter < 32 Then MouseClick("left", 533, 202) EndIf ElseIf $crdpixl = 0 Then $cardcounter = $cardcounter + 1 If $cardcounter < 32 Then MouseClick("left", 533, 202) EndIf ElseIf $crdpixl = 65280 Then $cardcounter = $cardcounter + 1 If $cardcounter < 32 Then MouseClick("left", 533, 202) EndIf Else Sleep(200) Call("trade") EndIf ;check if a duel request is recieved and decline if nessecary Call("duel_request") ;check if a PM is recieved and tell them to enter a trade Call("PM") ;check to see if you are still in the trade. MouseMove(376, 130, 3) WEnd EndFunc;==>pullcards This code sometimes gets stuck in an endless loop where it repeatedly moves the mouse to 376, 130 over and over. This occurs even when $crdpixl doesn't equal 16777215,0 or 65280. Has anyone had this happen before or know why it is bugging out? It only seems to crash out when the while loop has gone around a lot. I use this function to select cards from a customer's trade binder, so if it crashes here it brings the entire bot down until I wake up in the morning. Edited October 9, 2005 by The_Lorax Link to comment Share on other sites More sharing options...
Valuater Posted October 9, 2005 Share Posted October 9, 2005 (edited) i dont see 1 a return 2 $z added to or worked with to leave the function 3 $cardcounter is never reset or worked with to leave the function Nothing happens when $cardcounter > 32 execpt $cardcounter=$cardcounter +1 $cardcounter could reach thousands during the night ( maybe millions???) 8) Edited October 9, 2005 by Valuater Link to comment Share on other sites More sharing options...
The_Lorax Posted October 10, 2005 Author Share Posted October 10, 2005 (edited) good spotting - I did a crap job of programming that function - cardcounter was getting incremented multiple times for one card because it was still sitting in the customers binder when the loop went around again (lag) - the loop wasn't exiting when cardcounter was more than 32. Can't believe I didn't see it earlier Edited October 10, 2005 by The_Lorax Link to comment Share on other sites More sharing options...
Valuater Posted October 10, 2005 Share Posted October 10, 2005 glad i could help 8) 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