Hello, this is my code and for some reason, it has to wait for the click2play image to be found then click it. It won't even move to the button. But when I put a message after the wait for image thing, it displays the message before I can even see the image and it doesn't click it! please help!
My code:
Dialog>MyDialog
Caption=AnotherAlcher
Width=407
Height=221
Top=271
Left=665
Button=Credits,168,88,57,35,3
Button=Exit AnotherAlcher,208,128,124,46,2
Button=Start Alching,64,128,124,46,4
Edit=user,8,56,177,Type User Name Here
Edit=pass,216,56,177,Type Pass Word Here
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,End
If>result=3,Credits
if>result=4,Start
Goto>MainLoop
SRT>Credits
MessageModal>Coded & Tested By M0K3Y for http://www.anotherbot.tk
END>Credits
Label>Start
Wait>1
Ask>AnotherAlcher will now open Runescape. Continue?,continue
if>continue=YES
ExecuteFile>http://www.runescape.com/game.ws?j=1
endif
if>continue=NO
MessageModal>You have chosen to end AnotherAlcher. If this is an error, please report at http://www.anotherbot.tk
endif
WaitScreenImage>/LogIn.bmp,0
Wait>2
Press Enter
SendText>%MyDialog.user%
Wait>1
Press Enter
Wait>1
SendText>%MyDialog.pass%
Wait>1
Press Enter
WaitScreenImage>/click2play.bmp,0
FindImagePos>/click2play,SCREEN,0,1,X,Y,clickPlay
Wait>4
if>clickPlay>0
MouseMove>X_0,Y_0
Wait>1
LClick
endif
Label>End
Why won't it click the click to play button :(
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
You did not specify how long to wait for the image.
Also you set the color tolerance on your FindImagePos command to 0, meaning you expect to find an exact match. That sometimes is not true when you run your script on other machines. You should test this with different windows display settings. The problem occurs when the target machine is set to 16bits or less and you recorded at 24 or 32 bits. Usually a color tolerance of 10 works well for me.
Gale
Code: Select all
//Set timeout to 10 seconds using system variable.
//It will wait the full 10 seconds only if the image does not display
Let>WSI_TIMEOUT=10
WaitScreenImage>/click2play.bmp,0
if>WSI_TIMEDOUT=TRUE
MessageModal>Timed out, did not see image within the 10 seconds
endif
if>WSI_TIMEDOUT=FALSE
MessageModal>Did not timeout, saw image within the 10 seconds
//The FindImagePos command should work
endif
Gale
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
But
But I want it to keep waiting forever, until the image is found
OK, then leave it like you had it.
If WSI_TIMEOUT is set to 0 (the default), then the script waits forever (not zero seconds as you might think, at least that is what the user guide says).
Are you getting past the WaitScreenImage?
It should return a value of FALSE for WSI_TIMEDOUT.
What value was returned for your image count variable clickPlay?
What values were returned for X_0 and Y_0.
That should explain the behavior of the script.
Gale
If WSI_TIMEOUT is set to 0 (the default), then the script waits forever (not zero seconds as you might think, at least that is what the user guide says).
Are you getting past the WaitScreenImage?
It should return a value of FALSE for WSI_TIMEDOUT.
What value was returned for your image count variable clickPlay?
What values were returned for X_0 and Y_0.
That should explain the behavior of the script.
Gale