Sign in to follow this  
Followers 0
RevLord

1st bot ever , some guidance and help

11 posts in this topic

Hi all , i`m new to programing tho i do have a bit of brains and like using it but i`m kinda stuck since i don`t know the steps to follow in creating a "bot" and yes it`s for a mmo and yes again it has a pixelsearch part i want to add , since i did a bit of search and many posts camed out but were too complex and didn`t understand much ( to not say nothing :))

So i was fooling around here and there looking for tutorials (if u got a good one i would apreciate it) and found how to create the GUI and how to add buttons.

So i have this atm :

#include <GUIConstantsEx.au3>


GUICreate("Wanna Be Pixel Bot In A Near Future", 400 , 200)

GUICtrlCreateLabel ("Button", 20 , 25) 
$key1 = GUICtrlCreateInput("", 60, 20, 140)

GUICtrlCreateLabel ("Time", 20 , 55) 
$time1 = GUICtrlCreateInput("", 60, 50, 140)

$startbutton = GUICtrlCreateButton("Start", 230, 17, 70)
$stopbutton = GUICtrlCreateButton("Stop", 230, 47, 70)


GUISetState(@SW_SHOW)



While 1
            $msg = GUIGetMsg()
    Select
        
    Case $msg = $startbutton
        $send1 = GUICtrlRead($Key1)
        $sleep1 = GUICtrlRead($time1)
        While 1
            Send($send1)
            Sleep($sleep1)
        WEnd
    Case $msg = $stopbutton
   "here there was a part of code i tryed to use to get it to stop but to ashamed to post it, it`s something extreme :P"
    EndSelect
WEnd

Found bits and parts in other posts and put it together.

Now to explain what i want exactly the bot to do:

First of all i think i tryed 400 different combinations to STOP it , i mean once i hit start it goes for example if the button i want to be pressed is 1 it goes 11111111111 with the timer i set but i can`t stop it from the stop button and have to kill the process.

Since on skillbar 1 i have a macro i want the bot to press before adding a pixelsearch function or if not a mouse fnction.

So if any1 could enlighten me to what function to use to stop it when i hit STOP on the GUI i apreaciate it.

After i would want to know if with how i started the code i would be able to add MouseMove and MouseWheel feature.

I mean i don`t want a complicated bot to start with , something simple and some help on how to combine the comands, to resum the bot in the end will be something like this :

1) press "1" and enter 1 minute loop untill it will be pressed again but imediately after it goes to step 2

2) MouseMove to coord

3) MouseClick on coord bla bla

4) MouseMove to bla bla

5) MouseClick again on other coord

6) MouseWheel

7) Hit enter

does another 2 mouseclicks and waits for the 1) loop to end the cooldown

I wanted to add a pixelsearch feat but as i`m typeing i`m changing my mind since it will be a lot of code to digest for me so i take the easy way.

Tho if it`s easyer to explain with pixelsearch i`m ok with it , tho the first 1 key macro i have set in game is a must since the NPC has no outstanding pixel and it can be confused with players around it.

I also apreciate if the flames r kept to a minimum , don`t want a bad start :)

Thanks!

Share this post


Link to post
Share on other sites



Welcome to the forum.

I have some good tutorials in my sig. Have a look at HotKeySet() to stop ur script when u want to.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$stop = true
while 1
  if $stop = false then
     func() ;call your main loop from here
  else 
     sleep(10)
  endif
wend

func start() ;call this function to start bot 
   if $stop = false then
     $stop = true
   else
     $stop = false
   endif
endfunc

this is helpfull for more than just bots

Edited by Diception

Share this post


Link to post
Share on other sites

@bo8ster, i`m reading the tut , thanks

@Diception, it starts with something that u need and u end up doing something more greater...

I remember the first time i turned the borderline to yellow with my zx spectrum and after that i ended up doin some neat programs.

Thanks for the quick replys.

Share this post


Link to post
Share on other sites

Do u have any more tutorials with LOTS of examples , is the best way for me to learn ....the hello world you find in every programing language you try to learn just gives me the freaks , after that you don`t find any more nice examples upon how it works ...just the commands and the variables and go ahead add em to a program see what you get.

Share this post


Link to post
Share on other sites

Do u have any more tutorials with LOTS of examples , is the best way for me to learn ....the hello world you find in every programing language you try to learn just gives me the freaks , after that you don`t find any more nice examples upon how it works ...just the commands and the variables and go ahead add em to a program see what you get.

The forum is full with bots, look around.

Share this post


Link to post
Share on other sites

