Tutorial: how to write a pixelbot in Autoit

08/27/2013 02:21 Bone-marrow#1
Hello!

Since the newest updates, pixelbots have been getting more popular. I noticed that there are not many Autoit tutorials for a Darkorbit pixelbot, so I decided to make one :) This is my first tutorial, and I am still learning Autoit, so bear with me...
Before I begin, you should have Autoit downloaded. Have SciTE.exe and Au3Info.exe open (both can be found in the Autoit folder).


First we need to make a while statement:
Next, we need to tell the bot to search for Bonusboxes around your ship:
To find the color of a bonus box (or palladium ;)) use the au3info window:
Simply click and drag the crosshairs/target to whatever you want to be collected and it will tell you the pixel color.
NOTE: Your info window must be on the "mouse" tab!
Then find the coordinates for the top left and bottom right of your collecting area with the info window:
Here is where everything goes:
Next, we need to add code of what the bot should do if it spots the pixel:
Next we need to make the ship move if there is nothing to collect:


After that, you have a simple yet working boxbot. To make it collect palladium, switch the pixel color and change the minimap coordinates to accomodate the fog area instead of the entire minimap. Here is the whole source:
Bot with added pause feature (Special thanks to Fluttershy)
Bot with other features (Timer, count of boxes collected, etc. Again, special thanks to Fluttershy)

Thanks to Forsaken and Dr.Toni for their tutorials and Fluttershy for adding features in the code. Feel free to pm me any questions that you have.
09/15/2013 01:12 Dr.Toni#2
You learned from my Tutorial... Amazing :awesome:
09/15/2013 20:01 Bone-marrow#3
Quote:
Originally Posted by Dг.Tσпi™ View Post
You learned from my Tutorial... Amazing :awesome:
Your tutorial helped a lot, thanks a bunch for posting it. :)
09/15/2013 20:53 MuPowe#4
One question what about a npc pixel bot? U can make a tutorial for it ? Or someone ?
09/15/2013 21:26 Dr.Toni#5
I could do it yes... but you have to learn Pixelsearch and imagesearch and you can do it yourself :)
09/15/2013 22:34 Bone-marrow#6
Quote:
Originally Posted by MuPowe View Post
One question what about a npc pixel bot? U can make a tutorial for it ? Or someone ?
Try putting NPCs on low and inputting the pixel color from lordakias or streuners. Like Dr.Toni said, it would probably be better to use imagesearch. Perhaps I should make another tutorial :D
09/15/2013 23:04 YatoDev#7
Dont convert the random floating number into integer . use the third parameter its much faster .

dont declare the Opt in a while . it needs to put at start of a func or on script start .

use the instant miusemove parameter .

give the while $pause = true and change it in the while to false (a little suggestion to make the code better)
09/15/2013 23:25 Bone-marrow#8
Quote:
Originally Posted by »FlutterShy™ View Post
Dont convert the random floating number into integer . use the third parameter its much faster .

dont declare the Opt in a while . it needs to put at start of a func or on script start .

use the instant miusemove parameter .

give the while $pause = true and change it in the while to false (a little suggestion to make the code better)
Okay, I understood a bit of what you said...
-Change MouseMove($Box[0],$Box[1],1) to MouseMove($Box[0],$Box[1],0)
-Change MouseMove(int(Random(1390,1580)), int(Random(805,915)), 1) to MouseMove(int(Random(1390,1580)), int(Random(805,915)), 0)
-Move Opt("MouseCoordMode", 1) Above the while loop

I am not sure about this, but are you also suggesting:
-Change MouseMove(int(Random(1390,1580)), int(Random(805,915)), 0) to MouseMove(Random(1390,1580), Random(805,915), 0)
-Change While 1 to While <$pause=true> (In which case, would I have to declare $pause somewhere above the while?)

Thanks for the suggestions, please correct me if I am wrong.
09/16/2013 12:37 YatoDev#9
i wrote that on my smartphone so here is what i mean exactly

That will be better

Code:
#RequireAdmin

Global $pause = False

ProcessSetPriority("script name.exe",4)

HotKeySet("{ESC}", "_quit")
HotKeySet("{F1}", "_Pause")

Opt("MouseCoordMode", 1)

