Jump to content

Recommended Posts

Posted

Hello guys, I'm making a simple testing bot. But there is a problem with my script. Everthing works fine, just pixelsearch does nothing.

There is a color bar, which fills up with specific color. I wanted, to search for that color at specific point. That bot would know, when to enter the command, if there's not such color, than search for it again, until it found's it. After detecting, color write specific command's. But it seems that it cant detect the color, or my script is bad. Mby someone, could bring me to the right point? And give me some info, what im doing wrong?

here's my script.

Thanks !

 

mu.au3

Posted

#RequireAdmin
#include <Misc.au3>
HotKeySet("{UP}","StartBot")
HotKeySet("{DOWN}","StopBot")
Global $isRunning = False
Func Bot()
    While $isRunning
; 0. Activates game window.
WinActivate("main.exe")
Sleep(500)
; 1. Click's ENTER
Send("{ENTER}")
Sleep(3000) 
; 2. sets str to : /str 300 
Send("/str 300") 
Sleep(2000)
; 3. Enter
Send("{ENTER}")
Sleep(2000)
; 4.  /agi 32749
Send("{ENTER}")
Sleep(1000)
Send("/agi 32749")
Sleep(2000) 
; 5.  Enter
Send("{ENTER}")
Sleep(2000) 
; 6. /ene 15000
Send("{ENTER}")
Sleep(2000) 
Send("/ene 15000")
Sleep(2000) 
Send("{ENTER}")
Sleep(2000) 
; 8.  Opens MAP
MouseMove(1124, 175, 10) ; 
Sleep(1000)
MouseClick("left")
Sleep(1000)
MouseMove(683, 678, 10) ; 
MouseClick("left")
MouseMove(1124, 175, 10) ; 
Sleep(1000)
MouseClick("left")
Sleep(3000)
; 9. Moves mouse to teleportation
MouseMove(486, 246, 10) ;
Sleep(1000)
MouseClick("left")
Sleep(1000)
; 10. party member 
MouseMove(1098, 227, 10); 
Sleep(1000) 
MouseClick("left") 
Sleep(1000) 
; 11. OK button
MouseMove(730, 506, 10) ;  
Sleep(1000) 
MouseClick("left") 
Sleep(1000)
; 12. Wait 1min
Sleep(60000) 
; Search for color in a bar. 
$searchcolor = False
While (Not($searchcolor))
$pixels = PixelSearch(106, 626, 108, 628, 0x9F19D1, 1)
    If Not (@error) Then
        Send("{ENTER}")
        Sleep(500)
        Send("/reset")
        Sleep(500)
        Send("{ENTER}")
        Sleep(10000)
    EndIf
    WEnd
WEnd
EndFunc


Func StartBot()
    If Not $isRunning Then
        $isRunning = True
        MsgBox(0,"BOT","STARTED")
        Bot()
    EndIf
EndFunc

Func StopBot()
    If $isRunning Then
        $isRunning = False
        MsgBox(0,"BOT","STOPED")
    EndIf
    EndFunc

While True
    Sleep(100)
    WEnd

Posted
1 hour ago, harekrishna320 said:

; 9. Moves mouse to teleportation
...
; 10. party member 

That sounds pretty much of a game automation to me. I would therefore recommend taking a look at the 

 .

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

  • Moderators
Posted

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

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

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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