Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 17:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[TUTORIAL] How to make a BOT

Discussion on [TUTORIAL] How to make a BOT within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645
[TUTORIAL] How to make a BOT


CHAPTER 1

GUI (Graphical User Interface)

Introduction
This is just the basics of AutoIt. By the end of this tutorial you will be able to create your own little simple bot that can spam custom timed key strokes.

To download AutoIt just visit their website at and download the latest version (version 3.3.0.0 as of today). Download, run it, install it... you know what to do.
Section 1
Create a new folder
Create a new folder and call it "Scripts".

Create a .au3 file
Alright, now that you have AutoIt installed you should be able to create a new .au3(autoit script) file. Simply right click any where in the folder, then hit the new button, and then click AutoIt v3 Script.

Name the file
Now name the file what ever you want, for example I named my "epoxgonewild".

Open the file
Open the autoit v3 script file, right click and press Edit.
Section 2
Adding proper header
Now that you have the .au3 file open lets begin to write shit in it. Before we do anything you should always add the proper header to your code. I usually use something pretty/fancy looking like this.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
CS stands for comment start and indicates the beginning of a comment. You don't necessarily have to have all those dashes after it, just makes it look nice.
CE if you haven't figured it out by now(shame on you), stands for comment end and is the last line of the comment (you can have text after it but only on that line).

Importing the GUI features
If you want to use GUI (graphical user interface) you must add this line so autoit recognizes and can import the GUI features you use.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUISetState(@SW_SHOW)
The GUISetState statement basically tells the program once run that it should show the GUI, without adding this the program will not display GUI. Be sure to always have this piece the last part of your GUI section because the program is read from top to bottom once run.

Making the frame
Pew pew, first cool step. In AutoIt all you have to do is add GUICreate and define the window title and dimensions. Easy enough, right?
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)
("Forsaken's Bot", 335, 100)
("x", y, z)

x = The windows title, it will appear in the window bar where you close and minimize the program.
y = The windows width, determines how wide/horizontal the program is.
z = The windows height, determines how high/vertical the program is.

If all was done correctly, once run your frame should look like this.

###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###

Add the code below to end of the script if you do want to preview it.
Code:
While 1
	sleep(1)
WEnd
Section 3
Adding a label
Label, other wise known as text. For that we use GUICtrlCreateLabel.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUICtrlCreateLabel("text", 8, 10)

GUISetState(@SW_SHOW)
("text", 8, 10)
("x", y, z)

x = What ever is put inside of the quotation marks will be printed in the frame you made.
y = This is the horizontal position of where the text will be placed, I am not sure but I believe it is measure in pixels.
z = This is the vertical position of where the text will be placed.

You should have something that looks like this now.

###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###

Add the code below to end of the script if you do want to preview it.
Code:
While 1
	sleep(1)
WEnd


Adding Input box
Input are used to submit data (such as text, numbers, and symbols) from the user and store them. Using GUICtrlCreateLabel.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUICtrlCreateLabel("text", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)

GUISetState(@SW_SHOW)
$key1 This is a variable/string. This stores what ever comes after it, which in this case would be what ever the user inputs into the input box we made. It allows you to reference back to it and use it. You can name this what ever you want (ex. $input $lol $epoxisgay $wtfsfsdf)

("", 35, 8, 120)
("x", y, z, s)

x= Leave this blank, unless you want default text there. It can be edited by user.
y = Horizontal position.
z = Vertical position.
s = Width of the input box.

If all is done correctly, it should look like this now.

###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###

Add the code below to end of the script if you do want to preview it.
Code:
While 1
	sleep(1)
WEnd
Section 4
Duplicating code
Since this a very long tutorial already (we are only half way) I am just going to skip explaining step by step how to add more labels and input boxes because it's exactly the same method listed in section 3. All you have to do is change the positions and variable/string names.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUICtrlCreateLabel("Text", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Text", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

