for running some time, it can only send the first 10 friends.
I added some code like this
var retry = 0;
while(this.isRunning) {
var img = this.screenshot();
isHs0 = isSameColor(Button.outSendHeart0.color, this.getColor(img, Button.outSendHeart0));
isHs1 = isSameColor(Button.outSendHeart1.color, this.getColor(img, Button.outSendHeart1));
isHs2 = isSameColor(Button.outSendHeart2.color, this.getColor(img, Button.outSendHeart2));
isHs3 = isSameColor(Button.outSendHeart3.color, this.getColor(img, Button.outSendHeart3));
releaseImage(img);
// by ttung
if (!isHs0 && !isHs1 && !isHs2 && !isHs3) {
if(retry<=5){
this.tapDown(Button.outSendHeart3, 100);
this.moveTo (Button.outSendHeart3, 100);
moveTo(Button.outSendHeart3.x, Button.outSendHeart3.y-10, 500);
this.tapUp (Button.outSendHeart0, 100);
retry ++;
}
else
{
break;
}
}
else
{
if (isHs0) {this.tap(Button.outSendHeart0);sleep(2000);this.tap(Button.outReceiveOk);sleep(3000);this.tap(Button.outReceiveOk);sleep(1700);}
if (isHs1) {this.tap(Button.outSendHeart1);sleep(2000);this.tap(Button.outReceiveOk);sleep(3000);this.tap(Button.outReceiveOk);sleep(1700);}
if (isHs2) {this.tap(Button.outSendHeart2);sleep(2000);this.tap(Button.outReceiveOk);sleep(3000);this.tap(Button.outReceiveOk);sleep(1700);}
if (isHs3) {this.tap(Button.outSendHeart3);sleep(2000);this.tap(Button.outReceiveOk);sleep(3000);this.tap(Button.outReceiveOk);sleep(1700);}
this.tapDown(Button.outSendHeart3, 100);
this.moveTo (Button.outSendHeart3, 100);
this.moveTo (Button.outSendHeart2, 100);
this.moveTo (Button.outSendHeart1, 100);
this.moveTo (Button.outSendHeart0, 1000);
this.tapUp (Button.outSendHeart0, 100);
}
} |