Re: [Sikuli-driver] [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: Ah, interessant, ja dann werde ich wohl auch umsteigen.. Vielen Dank fuer deine Hilfe und deine Arbeit an dem Projekt! Wenn ich wieder Fragen habe melde ich mich ;) (wahrscheinlich eher frueher als spaeter, werde aber versuchen es auf sikuli fragen zu beschraenken) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Ja, es soll eine GUI werden die dann die Sikuli funktionen steuert. Das wird ein Haufen Arbeit und viel Lernen, aber das ist ja der Sinn der ganzen Sache :) Es ist ein Lernprojekt. Wo ist der vorteil der "zweiten" (Java aware) Methode? Ich denke man lernt mehr wenn man die Koenigsdisziplin waehlt richtig? Eclipse benutze ich jetzt schon, ueberlege auf IntelliJ umzusteigen weil wir das auch auf der Arbeit nutzen habe aber bisher noch keine wesentlichen Vorteile feststellen koennen (meine Einsicht ist natuerlich stark begrenzt). -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Haha, ja das koennten wir tun :) Ich vermute mal, du hast Recht und der Aufwand das zu lernen und dann zu implementieren, lohnt sich fuer mich wohl nicht.. Version 2 ist schon geplant/in Bearbeitung? Wird die neue Version weitere features enthalten oder mehr ein Update oder beides? da kommt mir noch eine weitere Frage: In Bezug auf script Steuerung, wuerdest du empfehlen dies ueber Java zu implementieren, oder die Sikuli integrierte hotkey function? Konkret will ich das script pausieren, stoppen und wieder starten koennen. Ich habe mir beides nur kurz angeguckt. Nachdem ich nun Blut geleckt habe, will ich ein komplettes Programm daraus schreiben ueber die naechsten Monate. Mit GUI, logging, einer database oder integrierte tables (je nach wie umfangreich es wird). -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: "You might dive into and implement your own parallel find, that tries to reuse resources as much as possible." I suppose that is higher level java? I would like to have these processes run in parallel if possible . Not really needed the script is very fast as of now already but why not perfect it. (the German in me speaks strong here ;)) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Interesting, that means i wont have to deal with the script getting slower then, I made some tests measuring the ms it takes to find images and i have made the observsation the time varies between 3 and up to 40 ms for the same looped findBest(10 images), small region 17x12 pixel. I had it running for 5+ iterations and there is no continuous increase or decrease, it jumps from 4 to 20 to 28 to 5 to 3 to 35 to 4 and so on, there is no pattern (that i could see at least). So my assumption is that these fluctuations are due to cpu? is there a way to allocate more resources to the program so that it performs the find operations even faster or more stable? This is not really necessary but it would greatly improve the reroll speed for my bot :) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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 see.. another question: as I understand it, sikuli creates objects for matches and patterns, in other words these objects are pictures right? at what point will these go in and out of memory? and how big is the impact on the system performance? Concrete example: In my script the most used part is creating two matches (using the same method findBest on the same object) of 16x12 pixels. Lets say the loop runs 50.000 times. Will these taken pictures be stored in the memory until the script exits or will the be dumped each time the same match is created? Im worried that if I run this script for a very long time, that it will clutter the memory but this concern might be totally unjustified as I dont really understand how it actually works. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: but the functionality is the same - just pauses script? can I use it like this: wait(0.025f) ? -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Ah that works thank you :) I have solved the 3/8 issue, it turned out that i just had insert some wait() after every reroll to give .findBest() time to detect the new value. why would I use wait instead of thread.sleep though? -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Thank you for these suggestions! I have tried applying this to my code but i get these markers on public static double Settings.MinSimilarity = 0.9; //raiman public static float Settings.MoveMouseDelay = 0f; //raiman Multiple markers at this line - Duplicate field TestAuto.Settings - Syntax error on token ".", , and for wait(0.2f); //raiman i get: The method wait(long) in the type Object is not applicable for the arguments (float) Am I doing something wrong here? these are the only things i changed. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Yes, that is what I meant, I only need the "List" function when I expect the images(objects) to be created in the process of execution, but since I have all pictures already ill go without that feature. Thanks a lot! This thread has given me a good start with your help and clarifications :) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: why do I need findBestList instead of findBest? Im not fully getting the difference even though I looked up both functions in the docs. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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'll think about visiting the javadoc next time! I see so in my case I dont really need to use findAnyList correct? since I have the images as files already I dont need to create patterns? How about findBest, would that not suit my needs better here since it would only return one number, or is it slower? Hmm if findAny is faster at 5+ pictures and I have 10 pictures then I suppose I wont use it, especially if it cant be done in java :) thank you for the example though! -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: sorry foe dp but i have another question regarding findAny. What exactly is the difference between findAny and findAnyList? -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Why could it return null? It will always find a number there. a live look? i can post a screenshot of the screen i will be running the script on if that helps. yes it is a w digit number and yes i will have two regions. would it be possible to use .exists() ? like this in python: def get_digits_in_region(region): foundNumbers = [] for match in numbers: if region.exists(number[1], 0.001): found_numbers.append(number_pattern[0]) return found_numbers not sure what the def does here i suppose it would not be needed in java due to syntax differences. but if exists could be used then it would run faster i guess? -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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: Ah that explains my struggles so far.. I thought I was just a very slow learner but apparently I chose a tough entry :) Thank you for the clarifications! with the help of a friend I was able to get to this stage: import java.util.ArrayList; import java.util.List; import org.sikuli.basics.Debug; import org.sikuli.script.*; public class Script { public static void main(String[] args) throws FindFailed { // Debug.setDebugLevel(3); Screen s = new Screen(); // Declare region Region totalRollArea = new Region(20, 20, 100, 50); List imageList = new ArrayList(); imageList.add("number1.png"); imageList.add("number2.png"); List numbers = totalRollArea.findAnyList(imageList); int indexValue = 0; for (Match match : numbers) { indexValue = match.getIndex(); if (indexValue >= 1) { System.out.println("true"); This code works to find images "number1.png" and "number2.png" and print "true". For test I took windows icon and folder icon as number1 and number2 and used screen instead of region which of course led to long execution time. The purpose of my script is to automate the abilities section of DnD based games like Icewind Dale (in my case) or Baldurs Gate. The game will roll a value which I want to compare to an internally set value (roll value should be >= 86). This roll value is composed of two numbers (ten digits and one digits) which I want to get from screen and then if value isnt sufficient press the "reroll" button and start the for loop again. Now the question: Do you think this part of the script can be executed quick enough to use lets say not more than 0.2 seconds to determine if the roll value goal is met (the area to check will be defined by a very small region so the actual find area will be only about 200 pixels)? And do you see any room for improvement or more simplicity or better readability? I hope I phrased this in a way that it makes sense. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [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 Status: Answered => Solved Alexander Schone confirmed that the question is solved: Thanks RaiMan, that solved my question. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #666773]: findAnyList() in Java
New question #666773 on Sikuli: https://answers.launchpad.net/sikuli/+question/666773 Hello, I am new to coding in general and currently learning Java. I have a little project where which I'm using to learn and came across this piece of python code in one of the question here. I want to transfer this to java, I have tried finding code examples online but all I can find is very complex example far beyond my learning level or python examples. Furthermore the sikuli documentation I could find seems to be written for people who already know how to code. r = regionOfTheScreen r.setAutoWaitTimeout(0) images = [p0.png, p1.png, p2.png, etc] while True: matches = a.findAnyList(images) for match in matches: click("r"+str(match.getIndex())+".png") I want to do the same in Java but I am stuck. So far I have: Region totalRollArea = new Region(20, 20, 100, 50); Match number1 = new Match("number1.png"); Match number2 = new Match("number2.png"); Match[] numbers = {number1, number2}; totalRollArea.findAnyList("number1.png", "numbers.png");// This part im quite certain of for (int i = 1; :i++) { if (totalRollArea.exist(numbers [1]));// ??? } return indexValue; I am unsure about how to use the array (do I need it? the documentation for sikuli 1.1x+ doesnt mention it) and how to iterate over it using the List/Array. Any help would be greatly appreciated as it helps me a lot in learning the language. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp