diegopablo Posted August 3, 2013 Posted August 3, 2013 (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. expandcollapse popup 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 August 4, 2013 by Melba23 Added code tags
Edano Posted August 4, 2013 Posted August 4, 2013 what game do you want to bot ? [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
FireFox Posted August 4, 2013 Posted August 4, 2013 what game do you want to bot ?No matter what the game is, the rules say "regardless of the game".
Moderators Melba23 Posted August 4, 2013 Moderators Posted August 4, 2013 diegopablo,Is this, as it appears to be, for a game? M23 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
diegopablo Posted August 5, 2013 Author Posted August 5, 2013 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.
JohnOne Posted August 5, 2013 Posted August 5, 2013 "I can not make it work" is not much to go on. What does not work? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted August 5, 2013 Moderators Posted August 5, 2013 diegopablo,As you have admitted in a reported PM that this is for a game, you can guess what happens next... 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. M23 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
Recommended Posts