← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #666773]: How to get on the road as a newcomer to Java programming

 

Question #666773 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/666773

Alexander Schone posted a new comment:
I have fiddled around with my little bot a bit more and Im almost done
with the main function (rerolling). However I came across a problem: the
number 3 is often identified as 8. I have tried using MinSimilarity but
I dont think my script recognises this..

import org.sikuli.script.*;
import org.sikuli.basics.Debug;
import org.sikuli.basics.Settings;

public class TestAuto {

	public static double MinSimilarity = 0.99;
	public static float MoveMouseDelay = 0f;
	static Screen s = new Screen();

        public static void main(String[] args) throws FindFailed,
InterruptedException {

                Debug.setDebugLevel(3);

		Match reRoll = s.find(new Pattern("Reroll.png"));
		Match totalRollLocator = s.find(new Pattern("TotalRoll.png"));
		Match strLocator = s.find(new Pattern("Strength.png").targetOffset(170, 0));
		Match intLocator = s.find(new Pattern("Intelligence.png").targetOffset(220, 0));
		Match wisLocator = s.find(new Pattern("Wisdom.png").targetOffset(220, 0));

		Region totalRollArea = new Region(totalRollLocator.getTopRight().getX(), totalRollLocator.getTopRight().getY(), 70, 50);
		Region tensDigitsArea = new Region(totalRollLocator.getTopRight().getX() + 30, totalRollLocator.getTopRight().getY(), 15, 12);
		Region onesDigitsArea = new Region(totalRollLocator.getTopRight().getX() + 42, totalRollLocator.getTopRight().getY(), 17, 12);
		
		int tensDigitsValue = 0;
		int onesDigitsValue = 0;
		int totalRollValue = 0;

		for (int i = 0; i < 50; i++) {
			// while (true) {
			Match tensDigitsRoll = tensDigitsArea.findBest("number0.png", "number1.png", "number2.png", "number3.png",
					"number4.png", "number5.png", "number6.png", "number7.png", "number8.png", "number9.png");
			tensDigitsValue = tensDigitsRoll.getIndex() * 10;
			System.out.println(tensDigitsRoll.getIndex());
			
			Match onesDigitsRoll = onesDigitsArea.findBest("number0.png", "number1.png", "number2.png", "number3.png",
					"number4.png", "number5.png", "number6.png", "number7.png", "number8.png", "number9.png");
			System.out.println(onesDigitsRoll.getIndex());
		{
				Thread.sleep(200);
		}
			onesDigitsValue = onesDigitsRoll.getIndex();
			totalRollValue = tensDigitsValue + onesDigitsValue;
			if (totalRollValue >= 85) {
				System.out.println(totalRollValue);
				break;
			} else {
				reRoll.click();

			}
		}
	}
}

how can I increase the similarity needed from the standard 0.7 to lets say 0.95?
the way it is now will the script "recognize" this line ?

public static double MinSimilarity = 0.99;

Many thanks in advance again!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.