Cerb's guide to writing your own bot with AutoIt v3!!!

Cerb

Member!
Joined
Aug 22, 2003
Messages
77
Reaction score
0
Website
www.bnfreak.com
This guide is not like Starfish's old one. This guide is for an AutoIt v3 spambot. AutoIt v3 is a completely different language, and it is much more powerful.




Ok, in this guide, I'll briefly explain how to write your very own bot using AutoIt v3, which can be found here (Just download AutoItv3Setup.exe file)

Now that you have AutoIt installed, assuming you don't need a guide to install this program, let's begin.

Right click somewhere in windows and choose to make a new AutoIt v3 file.

Now, let's say you created it in C:\Program Files\aSpamBot, create a .ini file, let's say config.ini, in the same directory.

Config.ini
Code:
[Account]
account=Myaccount
password=mypassword
charlocation=1

[Spam]
channelStart=1
channelEnd=5
channel=LoD Trading USEast-
spamMsg=My Spam
This is your main config file. *Note* You can add many more options once you learn more about AutoIt v3.

Ok, now the main AutoIt script.


Start off with this

Code:
$vAccount = IniRead("config.ini", "Account", "account", "account Key Not Found")
$vPassword = IniRead("config.ini", "Account", "password", "password Key Not Found")
$vCharLocation = IniRead("config.ini", "Account", "charlocation", "charlocation Key Not Found")
$vSpamMsg = IniRead("config.ini", "Spam", "spamMsg", "spamMsg Key Not Found")
$vChannel = IniRead("config.ini", "Spam", "channel", "channel Key Not Found")
$vChannelStart = IniRead("config.ini", "Spam", "channelStart", "channelStart Key Not Found")
$vChannelEnd = IniRead("config.ini", "Spam", "channelEnd", "channelEnd Key Not Found")
Also add this, right after the IniRead lines.

Code:
$cChan = 0
The variable $cChan, which you'll use later, is equal to zero.

What this does, is to get the entries from the config.ini file, and stores it into variables (i.e.: $vAccount)

The syntax is the following

IniRead("filename", "section", "key", "default")

Parameters

filename The filename of the .ini file.
section The section name in the .ini file.
key The key name in the in the .ini file.
default The default value to return if the requested key is not found.

Now we have all the values from config.ini stored into variables.



Let's keep going.

If you want to verify if D2 is always loaded/maximized/(has the focus), use this

