Auto farming lords mobile

Ask gaming related questions (AHK v1.1 and older)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Auto farming lords mobile

13 Apr 2018, 16:56

I'm trying to write a script that will allow me to auto farm Lord's Mobile. I'm using Pulovers macro recorder but it's limited I can collect only one resource by using image screenshot, the problem is there are 2 piles of rocks around the area as you can see in the picture. The program only goes to one of the piles of rocks using image grab macro recorder. So I've been working night and day to make it grab more than one resource, but at last, I'm a noob and don't understand.

:headwall:

Thoughts
Attachments
Scrpit.png
My try lol
Scrpit.png (29.84 KiB) Viewed 17792 times
Farmer 1 ss.png
Window view
Farmer 1 ss.png (785.86 KiB) Viewed 17792 times
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

13 Apr 2018, 16:58

Did I say thank you
Thank You, Wiz :)
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Auto farming lords mobile

14 Apr 2018, 01:43

try using smaller sections of the screen..i would use alt printscreen then paste that into paint to get the smallest image unique to each resource..cutting out any background should make each resource findable multiple times..rather than the specific resource you got a background tree in..if that doesnt work...id start looking for the colored numbered flags ...might work but i dont know the game so those could be common and clicking them could be bad.
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

14 Apr 2018, 09:13

I understand thank you for helping meNeverlevel, I think what your saying is look for a common pixel, for example, the rock color so no matter where I am on the map the pixel for the rock is the same. Is there a way to have it look randomly for just rock for now until I get better at coding?

For example, if the rock is here and another one is east of the same rock look for more rocks.

Thanks again for all your help. :+1:
Thank You, Wiz :)
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Auto farming lords mobile

14 Apr 2018, 12:14

Wiz wrote:I understand thank you for helping meNeverlevel, I think what your saying is look for a common pixel, for example, the rock color so no matter where I am on the map the pixel for the rock is the same. Is there a way to have it look randomly for just rock for now until I get better at coding?

For example, if the rock is here and another one is east of the same rock look for more rocks.

Thanks again for all your help. :+1:
Hey bud,

There's a couple of approaches. The most convenient approach would probably be using a function that supports multiple image findings, unfortunately this isn't supported by AutoHotkey's imagesearch command.

Here are some suggestions though:

But first, do your backgrounds change? By which I mean do the trees stay in place all the time? If yes then this can be a clever way to distringuish between the two rocks.
So I mean you should use two different Imagesearches for two different images, like @neverlevel suggested. And with these results you can choose when to click either of them at any time.

Also, may I ask what emulator that is? Just out of curiosity. :)

So take a screenshot of both the rocks. And make sure a part of the background is included. Make sure the two images are variably different.

Another way is to either change the search boundaries to make one imagesearch search the right half and the other for the left half. Since there is only two halves, it should not interfere.

Unless both rocks are outside then none of the methods I suggested will work, you will have to make a separate part of the script to move the screen around trying to find the perfect position.

Lastly you can use the found position of the image to make the boundaries of the second imagesearch a variable depending on the outcome of the first search. We won't deal with this unless really necessary.

Tell me how it goes. Cheers! :D
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

14 Apr 2018, 13:45

You guys are geniuses 1. I googled the color pixel I was looking for input RGB and no matter where I am on the map it clicks that color of the rock. OMG, I cannot thank you guys enough.
2. splitting the screen is beyond my understanding I'm very happy gathering rocks in the window I'm working in..Did I say OMG OMG it works?
3. I found out the color varies slightly from one to the other no biggie ill play around see how it goes.
4. OMG now if I could just get the mouse to move around I'd make gold...lol

:dance: :dance: :dance: :dance: :dance:

5. Is there a way to say thank you guys for responding to the post?
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

14 Apr 2018, 13:48

It's the Nox emulator, but I cant import scripts into it so I'm looking around for another.

Nwb.
Your right ill have to find a way to move the screen around.
Thank You, Wiz :)
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Auto farming lords mobile

14 Apr 2018, 15:08

you could search like

Code: Select all

ImageSearch, FoundX, FoundY, 0, 0, 500, A_ScreenHeight, myfile.jpg
;this searches the first 500 pixels to the left of the screen
;then do..
ImageSearch, FoundX, FoundY,500, 0, A_ScreenWidth, A_ScreenHeight, myfile.jpg
;this searches the pixels right of the 500 mark
; your resolution may differ and the 500 may be way off center..
if you are still using imagesearch..

Mousemove work with your program or no?
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

14 Apr 2018, 17:03

It has Mousegetpos, I'm now using pixel color for all my searches you are amazing, I think ill play around with colors and changing variables today.
Also looks like I have to find another program Pulovers keeps crashing on me and my scripts get deleted.
Insert sad face...with swear words lol

:headwall:
I'll get back to you, thanks neverlevel
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

17 Apr 2018, 11:41

What I've learned: Overview

