Jump to content

mousemove() loop malfunctioning?


Recommended Posts

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 by The_Lorax
Link to comment
Share on other sites

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 by Valuater

NEWHeader1.png

Link to comment
Share on other sites

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 :P

Edited by The_Lorax
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...