I know it`s full but don`t actually know what to look for and hard strings i can`t identify what exactly does, also i want to learn not to copy some1 else work.

and this is what i camed up with

#include <GuiConstantsEx.au3>

GUICreate("Wanna Be Pixel Bot In A Near Future", 400 , 200)

$startbutton = GUICtrlCreateButton("Start", 230, 17, 70)
$stopbutton = GUICtrlCreateButton("Stop", 230, 47, 70)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $startbutton
        WinWaitActive("Game Client")
        send(1)
        sleep(2000)
        MouseMove(48, 418)

    If Not @error Then
    
    MouseClick("left")
    sleep(1500)
    MouseClick("left")
    sleep(1500)
    MouseWheel("down", 10)
    sleep(1500)
    MouseClick ("left", 278, 569, 1)
    sleep(600)
    send("2")
    sleep(800)
    MouseClick("left", 199, 245, 1)
    
    
    EndIf


    EndSelect



Wend

ignore the GUI for now and since i don`t know how pixelsearch works exactly , i mean i tryed to add it but since it has to choose from a "quest list" and all are written the same dosen`t do anything. So i tryed like this ...yea i know it looks ugly but works great so far.

Also i didn`t understand how to add the stop function to the button STOP and i want to add a loop after a certain time like.

So excited how it ended up that i want to make it even more complex.

Share this post


Link to post
Share on other sites

Look in the Example Script section, may scripts there. I remember smOke_N doing some pixel stuff, search for some of his stuff.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ill sit down when i get home tonight and crank out a little trick i used to do for a pixel bot i used to use. (im on to memory functions now)

its simple and i'll comment then you can adapt it to what you need.

it will help me unwind after work.

ill do up the simple functions and you can put them together

edit: for spelling

editt 2 : i give up it is readable and my spellings horible

Edited by Diception

Share this post


Link to post
Share on other sites

edit: for spelling

editt 2 : i give up it is readable and my spellings horible

:) its like that sometimes

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

HotKeySet("{F9}","start")
HotKeySet("{f8}","HPset")
HotKeySet("{f7}","MPset")
HotKeySet("{f6}","MOBset1")
HotKeySet("{f5}","MOBset2")



$stop = true
$HP = 0x000000
$MP = 0x000000
$mob = 0x000000


MsgBox(0, "How to use this bot.","step 1: move mouse to hp bar at the point where you want your pots to be used and press F8" & @CRLF & "Step 2: same as step 1 but use mp bar and F7" & @CRLF & "step 3: now select a mob with a unique color place mouse over that color and press F6" & @CRLF & "Step 4: now select the mob info box and press F5"& @CRLF & "Step 5: press F9 to begin botting")

while 1
 if $stop = false then
     main() ;call your main loop from here
EndIf
    sleep(10)
wend

func main()
    HPcheck()
    MPcheck()
    MOBcheck()
EndFunc

func start() ;call this function to start bot
   if $stop = false then
     $stop = true
   else
     $stop = false
   endif
endfunc

Func HPset()
    Global $hppos = MouseGetPos()
    Global $HP = PixelGetColor($hppos[0],$hppos[1])
EndFunc

Func HPcheck()
    Global $HPcheck = PixelGetColor($hppos[0],$hppos[1])
    if $HPcheck <> $HP Then ;tests to see if you need to pot
        send("1") ; key used to restore hp
    EndIf
EndFunc

Func MPset()
    Global $mppos = MouseGetPos()
    Global $MP = PixelGetColor($mppos[0],$mppos[1])
EndFunc

Func MPcheck()
    Global $MPcheck = PixelGetColor($hppos[0],$hppos[1])
    if $MPcheck <> $MP Then ; tests to see if you need to pot
        send("2") ; key used to restore mp
    EndIf
EndFunc

Func MOBset1()
    Global $mob = PixelGetColor($mppos[0],$mppos[1])
EndFunc

Func MOBset2()
    Global $mobpos = MouseGetPos()
    Global $MOBbox = PixelGetColor($mobpos[0],$mobpos[1])
EndFunc

func MOBcheck()
    Global $MOBcheck = PixelGetColor($mobpos[0],$mobpos[1])
    if $MOBcheck = $MOBbox Then ; tests to see if you need to pot
        send("3") ; key used to attack
    else
        findmob()
    EndIf
EndFunc

func findmob()
    $SA=MouseGetPos()
    $MOBCOORD = PixelSearch($SA[0]-100,$SA[1]-100,$SA[0]+100,$SA[1]+100,$mob,10) ; SEARCHES AREA 100 PIXELS SQUARE AROUND MOUSE
    IF NOT @error Then
        MouseClick("LEFT",$MOBCOORD[0],$MOBCOORD[1]) ;CLICKS ON COLOR OF MOB IF IT IS FOUND
    EndIf
EndFunc

no gui but has the basic functions see what you can learn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0