Sign in to follow this  
Followers 0
diegopablo

Select screen arrows

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



what game do you want to bot ?


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

what game do you want to bot ?

No matter what the game is, the rules say "regardless of the game".

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

diegopablo,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Never said it was a game, what I want is that the AutoIt3 interpret the UP, DOWN, RIGHT, LEFT that appear on the screen, I mean getting to see and send the keys. So avoid having to be present in the PC.

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0