While 1
	If $pause = False Then
		$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
		If IsArray($Box) Then
			MouseMove($Box[0],$Box[1],0)
			MouseClick("left")
			Sleep(1750)
		Else
			MouseMove(Random(1390,1580,1), Random(805,915,1), 0)
			MouseClick("left")
			Sleep(2000)
		EndIf
	Else
		sleep(150)
	EndIf
WEnd

Func _quit()
   Exit
EndFunc

Func _Pause()
	If $pause = True Then
		$pause = False
	ElseIf $pause = False Then
		$pause = True
	EndIf
EndFunc
09/16/2013 16:09 Bone-marrow#10
Quote:
Originally Posted by »FlutterShy™ View Post
i wrote that on my smartphone so here is what i mean exactly

That will be better

Code:
#RequireAdmin

Global $pause = False

ProcessSetPriority("script name.exe",4)

HotKeySet("{ESC}", "_quit")
HotKeySet("{F1}", "_Pause")

Opt("MouseCoordMode", 1)

While 1
	If $pause = False Then
		$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
		If IsArray($Box) Then
			MouseMove($Box[0],$Box[1],0)
			MouseClick("left")
			Sleep(1750)
		Else
			MouseMove(Random(1390,1580,1), Random(805,915,1), 0)
			MouseClick("left")
			Sleep(2000)
		EndIf
	Else
		sleep(150)
	EndIf
WEnd

Func _quit()
   Exit
EndFunc

Func _Pause()
	If $pause = True Then
		$pause = False
	ElseIf $pause = False Then
		$pause = True
	EndIf
EndFunc
Very nice, you added a pause feature. I'll add it to the first post and give you credit. There are other things that can be added such as timers instead of sleep commands, imagesearch for minimap coords, select area, etc. This is just a starting point for now.
09/16/2013 20:08 YatoDev#11
when i have time i post new versions of my script ^^
pixelbots like this arent needed everymore , talanted coders will use trapdoor

#Updates :
-Added Timer (Time Difference between start and exit)
-Added counter for collected boxes

Code:
#RequireAdmin

Global $pause = False

Global $count = 0

ProcessSetPriority("script name.exe",4)

HotKeySet("{ESC}", "_quit")
HotKeySet("{F1}", "_Pause")

Opt("MouseCoordMode", 1)
$Timer = TimerInit()
While 1
	If $pause = False Then
		$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
		If IsArray($Box) Then
			MouseMove($Box[0],$Box[1],0)
			MouseClick("left")
			Sleep(1750)
			$count = $count + 1
		Else
			MouseMove(Random(1390,1580,1), Random(805,915,1), 0)
			MouseClick("left")
			Sleep(2000)
		EndIf
	Else
		sleep(150)
	EndIf
WEnd

Func _quit()
	$Diff = TimerDiff($Timer)
	$Diff = $Diff / 1000
	MsgBox(0,"Boxes Collected","You collected ~ " & $count & " BonusBoxes " & @CRLF & "in ~ " & $Diff & " Seconds")
	Exit
EndFunc

Func _Pause()
	If $pause = True Then
		$pause = False
	ElseIf $pause = False Then
		$pause = True
	EndIf
EndFunc
09/17/2013 02:51 Bone-marrow#12
Quote:
Originally Posted by »FlutterShy™ View Post
when i have time i post new versions of my script ^^
pixelbots like this arent needed everymore , talanted coders will use trapdoor

#Updates :
-Added Timer (Time Difference between start and exit)
-Added counter for collected boxes

More code? Thanks :D , I will add this later.
You are probably right though, Ink's dll will make the best pixelbots (vm is inefficient), but I can't see the harm in learning a little autoit. You clearly know autoit well, I appreciate the advice and sources. Btw, doesn't "4" in the process priorities add cpu-usage?
09/17/2013 14:04 YatoDev#13
Quote:
Originally Posted by Bone-marrow View Post
Btw, doesn't "4" in the process priorities add cpu-usage?
yes but make script faster ^^
09/30/2013 06:06 sasdfasdfas#14
Is there a way to add multiple pixels that it can search for? Cause right now, it only pick ups like 1/20 of the boxes it finds xD

EDIT: Nvm, figured it out ^.^

Can you fix the bonus box counter though? it doesent seem to work. tyty
09/30/2013 06:12 Bone-marrow#15
Quote:
Originally Posted by sasdfasdfas View Post
Is there a way to add multiple pixels? Cause right now, it only pick ups like 1/20 of the boxes it finds xD
You can add shade variation or have multiple pixel searches.