GUISetState(@SW_SHOW)
I just added 1 more label and more input with the variable/string $time1.

Re-labeling
Okay, so this is almost the end of the GUI portion we just need to add start button. But first lets rename those labels to something that the user will understand.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)


GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

GUISetState(@SW_SHOW)

###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###

Add the code below to end of the script if you do want to preview it.
Code:
While 1
	sleep(1)
WEnd
Section 5
Adding a button
The button is what will start the botting. We will be using the GUICtrlCreateButton function to create the button.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

GUISetState(@SW_SHOW)
$startbutton is the variable we assigned to the button so we can refrence back to it once we need it.

("Start", 190, 8, 60)
("x", y, z, s)

x= Button label.
y = Horizontal position.
z = Vertical position.
s = Width of the button.


###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###

Add the code below to end of the script if you do want to preview it.
Code:
While 1
	sleep(1)
WEnd

TheForsaken is offline  
Thanks
199 Users
Old 12/21/2009, 04:18   #2
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645

CHAPTER 2

The Inner Coding (what makes it tick)

Introduction
Alright so now that we added the GUI, lets begin adding the actual coding.
Section 1
Adding a while loop
A while loops is controled flow statement that allows code to be executed repeatedly based on a given condition.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

GUISetState(@SW_SHOW)

While 1
	$msg = GUIGetMsg()
	
WEnd
While 1 indicates the begining of a while loop and WEnd stands for While End which signifies that the end of the while loop statement. If you run your code now the gui will not close nor can you close it yet using the exit button.

The GUIGetMsg used in $msg = GUIGetMsg() polls the GUI to see if any events have occurred. And will be used later on in the code.

Adding a Case statement
Now we will add a case or otherwise known as select statement inside of our while loop. The select statement gives the user the ability to decide what the program does next based on what the user clicks or does.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

While 1
	$msg = GUIGetMsg()
	
	Select
		
		Case $msg = $startbutton
			
		Case $msg = $GUI_EVENT_CLOSE
			
	EndSelect
		
WEnd
What we have done is added a Select statement with two options
Option 1: $msg = $startbutton, that means if the startbutton is pressed it will trigger what ever code is inside this case statement. ( we havent added the code inside yet)

