Jump to content

Select screen arrows


Recommended Posts

Hi the issue is this, I'm looking to make autoit read arrows that appear on the screen, the type UP, DOWN, RIGHT, LEFT.

 

What I seek is that AutoIt3 detect and send the order to press those keys in order to complete the task.

 

What I did was something like this but I can not make it work.

 

 For $i = 3 To 7
 Local $moves = get_moves($i)
 
 While Not(PixelGetColor(501,498) == 0x00FF00)
Sleep(20)
 WEnd
 Sleep(50)
 
 For $j = 0 To ($i-1)
Switch($moves[$j])
Case "left"
ConsoleWrite("sending a" & @CRLF)
Send("a")
Case "right"
ConsoleWrite("sending d" & @CRLF)
Send("d")
Case "up"
ConsoleWrite("sending w" & @CRLF)
Send("w")
Case "down"
ConsoleWrite("sending s" & @CRLF)
Send("s")
 EndSwitch
 Sleep(50)
   Next
   Sleep (1200)
Next
While Not(PixelGetColor(22, 72) == 0xFAFBA3)
   Sleep(100)
   WEnd
   MouseClick("left", 738, 596, 1, 10)
   Sleep(300)
   MouseClick("left", 288, 488, 1, 10)
   Sleep(300)
   MouseClick("left", 741, 592, 1, 10)
   Sleep(300)
   MouseClick("left", 521, 594, 1, 10)
   Sleep(500)
   While Not(PixelGetColor(28, 57) == 0xFD2851)
 Sleep(20)
 WEnd
   WEnd
 
Func get_moves($num)
 
 Local $moves($num)
 
 For $i = 0 To ($num-1)
 
Local $left = 0, $right = 0, $up =0, $downn = 0
 
While 1
PixelSearch($start_x+64-12, $start_y+32, $start_x+64-12, $start_y+32,0x282806, 20, 1, $wiz_han)
If Not (@error) Then
  ; left or right
  $left = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xE0D75E, 40, 1, $wiz_han)
  If @error Then
 Dim $right[2] = (0, 0)
  EndIf
  ExitLoop
EndIf
PixelSearch($start_x+32, $start_y+64-12, $start_x+32, $start_y+64-12, 0x282806, 20, 1, $wiz_han)
If Not(@error) Then
  ; up or down
  $up = PixelSearch($start_x+26, $start_y+23, $start_x+26, $start_y+23, 0xFFED27, 40, 1, $wiz_han)
  If @error Then
 Dim $down[2]  (0, 0)
  EndIf
  ExitLoop
EndIf
WEnd
If IsArray($left) Then
$moves($i) = "left"
ElseIf IsArray($right) Then
$moves($i) = "right"
ElseIf IsArray($up) Then
$moves($i) = "up"
ElseIf IsArray($down) Then
$moves($i) = "down"
EndIf
ConsoleWrite($moves[$i] & @CRLF)
Sleep (350)
 Next
 Return $moves
   EndFunc
 
Func _Exit()
   Exit
EndFunc
Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

diegopablo,

Is this, as it appears to be, for a game? :huh:

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

  • Moderators

diegopablo,

As you have admitted in a reported PM that this is for a game, you can guess what happens next... :whistle:

Please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. 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...