iTzSublime 0 Posted June 4, 2022 Share Posted June 4, 2022 (edited) So, as you would probably note from my code and such, I'm new to AutoIt coding, so there is probably a better way to code it, or a simple solution that I'm not seeing, so I'm trying to get better at it, and I appologize in advance. I made an example of what I'm trying to do, with my code and an image to better exemplify what I'm trying to achieve I have a character that is performing an action (example here is the stickman attacking those green things) Everytime he is engaged in that action, he moves to where the green enemy is. So I'm trying to make a script that keeps engaged in the action while the enemy is in front of him, and keeps on repeating this action of searching and clicking on them, while there are still green enemies to his left and right. Simply, that is what I'm trying to achieve: 1. Searchs if the green enemy is in front of him -if it is, stay in the same position, untill it's not there anymore -if it's not, search for the green enemy to it's right and left, and click on it For the sake of searching if it is in front of him and staying in there untill it disappears, I made a "MouseMove" that I thought was going to keep the mouse on top of this green enemy, while it was there. But it only moves over it once or twice, and then it clicks on the green enemies that are from it's left/right, even if the green enemy that is in front of him has not been killed, and that is not what I'm trying to achieve. I know it is clicking away because the MouseClick function that is being triggered later in the other part the of the code, but I can't think of a way to not trigger it, while the green is still in front of the stickman. So, here's the code I have and the image to ilustrate it better: expandcollapse popup#include <AutoItConstants.au3> HotKeySet("{esc}", "quit") While(1) for $count = 1 to 20 ;search for the green color on the central piece - under the stickman $pixels1 = PixelSearch(390, 310, 430, 353, 0x31ff31, 1) if NOT(@error) Then MouseMove($pixels1[0], $pixels1[1]) sleep (350) EndIf ;search for the green color to the left of the stickman $pixels2 = PixelSearch(120, 310, 375, 353, 0x31ff31, 1) if NOT(@error) Then MouseClick($MOUSE_CLICK_LEFT, $pixels2[0], $pixels2[1]) sleep (1* 2500) EndIf ;search for the green color to the right of the stickman $pixels3 = PixelSearch(445, 310, 698, 353, 0x31ff31, 1) if NOT(@error) Then MouseClick($MOUSE_CLICK_LEFT, $pixels3[0], $pixels3[1]) sleep (1* 3500) EndIf Next WEnd Func quit() Exit EndFunc ;==>quit If anyone could help me here, I would be very thankful! Edited June 4, 2022 by iTzSublime Link to post Share on other sites
Moderators Melba23 3,799 Posted June 4, 2022 Moderators Share Posted June 4, 2022 Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to post Share on other sites
Recommended Posts