Option 2: $msg = $GUI_EVENT_CLOSE, which means that if the exit button (the x button) is pressed it will trigger what ever code comes inside this case statement. ( we haven't added the code inside yet)
Startbutton event
Now lets tell the program what to do once the start button is pressed.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

While 1
	$msg = GUIGetMsg()
	
	Select
		
		Case $msg = $startbutton
				$send1 = GUICtrlRead($key1)
				$sleep1 = GUICtrlRead($time1)
			
		Case $msg = $GUI_EVENT_CLOSE
			
	EndSelect
		
WEnd
First it will declare all variables. This means it will read what the user input into our two input field $time1 and $key1, and make it usable in the code to follow.

$key1 is assigned the new variable $send1. When ever we refer to $send1 now will be what ever the user input into the $key1 input.

$time1 is assigned the new variable $sleep1. When ever we refer to $sleep1 now will be what ever the user input into the $time1 input.

Next we will add another while loop because we want to spam this part until the user says STOP.
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

While 1
	$msg = GUIGetMsg()
	
	Select
		
		Case $msg = $startbutton
				$send1 = GUICtrlRead($key1)
				$sleep1 = GUICtrlRead($time1)
			While 1	
				Send($send1)
				Sleep($sleep1)
			WEnd
			
		Case $msg = $GUI_EVENT_CLOSE

	EndSelect
		
WEnd
We just added another while loop like you did before but we also added something new inside of it this time.

Send is the command that tell the computer to literally send a key stroke. You can do something like Send("hello") and the program will send out the word hello in any window.

Sleep is basically a pause. It pauses the program for the specified amount of time. Example, Sleep("10000") will pause the program from going on to the next line of code for 10 seconds (10x1000, milliseconds)

But in our case we substituted the "hello" and "10000" with variables that the user has defined. Buy putting in $sleep1 and $send1 instead, the program will automatically put in what ever the user put in the input boxes we created chapter 1. This gives the user the choice to easily choose which key is being sent and how long the pause will be with out editing the actual source code.

Exit button event
The $GUI_EVENT_CLOSE function will exit the loop and destroy the GUI, or exit/close the program
Code:
#cs ----------------------------------------------------------------------------
	AutoIt Version: 3.3.0.0
	Author: Forsaken 
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

While 1
	$msg = GUIGetMsg()
	
	Select
		
		Case $msg = $startbutton
				
				$send1 = GUICtrlRead($key1)
				$sleep1 = GUICtrlRead($time1)
				
			While 1	
				Send($send1)
				Sleep($sleep1)
			WEnd
			
		Case $msg = $GUI_EVENT_CLOSE
			GUIDelete()
			ExitLoop
			
	EndSelect
		
WEnd
GUIDelete() deletes the GUI we created and reomves it from the screen.

ExitLoop does exactly what it says it does, it exits the loop (while 1) statement above that spams the keys.

The End
And tha... tha... tha, that, that's all folks. You can now run your program and it will spam your custom key in your custom time.


TheForsaken is offline  
Thanks
133 Users
Old 12/21/2009, 04:18   #3
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645

CHAPTER 3

Additional Features (some other cool shit)

Introduction
Okay so here we are part 3. Congratulations to the few who actually took the time read this. This section will teach you other useful tricks that can be used for gaming. This section will be updated constantly, so always check back to see new updates. Please press the Thanks button to keep the updates coming.
TimerInit and TimerDiff
The downfall to using Sleep(time) is that it pauses the entire code. Once in Sleep you can't do anything except wait. The alternative is to use the TimerInit() and TimerDiff() functions. With this you can continue on with your code while waiting for another chunk of code. We can do this by using these two functions in an if statement. Okay, so here is the code...
Code:
$timer = TimerInit()

While 1
	$timed = TimerDiff($timer)
	If $timed > 3000 Then ; we use greater than (>) because sometimes it might get skipped
		MsgBox(1,"TimerDiff","TimerDiff : "&$timed)
		$timer = TimerInit()
	EndIf
WEnd
The first TimerInit() is placed outside loop or if statement. The code is executed in order from top to bottom. Once it reaches the line $timer = TimerInit() it will begin the timer then move on to the next line. Then next line would be our loop where it is constantly checking if $timed is greater then 3000 (3 seconds). The timerDiff returns the difference in time from a previous call to TimerInit(). If timerDiff is greater then 3000 then the code will be executed, which in this case is just a message box. Now after the message box we added another $timer = TimerInit() because the first $timer = TimerInit() is still counting up and it doesn't count down so $timed will never equal 3000 again. Adding another $timer resets the count so the if statement has a chance to pick it up again.

ControlSend
Send, sends key(s) to any window on top and this can get very sloppy at times. Using ControlSend we can send key(s) to specific window. This doesn't require the window to be active, on top, or even maximized. It will work as long as the window is opened.
Code:
ControlSend ( "title", "text", controlID, "string" [, flag] )
Example
Code:
ControlSend("Untitled - Notepad", "", "", "Hello world!")
Sleep("100")
ControlSend("Untitled - Notepad", "", "", "{ENTER}"
Sleep("100")
ControlSend("Untitled - Notepad", "", "", "This is the line after the ENTER key was pressed.")
This one is pretty simple and the code explains its self. You have to enter the exact window name for this to work. The rest explains itself.

Changing button text
Using GUICtrlSetData we can change anything on the GUI right there on the spot. All we have to do is add a Switch and If statement and we can get a working Start/Stop button.
Code:
#include <GUIConstantsEx.au3>

GUICreate("GUICtrlSetData", 200,100)
GUISetState(@SW_SHOW)

$button = GUICtrlCreateButton("Start",60, 30, 80, 20)
$count = 0

While 1
	Switch GUIGetMsg()
	Case $button
		If $count = 1 Then
			GUICtrlSetData($button, "Start")
			$count = 0
		ElseIf $count = 0 Then
			GUICtrlSetData($button, "Stop")
			$count = 1
		EndIf
	Case $GUI_EVENT_CLOSE
		Exit
	EndSwitch
WEnd
GUICtrlSetData($button, "Stop")

So $button would be what ever we are changing. In this case the variable $button is assigned to a button that contains the data "Start". The second part of the function is what we are changing the data to, which we will be changing it to "Stop".
TheForsaken is offline  
Thanks
112 Users
Old 12/21/2009, 04:20   #4
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645

CHAPTER 4

Pixel Search (auto pot)

Introduction
In this part of the tutorial you will learn how to create a BOT that automatically uses HP/MP potions.
The HP/MP bar
Before we do anything we have to know how this will work and you need to get familiarized with the HP/MP bar we will be using as an example in this tutorial.

First lets take a look at this HP/MP bar below.


There is the color red and blue bars are full indicating that the character has maximum HP (health) and MP (manna).

Now look at this HP/MP bar.


From this HP/MP bar we can tell that the user has taken damage and no longer has full HP. There is an area with a dark background indicating the amount (%) of total HP lost.

So in order to auto HP pot we have to make a bot that checks for that dark color in that area.

GetMousePos
Retrieves the current position of the mouse cursor.

First thing we need to do is pick a spot on the HP/MP bar where the color changes from Red (HP) to the dark color (EMPTY/NO HP).

I picked this spot HERE. (see green dot)


We first have to figure out how to make the BOT focus on that position. We need to find the X and Y coordinates in order to do that. We will make a function for this first.

Code:
While 1
	sleep("1")
WEnd

Func _getDefault()
	
EndFunc
Then we add 2 variables. One for the X coordinate and one for the Y.
Code:
$x = 0
$y = 0

While 1
	sleep("1")
WEnd

Func _getDefault()
	
EndFunc
Now to get the actual coordinates using the MouseGetPos() function and set the new $x and $y variables to contain the position.
Code:
$x = 0
$y = 0

While 1
	sleep("1")
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
EndFunc
Pixel Search
Next we have to add something that continuously checks that position for a change in color.

Before we do that, we have to get the color of the pixel at that position. Which should some shade of red.

I am going to add it to the _getDefault() function because it is easier but there are different ways to do it. You can also add in if statement in the main function to check if $x or $y are anything but 0 (default).

set a variable outside of the function for the color.
Code:
$x = 0
$y = 0
$color = 0

While 1
	sleep("1")
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
EndFunc
Now lets use the Hex() function to get the hexadecimal color code value. It is a six character long code which represents a color.
Code:
$x = 0
$y = 0
$color = 0

While 1
	sleep("1")
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
EndFunc
Next we need a hot key that will run the _getDefault() function and set the default/temporary variables to the real ones that you will use. This gives you as much time as you need to pick position on the HP bar. It wont automatically run when the program is started. We will use the HotKeySet() function.

Code:
HotKeySet("{NUMPADSUB}", "_getPosition")

$x = 0
$y = 0
$color = 0
$status = "off"

While 1
	sleep("1")
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
	$status = "on"
EndFunc
Now when move your mouse to a position on the screen and press num pad - and it will set the $x, $y and $color for that spot.

Next we start the If statement. First we have to check the status. If the status is set to OFF, it will skip this code. If it is set to ON it will execute the code inside.


Next we have to add an if statement that checks that position to see if the $color has changed. We have to make a variable called $status and set its default value outside the loop to "off" so that the bot does not start.
Code:
HotKeySet("{NUMPADSUB}", "_getPosition")

$x = 0
$y = 0
$color = 0
$status = "off"

While 1
	sleep("1")
	If $status = "on" Then
		;code here
	EndIf

WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
	$status = "on"
EndFunc
Before we do the code inside the If statement we have to make a function llike _setDefault(). The only difference is that it will not get a new MousePos and it will save the Hex color to a new variable. We will use our current $x and $y positions. Don't forget to the declare $newColor outside of the function.

Code:
HotKeySet("{NUMPADSUB}", "_getDefault")

$x = 0
$y = 0
$color = 0
$newColor = 0
$status = "off"

While 1
	sleep("1")
	If $status = "on" Then
	EndIf

WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
	$status = "on"
EndFunc

Func _getCurrentColor($xDef, $yDef)
	$newColor = Hex(PixelGetColor( $xDef, $yDef), 6)
	Return ($newColor)
EndFunc
Now we continue with the If Statement. Now we add an if statement to check if the color has changed.

Code:
HotKeySet("{NUMPADSUB}", "_getDefault")

$x = 0
$y = 0
$color = 0
$newColor = 0
$status = "off"

While 1
	If $status = "on" Then
		If _getCurrentColor($x, $y) <> $color Then
			;code here
		EndIf
	EndIf
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
	$status = "on"
EndFunc

Func _getCurrentColor($xDef, $yDef)
	$newColor = Hex(PixelGetColor( $xDef, $yDef), 6)
	Return ($newColor)
EndFunc
Now if the new color does not equal the old color it will execute the code. The code should be a Send() function. You should send the shorcut key for using your healing potion in-game. For this example we will use the number "1".
Code:
HotKeySet("{NUMPADSUB}", "_getDefault")

$x = 0
$y = 0
$color = 0
$newColor = 0
$status = "off"

While 1
	If $status = "on" Then
		If _getCurrentColor($x, $y) <> $color Then
			Send("1")
		EndIf
	EndIf
WEnd

Func _getDefault()
	$coord = MouseGetPos()
	$x = $coord[0]
	$y = $coord[1]
	$color = Hex(PixelGetColor( $coord[0], $coord[1]), 6)
	$status = "on"
EndFunc

Func _getCurrentColor($xDef, $yDef)
	$newColor = Hex(PixelGetColor( $xDef, $yDef), 6)
	Return ($newColor)
EndFunc
Now we are done. The BOT will spam the key 1 until the color is back to normal and it will start spamming again if it changes.
TheForsaken is offline  
Thanks
108 Users
Old 12/22/2009, 05:14   #5
 
elite*gold: 0
Join Date: Apr 2006
Posts: 18
Received Thanks: 0
hi...i read them all and chapter 3 kinda short? im learning to do the timediff better than the sleep thanks!! gonna try that now
vtdrx is offline  
Old 01/17/2010, 19:28   #6
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645
Quote:
Originally Posted by vtdrx View Post
hi...i read them all and chapter 3 kinda short? im learning to do the timediff better than the sleep thanks!! gonna try that now
What do you need to know? If you need any help just let me know. Post code.
TheForsaken is offline  
Thanks
8 Users
Old 01/17/2010, 22:32   #7
 
elite*gold: 0
Join Date: Jan 2006
Posts: 81
Received Thanks: 18
hey forsaken nice tut

maybe u want add some code for pixelgetcolore, pixelsearch and maybe memory read

just advice XD
markusbab is offline  
Old 01/21/2010, 15:42   #8
 
ax5's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
it would be good if you add imgaes on CHAPTER and CHAPTER 3

only a tip
ax5 is offline  
Thanks
9 Users
Old 01/22/2010, 20:45   #9
 
aragonik's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 136
Received Thanks: 38
o.O i did it it says star or stop XD i think in me mind Good job But..
XDDD i dont knwo how i did it XDD
aragonik is offline  
Old 01/26/2010, 05:15   #10
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645
I'll try and add pixel search in Chapter 3 if I find some free time this weekend. It can be used for auto healing.
TheForsaken is offline  
Thanks
4 Users
Old 01/26/2010, 14:58   #11
 
ax5's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
Quote:
Originally Posted by TheForsaken View Post
I'll try and add pixel search in Chapter 3 if I find some free time this weekend. It can be used for auto healing.
i never used pixel search but but i have used image search but image search dosent work on all PC`s. Is pixel search the same like image search ?
ax5 is offline  
Old 01/27/2010, 05:24   #12
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645
Quote:
Originally Posted by ax5 View Post
i never used pixel search but but i have used image search but image search dosent work on all PC`s. Is pixel search the same like image search ?
I don't know what image search is so I can't compare them, lol. In pixel search it looks for a specific color in certain area or specific coordinates.

From the autoit help files.

Code:
PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )
Code:
; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf


; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000, 10 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
I'll try to go into more details this weekend and make it so beginners can easily understand it.
TheForsaken is offline  
Thanks
1 User
Old 01/27/2010, 09:16   #13
 
elite*gold: 0
Join Date: Dec 2006
Posts: 31
Received Thanks: 0
Sweet, thanks for the tut - can't wait for the weekend
altehupe is offline  
Old 01/27/2010, 20:26   #14
 
TheForsaken's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 63
Received Thanks: 645
Added Chapter 4, enjoy.
TheForsaken is offline  
Thanks
3 Users
Old 01/27/2010, 20:28   #15


 
Cholik's Avatar
 
elite*gold: 4
Join Date: Aug 2008
Posts: 6,786
Received Thanks: 4,992
nice work

#pinned
Cholik is offline  
Reply

Tags
autoit, bot, forsaken, hack, tutorial


Similar Threads Similar Threads
[Video Tutorial] - Very Easy Tutorial How to make your Own Wallhack in C++
09/01/2012 - Soldier Front Hacks, Bots, Cheats & Exploits - 16 Replies
Hello Everyone!Hellow Philippines - Mabuhay Pinoy Cheaters! Confidentials000 of GZP and Me Babyface21 ay iisa lang! Today i Will Teach you on How to Make Your Own Wallhack in C++ Very Simple By Video Tutorials Step by Step Part 1 - 3 Dont Ask me to Release my Private Wallhack coz i Need it to still Undetected
[[Tutorial]] how to make your own hacks with VB
03/13/2011 - WarRock Hacks, Bots, Cheats & Exploits - 81 Replies
] : None Of the addresses work anymore, Current finding the updated ones. So the hacks will not work until me or someone else finds the new addresses! Hey there. Are you getting sick of antiously waiting for someone to post a new hack for use, then in like one hour getting banned? Well thats over. In this tutorial i will show you how to.. Designing and customizing your very own hacks A few examples on how to add stuff such as Unlimited stamina or swimming ----------Getting...
[TUTORIAL] How To Make A UCE !!!
08/12/2010 - MapleStory - 23 Replies
PART 1 UCE ToolsDDK (Driver Development Kit)- Used To Compile, Files For UCE Delphi 7 - Compiling, And Editing UCE Files Delphi 7 Keygen - To Crack Delphi so it's free ASR (Actual Search and Replace) - Used To Search And Replace *Characters* To You Choice
My First tutorial How to make 20K GP in 5 Min
08/05/2010 - CrossFire - 26 Replies
Sup Guys this is my First tutorial on how to make 20K GP in 5 min And this is my video Note: Dont say its bad video or anything ITS MY FIRST TIME MAKING VIDEO BTW Program You will need HotSpot Shield
[Tutorial] How To Make Around $50 A Day
01/30/2010 - Main - 4 Replies
Site is called IMreportcard. You have to comment reviews on products/services/persons to gain points. You can exchange those points into money. Sign-Up Here: *edited* http://i46.tinypic.com/iqg67s.png Now, 100 credits = $1. And as you can see, it's not hard to make 100 credits. Commenting



All times are GMT +2. The time now is 17:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.