Moving with Directional Keys to a color.

Ask gaming related questions (AHK v1.1 and older)
Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Moving with Directional Keys to a color.

Post by Arceusone » 27 Jul 2021, 19:19

I'm looking for help on how to move to a specific color with the directional keys. Nodes spawn randomly in a specific area but their color remains the same. I'm looking to automate the gathering process by moving in a specific route until approaching one of the gathering areas. I then need the script to check for said color and if its there I need it to input the directional keys needed to approach it before gathering. I know how to utilize color tracking for mouse movement but I've never done it like this before.

Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Re: Moving with Directional Keys to a color.

Post by Arceusone » 29 Jul 2021, 04:55

Safe to say impossible?

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Moving with Directional Keys to a color.

Post by swagfag » 29 Jul 2021, 07:29

unlikely. ur post simply lacks enough information for anyone to bother engaging with it. explain it as though we had no idea what u were talking about(because we dont actually)

Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Re: Moving with Directional Keys to a color.

Post by Arceusone » 29 Jul 2021, 13:16

K so 1 directional input= 1 space. I need to move to a specific colors space. The color pops up randomly so just doing a automatic route won't work. I need the script to upon noticing the color to then use the directional keys(Inputs) to move toward said color and then press "f". Trying to have the script figure out the path to the color with the directional keys.

XXXXXXXXXX
XXXXYXXXXX<----------I need it to spot Y and then move towards Y with the directional keys since Y appears at random in a specific area.
XXXXXXXXXX
XXXXXXXXXX

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Moving with Directional Keys to a color.

Post by swagfag » 29 Jul 2021, 13:38

clear as mud. maybe post some screenshots or a video explaining it

Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Re: Moving with Directional Keys to a color.

Post by Arceusone » 04 Aug 2021, 23:59

K so. I want to utilize detect color for the exact color on the ore. I want it to use that part of the screen location wise and then a pre-set space size (32x32 pixels.) accounted for as distance(Space). I then need it to determine a path using that definition of said space and execute said path with the directional keys(Up/Down/Right/Left) and then press F when it reaches the color(Ore.). I want it turned into a homing missile so to speak. I also need this done with ControlSend(If not possible due to not being compatible with detect color send is fine.) . I'm trying to auto gather in a 2D game while playing on my other account.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Moving with Directional Keys to a color.

Post by swagfag » 06 Aug 2021, 10:34

ok so u got a 2D grid, whose dimensions and location on screen u know. the grid can be represented as a 2D array of array, each element of which is tile on the grid. u know how to Image/PixelSearch for ur ore, so u know its location and dimensions(ie those of a single tile). so, u can map the ore to an element in the 2D array.
presumably u also have a way of finding out the location of ur character(or its always in the center), so u can map that too to an element in the 2D array.
assuming no obstacles on the grid, a naive approach is calculating the rise and run of 2 points. otherwise, look into A* or some other pathfinding algorithm

Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Re: Moving with Directional Keys to a color.

Post by Arceusone » 06 Aug 2021, 18:28

swagfag wrote:
06 Aug 2021, 10:34
ok so u got a 2D grid, whose dimensions and location on screen u know. the grid can be represented as a 2D array of array, each element of which is tile on the grid. u know how to Image/PixelSearch for ur ore, so u know its location and dimensions(ie those of a single tile). so, u can map the ore to an element in the 2D array.
presumably u also have a way of finding out the location of ur character(or its always in the center), so u can map that too to an element in the 2D array.
assuming no obstacles on the grid, a naive approach is calculating the rise and run of 2 points. otherwise, look into A* or some other pathfinding algorithm
Could I use imagesearch to bypass any obstacles?

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Moving with Directional Keys to a color.

Post by swagfag » 07 Aug 2021, 02:52

what are u asking?

imgsearch tells u(if found) the screen coordinates of a pattern of pixels(ie the image). what u then do with that information is up to u. so, maybe??

Arceusone
Posts: 7
Joined: 27 Jul 2021, 19:14

Re: Moving with Directional Keys to a color.

Post by Arceusone » 07 Aug 2021, 04:27

I mean like taking an image of say a tree so that when said image is found it would adjust the algorithm to set it as a obstacle to factor in.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Moving with Directional Keys to a color.

Post by swagfag » 07 Aug 2021, 13:13

  • detect any relevant entities(player, ore, obstacles) using whatever method works(pixelsearch, imagesearch, something else)
  • encode their positions and properties in the array
  • run A* on it
  • decode the resulting shortest path back into a series of keystrokes. send them

Post Reply

Return to “Gaming Help (v1)”