1. First and foremost trust the people on the forum they have years of experience some more than others. For example, Nwb and neverlevel took their time to help me work through some issues and I am grateful to both of them.
2. I made a lot of mistakes but mistakes are part of learning.
3. After extensive testing I have come to the conclusion that looking for a common pixel color by using RGB is great, but looking for the same color in the window will throw an error because there are 4 piles of rocks with the same RGB color so my guess is that the program gets confused on which one to choose.
4. After testing and reviewing the information that was provided by experts, I divided the window into 4 quarters and now the program looks to the top left quarter of the screen for a pile of rocks using RGB pixel find then it sends the troops that are required to gather the rock resource that it found. And the program continues to look for this RGB color in the 3 remaining quarters of the open window. I have 3 additional resources that I can gather and I have found a common RGB pixel associated with the additional 3 resources and I will continue testing my script and fine-tuning it so that I'm able to gather resources 24 7.
5. To others out there thinking about writing scripts for gaming I would suggest reading a beginners guide, and looking for resources on YouTube for these two bits of information have saved me a lot of time and frustration.
6. You can do it using people who have more knowledge than you, reading beginner guides, and looking to Youtube for answers.
7. I am grateful for Nwb and neverlevel for taking their time and knowledge to help me become more familiar with writing code.
Last edited by Wiz on 17 Apr 2018, 11:50, edited 1 time in total.
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

17 Apr 2018, 11:46

gathering.png
Fun times gathering 24/7 credit goes to Nwb and neverlevel without their help I don't think this would be possible.
gathering.png (532.01 KiB) Viewed 21161 times
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

17 Apr 2018, 11:53

neverlevel wrote:you could search like

Code: Select all

ImageSearch, FoundX, FoundY, 0, 0, 500, A_ScreenHeight, myfile.jpg
;this searches the first 500 pixels to the left of the screen
;then do..
ImageSearch, FoundX, FoundY,500, 0, A_ScreenWidth, A_ScreenHeight, myfile.jpg
;this searches the pixels right of the 500 mark
; your resolution may differ and the 500 may be way off center..
if you are still using imagesearch..

Mousemove work with your program or no?
Works just need to learn more before testing thank you
Thank You, Wiz :)
User avatar
Wiz
Posts: 10
Joined: 13 Apr 2018, 13:23

Re: Auto farming lords mobile

17 Apr 2018, 11:55

neverlevel wrote:try using smaller sections of the screen..i would use alt printscreen then paste that into paint to get the smallest image unique to each resource..cutting out any background should make each resource findable multiple times..rather than the specific resource you got a background tree in..if that doesnt work...id start looking for the colored numbered flags ...might work but i dont know the game so those could be common and clicking them could be bad.


Now I really understand what your saying I was looking for common flags, not uncommon...lol might go back to image search.
Thank You, Wiz :)
ThatGuy

Re: Auto farming lords mobile

01 Jun 2018, 14:54

Any chance you could post the finished product? Would help me out loads!
Vlad Tepes

Re: Auto farming lords mobile

28 Jul 2018, 09:34

Hey Wiz, can you please share with us the full scrypt please?
vrpanch
Posts: 4
Joined: 01 Sep 2018, 12:15

Re: Auto farming lords mobile

02 Sep 2018, 07:44

I am trying to do the same thing that you did for auto farming in lords mobile. I noticed that shade of the rss changes when its not at the center of the game screen and the image search is not picking it up properly. I have been trying to figure out the pixel thing that you mentioned in your thread that worked for you. Can you give me some pointers in how to found the right pixel for the rss. I also looked into splitting the screen into quadrants but the shading is still an issue and the image search is not picking up the RSS.

You also talked about uncommon flags, what where you referring to. Was it a common pixel between all the RSS? or between all the shades of one RSS?

I would like a copy of your script but you may not be willing to share it, so I wanted to ask you the questions that would help me figure this out.
scriptors
Posts: 227
Joined: 25 Feb 2016, 09:01

Re: Auto farming lords mobile

03 Sep 2018, 04:07

Wiz Last active:21 Apr 2018, 06:36 ... so it's difficult to respond here
nymus93

Re: Auto farming lords mobile

09 Oct 2018, 17:07

I have been dealing with this for a while too, i'm a totally newbie. And i have faced the shade problem as well, i thought there was a problem with the setting up the macro/image etc but it turned out that shade does change according to its position on the screen, as a result the macro recognizes the image/pixel if its in a static position of the screen.

As i said im just a beginner but it seems splitting the screen does the trick to some extent.

What i'm wondering is whether the image search can be adjusted with a margin of error. I know there are ways to sneak around this problem, still wondering if its possible to provide a total solution (however long and difficult but achievable) which will say look for the certain image or the closer one, similar to the way google image search works.
PiumUrAd
Posts: 2
Joined: 17 Dec 2018, 01:00

Re: Auto farming lords mobile

17 Dec 2018, 01:03

So no one has a complete script, this guy just creates an account to ask a question but doesn't want to show how he fixed the shading problem.
PiumUrAd
Posts: 2
Joined: 17 Dec 2018, 01:00

Re: Auto farming lords mobile

17 Dec 2018, 01:03

Vlad Tepes wrote:
28 Jul 2018, 09:34
Hey Wiz, can you please share with us the full scrypt please?
Did you ever find anything?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Pianist and 38 guests