arcygarcy / doodleTrainer

toontown doodle trainer
0 stars 1 forks source link

Time feature doesn't work, and events such as Halloween prevent this tool from working entirely #2

Closed mchendrickson closed 1 year ago

mchendrickson commented 1 year ago

If an event occurs, the Doodles tab can be on row 5 or 6, which prevents this from working in its entirety. Also, the program does not close after the time specified elapses.

I'd be happy to fix these for you if you'd upload your source code.

arcygarcy commented 1 year ago

Sorry, I no longer have the source code for this. I think I will have some time in the coming days, and I can try and get a new version going.

arcygarcy commented 1 year ago

The new version is posted, feel free to check it out. Hopefully, these issues will be resolved. If you can do some testing that would be great!

mchendrickson commented 1 year ago

Sure thing

mchendrickson commented 1 year ago

So, a few things right off the bat. If you want to have a downloadable version, GitHub has a specific sidebar for "releases" that you can use. You might want to remove "Old" and "Zip" and put them as release versions 1 and 2 respectively. The actual code (uncompiled) ought to be just your doodleTrainer.py script, which you can give instructions for compiling. I haven't tested any of your code so far, but considering you're using cv2 to find the tricks, why not just use cv2 and remove the whole "row number" feature entirely?

Another thing I noticed is that you have

win = pygetwindow.getWindowsWithTitle('Toontown Rewritten')[0]

While this works, it means Corporate Clash and other games won't work with your code.

Another thing I would add is an "escape" key that you can use to stop/crash the program.

I'll respond again when I test everything

arcygarcy commented 1 year ago

Thanks for your help with this, I will work on it some more today and address what you mentioned.

GitHub has a specific sidebar for "releases" that you can use.

I will try and get that setup today.

The actual code (uncompiled) ought to be just your doodleTrainer.py script, which you can give instructions for compiling

This makes sense, I will make that change and update the README

cv2 to find the tricks, why not just use cv2 and remove the whole "row number" feature entirely

The main reason for this is that personally and for most people I play with we only use Jump, Beg, or Speak so we don't max a doodle completely which saves a ton of time. Additionally, some tricks take longer to train than others, so you may want to avoid training them if they are already maxed. I will add an option for all tricks.

Corporate Clash and other games won't work with your code

I do not play Corporate Clash, so I am not sure if this would work there, if you want to help develop that side of this, then that would be great.

Another thing I would add is an "escape" key that you can use to stop/crash the program

This is already in there as the "Esc" key, however I did want to change it to be more responsive.

mchendrickson commented 1 year ago

Ah, I'm stupid, sorry I should've looked more in depth. I'm working on a refactor of some of your script. I like most of it so far, it just needs to be a bit more readable.

mchendrickson commented 1 year ago

So, basically, the image recognition only works for the initial speedchat symbol, it does not work for any of the text. I think you can make this work by only using the speedchat symbol to find the coordinates, then just manually entering in X and Y offsets. I'll upload another PR sometime soon

arcygarcy commented 1 year ago

i see. maybe try to mess with the threshold value in the getCoordinates function, make it smaller and you might have better luck with that.

mchendrickson commented 1 year ago

Take a look at my PR, let me know what you think. Another thing to note is that I think the speedchat tricks are differently ordered based on when you purchased them. It might be better off to just have numbers, and not the trick names since they might mislead people to train the wrong trick.

arcygarcy commented 1 year ago

So a couple of things, first, while the offset method does work, that is what I was originally using and it always seemed to be a problem around event times which is why I went with the cv2 option. The row offsets are a decent solution for trick selection, but it makes the interface less intuitive. I like the current solution being able to know what tricks there are.

Have you attempted to change the threshold value in the getCoordinates function? I think making it smaller could fix your issue, try .80

mchendrickson commented 1 year ago

I was able to verify that the rows work up to 6 for the offset method. The CV2 method didn't work at all for me, no matter the threshold. I even grayscaled the images to get a good match, no dice.

I would try reading text using pytesseract or some other library instead of image recognition if that's the method you want to try.

Another idea is to combine both methods. You know that the offsets are going to give you a good ballpark estimate so you can use these to create your bounding boxes instead of using the entire screen.

arcygarcy commented 1 year ago

im working with easyocr right now i think i am getting somewhere ill try and have something tomorrow

arcygarcy commented 1 year ago

I tried to do some ocr stuff here give it a shot and let me know what you think. It worked for both a toon with all tricks and one with only just and speak

mchendrickson commented 1 year ago

This looks really interesting, I'll give it a look, probably tomorrow. Looks like you took all the good stuff from my PR as well, excellent. Just an FYI, corporate clash doesn't have doodles right now (I learned that about an hour ago) but keep the code because they're eventually going to add them back in. The Corporate Clash speedchat button is also different from the original, so you'll need to add that in as another if statement somewhere. e9c31c742c19e56d08c0fae4695d6f82

mchendrickson commented 1 year ago

Hey, just reviewed the OCR version, it works perfectly! Excellent job. I suggest you merge that one to main and call it a day.