dice4321 / Gunkolle

This script was originally meant to execute kancolle expeditions but was repurpose for girls frontline (by Ryuuhou https://github.com/Ryuuhou/AHKanColle)
Other
16 stars 14 forks source link

Wait non combat nodes while executing Plan #68

Open fnzr opened 5 years ago

fnzr commented 5 years ago

I'm finally starting to implement the dragging feature mentioned in #57, and since we'll have a boss hunt event soon, if we get this working it'll be very handy. I'm currently working on 1-6 and facing problems right off the bat. So far, the nodes of all maps were deterministic, and there was at least one combat in every turn. For example, in the first turn of 0-2, you always have 3 combat encounters, and in the second you have 2, so you'd simply call nodes(3) and nodes(2), respectively. This doesn't work on 1-6. Because there's enemy movement, we don't know how many enemy encounters we'll have in a turn. Sometimes we don't have an encounter at all. So I'm trying to think of a good strategy to deal with this. The best thing I came up with is waiting a fixed amount of time, say 30 seconds, and then check until we find the double zeros action points, meaning the all movements were executed, although there's some edge cases. This doesn't sounds like a good strategy though. Can you think of a good way to deal with these "non-deterministic" turns? The first steps of the work are at my fork, mouse_dragging branch.

fnzr commented 5 years ago

Oh I had an idea, we can check the turn number. The turn number only updates after SF turn is over, so we wait the number to update then wait a couple seconds for the animation of turn start to be over, so while the turn number doesn't update, we do ClickS(Safex,Safey) to skip any battle, it there is one. I think this is a good direction, but I still have to wrap my head around these new functions, ClickTilGone and NoStopFindClick. I keep missing node clicks and I'm not sure why.

dice4321 commented 5 years ago

Those sound like solid strategies! I'll have to implement a new wait for the enemy turn after the 'endturn' image! As for ClickTilGone, what I find is, if the game doesnt update as soon as you click image, theres a problem (I'd have to up like a 1000ms sleep in between each check in the ClickTilGone function, but I want the node select to be as fast as possible to I opted not to do that) , so I reverted back to the old method for the time being, this function is still useful for anything menu related tho, for instance I swapped the pixel check in the doll switcher with this function! Check out the staging branch for all the updates, I re-did most of the retirement system and got the script running as stable as possible. I'm still holding off on merging to the master til I get the enhancement part finished!

dice4321 commented 5 years ago

I misread you first point sorry, I thought you meant turns, but you meant action points! I haven't tested it yet, but this could be a problem as the background near the action point is semi transparent, but this does seem like our best solution. This seems trickery than I first thought, if turns over go over more than two, they may be able to change the color of the node making this an asset nightmare. I believe the best best solution would be to click each node using coordinates, the clickS() function, for the nodes then as you said, wait for the action points to hit zero. Also, I'll be away for 2 weeks so, this will be on the top of my prioties when I get back!

fnzr commented 5 years ago

I did meant Turns in my second post, as in the number on the top of the screen. The circle surrounding it has flat color, so it's fine. I actually have 1-6 and 2-6 almost done, and as far as managing turn starts and turn ends, it's pretty much working. My biggest problem right now (I think, not sure) is grabbing the right asset after dragging the mouse, it's tricky to get it right, and also moving enemies might or might not be on top of the node, it gets really unreliable. I was avoiding relying directly on ClickS, but I think it's our best bet, at least on these more complex maps that have a lot of dynamic elements

dice4321 commented 5 years ago

Perhaps you can use an anchor position to know when the script has finish scrolling. If you ever useClickS, heres a tool that was left by Ryuuhou https://gist.github.com/dice4321/26ecf9f38d67b4dbf8a5a51804b45852

First you have to wait for the home screen to get the anchor pixel, then use left-alt to get the coordinates.