Sikuli - how to read numbers

Asked by yazan

I wanna build a Sikuli program for Starcraft. Idealy it would read the minerals count area and if i have over a certain limit, "x", then do a specific action. My problem is reading the:

if minerals >= "x"

is it even possible with sikuli?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
j (j-the-k) said :
#1

see http://doc.sikuli.org/screen.html#Screen.capture

Use capture() to capture the whole screen.
The save location will be returned as a string.

Revision history for this message
j (j-the-k) said :
#2

Sorry wrong question :D ignore my answer

Revision history for this message
yazan (yazan-tarzan) said :
#3

lol ok

Revision history for this message
RaiMan (raimund-hocke) said :
#4

First you have to try, wether it is possible at all, to "read" the numbers from the count area:

r = selectRegion("select the count area as small as possible")
print r.text()

if you get sufficient results, the principal workflow is something like that:

countArea = .... # somehow make it the region containing the counter
maxCount = ... # the limit
count = 0
while count <= maxCount:
    count = int(countArea.text())
    wait(1) # pause a adaquate number of seconds
# now count is >maxCount
.... # your actions

Can you help with this problem?

Provide an answer of your own, or ask yazan for more information if necessary.

To post a message you must log in.