Jump to content

Help with a simple pixelsearch script


Recommended Posts

Hello, I've spent a lot of time this week (over 20 hours) trying to perfect a script that I need but with no real success. I've mostly used macro software that are user friendly but they aren't very efficient. I almost succeeded with one software but it caused problems with my mouse, the script wouldn't perform the actions I needed fast enough so it would move my mouse and cause problems.

 

About the script: 

 

- There are 27 objects placed in horizontal lines, in total 3 rows with 9 objects in each row. They are equidistant from one another so it would look like this:

 

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

 

Each number is a bar with 2 colors like a percentage, when the percentage is 100% the bar is fully green and when it's 1% it's almost completely red, when it's 100% red the object disappears in this manner:

 

1 2 3 4 5 6 7 8 9

1 2 3 4 6 7 8 9 1

2 3 4 5 6 7 8 9

 

In this case the 5th object in the second row became completely red and disappeared, the remaining objects moved up 1 spot and there are now 28 objects. The goal of my script is to pixel search the red color at 29 different spots for the 29 objects at a specific coordinate of when the bar is 70% red, if the bar is 70% red then it will detect a red pixel instead of a green one at that coordinate: YraOt0q.png

When it detects a red pixel, it will select the object by left clicking at the red pixel and then press delete to remove the object. Once this process is done, I will manually reselect the 28 objects with an addtional new 29th object with a box using my mouse, this last part will be manual, but if the first part that is scripted isn't instantanous so it nterferes with my mouse and I'm not able to reselect 29 objects with the newly added one. The bars will become red quickly, maybe 3-4 red pixels per second, so I have to be able to reselect 29 objects and enable the script to delete 1 object as fast as possible to be able to repeat this 3 times in a second.

 

This is what my original script in that software looked like:

scAPxbB.png

xXTp31M.png

8vSjndt.png

 

Again, this script works, but it moves my mouse so I'm not able to reselect stuff quickly enough (I see my mouse moving on the screen and the final mouse location is different every time). When I press F1 the script should turn on, and constantly check for red pixels at those 29 locations, if one is found it will select it by clicking there and pressing delete. If another red pixel appears at the 29 spots a minute later it will do it again automatically without me pressing hotkeys. To disable the script I will repress F1,

Edited by Melba23
Added spoiler
Link to comment
Share on other sites

As I saw that script you have positions of those 27 objects. and when color is FF0000 it click on it then press "delete" key.

You can create 2 arrays Xpos and Ypos which will contain all x and y positions.

Then a for loop which will click and send delete key at Xpos and Ypos

This will make things looks more simple. Not so much unnecessary code.

For clicking use "ControlClick" and for keys use "ControlSend" - This if you use autoit.

Is not so hard , but I will wait because it seems your script is a bot and this is against the rules:

http://www.autoitscript.com/forum/index.php?app=forums&module=extras&section=boardrules

If will be accepted then I can help you with that. Not so hard!

Edited by DocTorCoder

DocTorCoder

Link to comment
Share on other sites

Hi CheatingScumbag, welcome to the forums! Just wanted to ask what application you're trying to automate?

I can see you were previously using Macro Recorder to write your script, but what is the actual target application you're automating?

Edited by mpower
Link to comment
Share on other sites

It's to create skins for a game, not actually play the game. Basically, I want to change the appearance of units (their model) in the game depending on their health, so if a unit is wounded he will look different then when he's not wounded, but since there is a lot of units and the task is very repetitive I'm trying to automate it. Each unit has 29 angles or sides, like his back, left, right etc so you can see his model at different angles, I must delete all the 29 angles of a unit at x% health (red pixel at x,y location) and replace it with a new model that me or someone else designed in Photoshop or wherever, this new design will look different, have better texture, or show blood indicating that the unit is wounded etc. It doesn't affect game play as it's not part of the game, it's part of map editor implanted in the game allowing people to create map and change appearance of stuff inside the game to keep it interesting and then host the map with said changes for other players to try it and play it. It's actually a a 15 year old+ game and that's the only reason people still play it because some people are constantly improving the appearance of stuff and creating new maps keeping the game fresh and interesting but it's a lot of work to do so atm.

Edited by CheatingScumbag
Link to comment
Share on other sites

  • Moderators

CheatingScumbag,

 

I want to change the appearance of units (their model) in the game depending on their health

That falls into the "game interaction" category and so is not a subject we are prepared to discuss here - thread locked. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...