So Im trying to make a script where its just simply analyzing numbers from a game that I play.
So essentially it would work like this
Sequence 1
If Clipboard > 10 then
Execute left click at (X, Y)
If Clipboard <10 then
Change settings of the game
Execute left click at (X,Y)
The adaptable variable is "Find Image" synchronizing it as it changes so if one image isnt found it will continue until the next image is found . Which when the "Change settings of game" occurs it will then not search the same image from sequence 1, but now looking for the image on Sequence 2 be
Sequence 2
If Clipboard value > 34 then
Execute left click at (X,Y)
Else
Execute left click at (X,Y)
Execute left click at (X,Y)
End
As for programming experience, I use to do code on LUA a few years back (forgot alot of it by now). I also put the delay for that period , just so I can assure its executing commands properly. Also do still have some questions , help is always appreciated.
1.) After each round of the game due to this synchronization , do I have to "Reset" clipboard value after each result? or does it automatically override it with new clipboard value?
2.) How do I necessarily hold one variable without it being overwritten by the Clipboard? I.e. ( I would want it to run a certain setting until a certain amount of energy is made, but this amount of energy that needs to be made is the amount that we lost from the previous sequence?)
This is what I have now, but its having problems running the else portion . Thanks again in advance.
Code: Select all
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 0, 0, 1920, 1080, C:\Users\ancie\Documents\Macro\Capture.PNG
CenterImgSrchCoords("C:\Users\ancie\Documents\Macro\Capture.PNG", FoundX, FoundY)
If ErrorLevel = 0
Click, %FoundX%, %FoundY%, 0
If ErrorLevel = 0
{
Click, 846, 760, 0 ; Checking if we won last round or not
Sleep, 500
Click, Left, , Down
Sleep, 500
Click, 1246, 760 Left, Up
Sleep, 500
Click, Left, , Up
Sleep, 500
ControlGetText, Clipboard, , A
If Clipboard > 10 ; We copied the number, now verify the number is greater then 10
{
Click, 1368, 621 Left, 1
Sleep, 500
}
Else ; Ok now we lost last round now lets change settings.
{
Click, 943, 459 Left, Down
Sleep, 10
Click, 1040, 459 Left, Up
Sleep, 10
Click, 1368, 621 Left, 1
Sleep, 500
}
}