Code:
AdlibEnable("d2Check")
right after the IniRead() lines, then this at the end
Code:
Func d2Check()
	If WinExists("Diablo II") == 0 Then
		MsgBox(0,"My Spam Bot","You need Diablo II to run, and the window is not present in memory.")
		Exit
	EndIf
	If WinActive("Diablo II") == 0 Then
		$msgActive = MsgBox(4,"My Spam Bot","Diablo II is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
		Select
		Case $msgActive = 6
			WinActivate("Diablo II")
		Case $msgActive = 7
			Exit
		EndSelect
	EndIf
	
EndFunc
This simple script will check if D2 is running, if not, it will asks for confirmation on when to give it back the focus.



Right before the Func D2Check(), use this

Code:
AdlibDisable()


Ok now, on the main code. Let's run the game.

Add this right before AdlibEnable("D2Check")
Code:
loadDiablo()
and this after the Func D2Check()
Code:
Func loadDiablo()
MouseSetMode(0)
Run("C:\Program Files\Diablo II\Game.exe -w")
Sleep(15000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
EndFunc
This function loads Diablo in windowed mode, then waits 15 seconds (15000 miliseconds), then simulates 3 clicks anywhere on the screen with an inbetween delay of 1000 miliseconds aka 1 second to get rid of the "Blizzard North" screens and such.


So now, your code should look like this.


mybot.aut
Code:
$vAccount = IniRead("config.ini", "Account", "account", "account Key Not Found")
$vPassword = IniRead("config.ini", "Account", "password", "password Key Not Found")
$vCharLocation = IniRead("config.ini", "Account", "charlocation", "charlocation Key Not Found")
$vSpamMsg = IniRead("config.ini", "Spam", "spamMsg", "spamMsg Key Not Found")
$vChannel = IniRead("config.ini", "Spam", "channel", "channel Key Not Found")
$vChannelStart = IniRead("config.ini", "Spam", "channelStart", "channelStart Key Not Found")
$vChannelEnd = IniRead("config.ini", "Spam", "channelEnd", "channelEnd Key Not Found")
$cChan = 0

loadDiablo()
AdlibEnable("d2Check")

AdlibDisable()



Func d2Check()
	If WinExists("Diablo II") == 0 Then
		MsgBox(0,"My Spam Bot","You need Diablo II to run, and the window is not present in memory.")
		Exit
	EndIf
	If WinActive("Diablo II") == 0 Then
		$msgActive = MsgBox(4,"My Spam Bot","Diablo II is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
		Select
		Case $msgActive = 6
			WinActivate("Diablo II")
		Case $msgActive = 7
			Exit
		EndSelect
	EndIf
	
EndFunc


Func loadDiablo()
MouseSetMode(0)
Run("C:\Program Files\Diablo II\Game.exe -w")
Sleep(15000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
EndFunc

Ok now, let's make the functions to connect to battle.net and pick the right character.


Add this after the Func loadDiablo()

Code:
Func bnConnect()
MouseSetMode(0)
MouseMove(394,380,0)
MouseClick("left")
Sleep(6000)
EndFunc
This simulates a click on the Conenct to Battle.net button assuming the right gateway is already chosen, and waits 6 seconds.

Right after that function, add
Code:
Func accLogin()
Send("{TAB}")
Sleep(250)
ClipPut($vAccount)
Send("^v")
Send("{TAB}")
Sleep(250)
ClipPut($vPassword)
Send("^v")
Sleep(250)
Send("{ENTER}")
Sleep(6000)
EndFunc
This sends a TAB key to switch to the Account field, sets the account variable to clipboard, pastes it, sends a TAB key to switch back to the password field, then adds the password info, simulates an ENTER key to log in, then waits 6 seconds.

Right after this, your "pickChar" function

Code:
Func pickChar()
Select
	Case $vCharLocation = 1
		Send("{ENTER}")
	Case $vCharLocation = 2
		Send("{RIGHT}{ENTER}")		
	Case $vCharLocation = 3
		Send("{DOWN}{ENTER}")
	Case $vCharLocation = 4
		Send("{DOWN}{RIGHT}{ENTER}")
	Case $vCharLocation = 5
		Send("{DOWN}{DOWN}{ENTER}")
	Case $vCharLocation = 6
		Send("{DOWN}{DOWN}{RIGHT}{ENTER}")
	Case $vCharLocation = 7
		Send("{DOWN}{DOWN}{DOWN}{ENTER}")
	Case $vCharLocation = 8
		Send("{DOWN}{DOWN}{DOWN}{RIGHT}{ENTER}")
EndSelect
Sleep(8000)
EndFunc
Pretty self-explanatory. Sends the Down and Right keys to get the right char, then simulates an Enter key, and waits 8 seconds.

Now, we need to get rid of that new lobby, and enter the chat.


Code:
Func lobby()
MouseSetMode(0)
MouseMove(87,501,0)
MouseClick("left")
Sleep(2000)
EndFunc
Simulates a click on the enter chat button and waits 2 seconds.


Add the calls to functions right after the AdlibEnable("D2Check") line.

Code:
bnConnect()
accLogin()
pickChar()
lobby()
Your code should now look like this


mybot.aut
Code:
$vAccount = IniRead("config.ini", "Account", "account", "account Key Not Found")
$vPassword = IniRead("config.ini", "Account", "password", "password Key Not Found")
$vCharLocation = IniRead("config.ini", "Account", "charlocation", "charlocation Key Not Found")
$vSpamMsg = IniRead("config.ini", "Spam", "spamMsg", "spamMsg Key Not Found")
$vChannel = IniRead("config.ini", "Spam", "channel", "channel Key Not Found")
$vChannelStart = IniRead("config.ini", "Spam", "channelStart", "channelStart Key Not Found")
$vChannelEnd = IniRead("config.ini", "Spam", "channelEnd", "channelEnd Key Not Found")

$cChan = 0

loadDiablo()
AdlibEnable("d2Check")

bnConnect()
accLogin()
pickChar()
lobby()

AdlibDisable()



Func d2Check()
	If WinExists("Diablo II") == 0 Then
		MsgBox(0,"My Spam Bot","You need Diablo II to run, and the window is not present in memory.")
		Exit
	EndIf
	If WinActive("Diablo II") == 0 Then
		$msgActive = MsgBox(4,"My Spam Bot","Diablo II is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
		Select
		Case $msgActive = 6
			WinActivate("Diablo II")
		Case $msgActive = 7
			Exit
		EndSelect
	EndIf
	
EndFunc


Func loadDiablo()
MouseSetMode(0)
Run("C:\Program Files\Diablo II\Game.exe -w")
Sleep(15000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
EndFunc

Func bnConnect()
MouseSetMode(0)
MouseMove(394,380,0)
MouseClick("left")
Sleep(6000)
EndFunc

Func accLogin()
Send("{TAB}")
Sleep(250)
ClipPut($vAccount)
Send("^v")
Send("{TAB}")
Sleep(250)
ClipPut($vPassword)
Send("^v")
Sleep(250)
Send("{ENTER}")
Sleep(6000)
EndFunc
 

Cerb

Member!
Joined
Aug 22, 2003
Messages
77
Reaction score
0
Website
www.bnfreak.com
Func pickChar()
Select
Case $vCharLocation = 1
Send("{ENTER}")
Case $vCharLocation = 2
Send("{RIGHT}{ENTER}")
Case $vCharLocation = 3
Send("{DOWN}{ENTER}")
Case $vCharLocation = 4
Send("{DOWN}{RIGHT}{ENTER}")
Case $vCharLocation = 5
Send("{DOWN}{DOWN}{ENTER}")
Case $vCharLocation = 6
Send("{DOWN}{DOWN}{RIGHT}{ENTER}")
Case $vCharLocation = 7
Send("{DOWN}{DOWN}{DOWN}{ENTER}")
Case $vCharLocation = 8
Send("{DOWN}{DOWN}{DOWN}{RIGHT}{ENTER}")
EndSelect
Sleep(8000)
EndFunc

Func lobby()
MouseSetMode(0)
MouseMove(87,501,0)
MouseClick("left")
Sleep(2000)
EndFunc
[/code]


Now, for the last part, spamming.


Code:
Func StartSpam()

Do
$aChannel = "/join " & $vChannel & $cChan
ClipPut($aChannel)
Send("^v{ENTER}")


ClipPut($spamMsg)
Send("^v{ENTER}")

Sleep(15000)

$cChan = $cChan + 1


If $cChan > $vChannelEnd Then
$cChan = $vChannelStart
EndIf
Until 0

EndFunc
This joins a channel, spams the message, uses a delay of 15 seconds (15000 miliseconds) between each message, adds 1 to the $cChan variable.

If the $cChan variable is higher than $vChannelEnd (last # of channels), it sets back the $cChan variable to $vChannelStart (first # of channels)

And this is repeated infinately. To stop the bot, press alt+tab, it'll ask a message saying the bot is currently paused. By clicking yes the bot will maximize d2 again and keep spamming, and by clicking no, it'll stop the bot. This is set in the D2Check() function.

Don't forget to add a call to your StartSpam() function.


Now, finally, your bot should look like this:


mybot.aut
Code:
$vAccount = IniRead("config.ini", "Account", "account", "account Key Not Found")
$vPassword = IniRead("config.ini", "Account", "password", "password Key Not Found")
$vCharLocation = IniRead("config.ini", "Account", "charlocation", "charlocation Key Not Found")
$vSpamMsg = IniRead("config.ini", "Spam", "spamMsg", "spamMsg Key Not Found")
$vChannel = IniRead("config.ini", "Spam", "channel", "channel Key Not Found")
$vChannelStart = IniRead("config.ini", "Spam", "channelStart", "channelStart Key Not Found")
$vChannelEnd = IniRead("config.ini", "Spam", "channelEnd", "channelEnd Key Not Found")

$cChan = 0

loadDiablo()
AdlibEnable("d2Check")

bnConnect()
accLogin()
pickChar()
lobby()
StartSpam()

AdlibDisable()



Func d2Check()
	If WinExists("Diablo II") == 0 Then
		MsgBox(0,"My Spam Bot","You need Diablo II to run, and the window is not present in memory.")
		Exit
	EndIf
	If WinActive("Diablo II") == 0 Then
		$msgActive = MsgBox(4,"My Spam Bot","Diablo II is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
		Select
		Case $msgActive = 6
			WinActivate("Diablo II")
		Case $msgActive = 7
			Exit
		EndSelect
	EndIf
	
EndFunc


Func loadDiablo()
MouseSetMode(0)
Run("C:\Program Files\Diablo II\Game.exe -w")
Sleep(15000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
MouseMove(407,76,0)
MouseClick("left")
Sleep(1000)
EndFunc

Func bnConnect()
MouseSetMode(0)
MouseMove(394,380,0)
MouseClick("left")
Sleep(6000)
EndFunc

Func accLogin()
Send("{TAB}")
Sleep(250)
ClipPut($vAccount)
Send("^v")
Send("{TAB}")
Sleep(250)
ClipPut($vPassword)
Send("^v")
Sleep(250)
Send("{ENTER}")
Sleep(6000)
EndFunc

Func pickChar()
Select
	Case $vCharLocation = 1
		Send("{ENTER}")
	Case $vCharLocation = 2
		Send("{RIGHT}{ENTER}")		
	Case $vCharLocation = 3
		Send("{DOWN}{ENTER}")
	Case $vCharLocation = 4
		Send("{DOWN}{RIGHT}{ENTER}")
	Case $vCharLocation = 5
		Send("{DOWN}{DOWN}{ENTER}")
	Case $vCharLocation = 6
		Send("{DOWN}{DOWN}{RIGHT}{ENTER}")
	Case $vCharLocation = 7
		Send("{DOWN}{DOWN}{DOWN}{ENTER}")
	Case $vCharLocation = 8
		Send("{DOWN}{DOWN}{DOWN}{RIGHT}{ENTER}")
EndSelect
Sleep(8000)
EndFunc

Func lobby()
MouseSetMode(0)
MouseMove(87,501,0)
MouseClick("left")
Sleep(2000)
EndFunc

Func StartSpam()

Do
$aChannel = "/join " & $vChannel & $cChan
ClipPut($aChannel)
Send("^v{ENTER}")


ClipPut($spamMsg)
Send("^v{ENTER}")

Sleep(15000)

$cChan = $cChan + 1


If $cChan > $vChannelEnd Then
$cChan = $vChannelStart
EndIf
Until 0

EndFunc
Save the file, right click it and choose Compile... the rest is easy, you'll make your file a .exe so you can distribute it 8)





Hope this guide helped :p Just reply if you have any bug to report.

By the way, this will not work under AutoIt v2, since v3 and v2 are totally different languages.


Hope you found my guide useful, just reply here for any more questions.

*Sorry for the bad english*




~Cerb
 

Jason

BattleForums Guru
Joined
May 10, 2003
Messages
11,073
Reaction score
2
Very Nice! This Deserves A Sticky.
 

Starfish

Member!
Joined
Feb 23, 2003
Messages
3,594
Reaction score
0
huh? there's a new AutoIt and no1 told me?!? :ph34R:

yay I loved AutoIt2.X but it had too few features :(
hrhrhr v3 looks awsome ^-^

uses a delay of 15 seconds (15000 miliseconds)
use random values/different values or you'll get banned in no time ^^
 

Cerb

Member!
Joined
Aug 22, 2003
Messages
77
Reaction score
0
Website
www.bnfreak.com
Starfish, that's just an example heh. But you have a point.


$rndSpamDelay = Random(13000,18000)
Sleep($rndSpamDelay)


This should do it.


By the way if anyone wants to release his/her own bot using this guide, one great thing I could suggest is to add an auto reconnect function like I did in my old spam bot.

Let's say you set it to reconnect after 2 minutes, well the bot would spam for 2 minutes, then reconnect to battle.net, this will prevent flooding.
 

Radium

Member!
Joined
May 26, 2003
Messages
1,192
Reaction score
0
Website
Visit site
This reminds me a lot like visual basic, but I'll give it a shot. Thanks a lot man
 

Cerb

Member!
Joined
Aug 22, 2003
Messages
77
Reaction score
0
Website
www.bnfreak.com
Np. BTW the lastest AutoIt version changed something.

You'll have to use


AutoItSetOption("MouseCoordMode",0)

instead of MouseSetMode(0)
 

ExoduX

Member!
Joined
Feb 25, 2003
Messages
195
Reaction score
0
Location
over there
Website
Visit site
thats sexilent cerb. very sexilent

:: off topic :: now i pWn lucifer!:shoot:lucifer
(lucifer:lucifer) nooo my powers!
 

Ultimate Empire

BattleForums Addict
Joined
May 18, 2003
Messages
701
Reaction score
0
good work :). needs to go to botting section though. don't know why its stuck here
 

Cerb

Member!
Joined
Aug 22, 2003
Messages
77
Reaction score
0
Website
www.bnfreak.com
Man will you shut up with your ****ing botting section? Shut the hell up and stop ruining my threads you mofo.

BNET Hacking
Discussions for anything related to diablo hacking. Discuss trainers, mods, dupes, hacks, utilities, patches, items, dupe hacking and other hacking related stuff.


Bots and Editors
Need help with a bot or editor? Post questions or problems relating to Meph, Pindle, Wirt, JED, Eldrich, Jamella, Fuzzy, Shadow, Ericjwin, Item Editor or any other bot/editor in here.
 

Ultimate Empire

BattleForums Addict
Joined
May 18, 2003
Messages
701
Reaction score
0

Starfish

Member!
Joined
Feb 23, 2003
Messages
3,594
Reaction score
0
Just a small reminder: My AI 2.X tutorial was moved into botting section :rolleyes
 

-Sh1Ft-

=) - (=
Joined
Jun 20, 2003
Messages
945
Reaction score
0
Location
[color=blue]Ello[/color]
yeh dude nice work
also this isnt a BOT its a tut. to makeing one in autoit, so technicly it shouldnt be in bots and editers? its nice in B.Net hacking, btw a bot can be counted as a hack now cant it?
well w/e nice work man
 

New threads

Top