|
You last visited: Today at 11:06
Advertisement
Tutorial: how to write a pixelbot in Autoit
Discussion on Tutorial: how to write a pixelbot in Autoit within the Coding Tutorials forum part of the General Coding category.
09/30/2013, 22:51
|
#16
|
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
|
Quote:
Originally Posted by sasdfasdfas
Can you fix the bonus box counter though? it doesent seem to work. tyty
|
fixed but mayby you should understand that $count = $count + $count 0 is
|
|
|
10/01/2013, 01:22
|
#17
|
elite*gold: 0
Join Date: Sep 2013
Posts: 3
Received Thanks: 0
|
Quote:
Originally Posted by »FlutterShy™
fixed but mayby you should understand that $count = $count + $count 0 is
|
:P Yeah your probably right
|
|
|
10/02/2013, 08:38
|
#18
|
elite*gold: 20
Join Date: Dec 2012
Posts: 725
Received Thanks: 331
|
Fixed the count thing. I wish you could do $count++ instead of that whole line lol.
|
|
|
01/19/2014, 16:03
|
#19
|
elite*gold: 0
Join Date: Jan 2014
Posts: 48
Received Thanks: 7
|
Okay, so I've done the above and so far have a If and ElseIf for $box1 up to $box10 as it seems the pixelsearch either skips pixels or DO has slightly different colours for every single box. Can you specify a pixelsearch range of colours, as my script is currently like this (i created random times for wait so D.O.'s logs aint so obvious):
#include <Constants.au3>
#RequireAdmin
HotKeySet("{ESC}", "_quit")
Opt("MouseCoordMode", 1)
While 1
$Box1 = PixelSearch(284,116,1900,1029,0xF5D791)
$Box2 = PixelSearch(284,116,1900,1029,0xBB966C)
$Box3 = PixelSearch(284,116,1900,1029,0xF0FCEC)
$Box4 = PixelSearch(284,116,1900,1029,0xFAEEB2)
$Box5 = PixelSearch(284,116,1900,1029,0xFAFCC3)
$Box6 = PixelSearch(284,116,1900,1029,0xFCFAC5)
$Box7 = PixelSearch(284,116,1900,1029,0xFAFAEB)
$Box8 = PixelSearch(284,116,1900,1029,0xFCFCF8)
$Box9 = PixelSearch(284,116,1900,1029,0xFCFCD7)
$Box10 = PixelSearch(284,116,1900,1029,0xFCF8F5)
If IsArray($Box1) Then
MouseMove($Box1[0],$Box1[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box2) Then
MouseMove($Box2[0],$Box2[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box3) Then
MouseMove($Box3[0],$Box3[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box4) Then
MouseMove($Box4[0],$Box4[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box5) Then
MouseMove($Box5[0],$Box5[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box6) Then
MouseMove($Box6[0],$Box6[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box7) Then
MouseMove($Box7[0],$Box7[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box8) Then
MouseMove($Box8[0],$Box8[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box9) Then
MouseMove($Box9[0],$Box9[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
ElseIf IsArray($Box10) Then
MouseMove($Box10[0],$Box10[1],0)
MouseClick("left")
$howlong = Random(1111,2222,1)
Sleep($howlong)
Else
MouseMove(Random(40,251,1), Random(121,251,1), 0)
MouseClick("left")
$howlong = Random(1111,3333,1)
Sleep($howlong)
EndIf
WEnd
Func _quit()
Exit
EndFunc
|
|
|
10/09/2017, 03:00
|
#20
|
elite*gold: 0
Join Date: Feb 2013
Posts: 4
Received Thanks: 0
|
Having hard time detecting the color for Cargoes/Boxes/NPC's
Quote:
Originally Posted by Bone-marrow
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:
This puts the code into a loop and makes it keep running.
Next, we need to tell the bot to search for Bonusboxes around your ship:
Code:
While 1
$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
WEnd
This line of code tells the bot the area it should search for a pixel color. You declare the variable "$box" and tell the bot to search for it.
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:
Code:
$variablename = PixelSearch([top left x coord],[top left y coord],[bottom right x coord],[bottom right y coord],[Pixel Color])
Next, we need to add code of what the bot should do if it spots the pixel:
Code:
While 1
$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
If IsArray($Box) Then
MouseMove($Box[0],$Box[1],0)
MouseClick("left")
Sleep(1750)
WEnd
Basically, the bot will move the cursor to the pixel and click. The sleep time is the amount of time needed for your ship to collect the box/resource.
Next we need to make the ship move if there is nothing to collect:
Code:
While 1
$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
If IsArray($Box) Then
MouseMove($Box[0],$Box[1],0)
MouseClick("left")
Sleep(1750)
Else
Opt("MouseCoordMode", 1)
MouseMove(int(Random(1390,1580)), int(Random(805,915)), 0)
MouseClick("left")
Sleep(2000)
EndIf
WEnd
The "Else" statement tells the bot to move if no box/resource is spotted. The "Sleep(2000)" is the timing between each click on the minimap. Make sure to have "1" beside MouseCoordMode, otherwise it may not work. In this line:
Code:
MouseMove(int(Random(1390,1580)), int(Random(805,915)), 0)
you must use your info window to find the coords of your minimap.
First find the minimum x coord of the minimap (the left side)
Then find the maximum x coord of the minimap (the right side)
Next find the minimum y coord of the minimap (the top)
Lastly, find the maximum y coord of the mimimap (the bottom)
Now that we have all those coords, plug them into this line of code:
Code:
MouseMove(int(Random([minimum x],[maximum x])), int(Random([minimum y],[maximum y])), 0)
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:
Code:
HotKeySet("{ESC}", "quit") ;ESC to quit
While 1
$Box = PixelSearch(80,85,1745,1050,0xFFFFDD)
If IsArray($Box) Then
MouseMove($Box[0],$Box[1],0)
MouseClick("left")
Sleep(1750)
Else
Opt("MouseCoordMode", 1)
MouseMove(int(Random(1390,1580)), int(Random(805,915)), 0)
MouseClick("left")
Sleep(2000)
EndIf
WEnd
Func quit()
Exit
EndFunc
Note: I added a hotkey (esc) to make the bot close itself out when you press it, that way you don't have to use task manager or anything like that
Bot with added pause feature (Special thanks to Fluttershy)
Code:
#RequireAdmin
Global $pause = False
ProcessSetPriority("script name.exe",4) ;enter your script name in order to work
HotKeySet("{ESC}", "_quit") ;ESC to quit
HotKeySet("{F1}", "_Pause") ;F1 to 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
Bot with other features (Timer, count of boxes collected, etc. Again, special thanks to Fluttershy)
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
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.
|
Hey there. First want to thank you all for such simple and clear tutorial.
I am one of those guys without any knowledge in coding and scripting but already understand how it works.
I understand that it might be a different system now, but i am curious if there's still somehow a way for the script to identify the colors of the pixels?
doing my practice on a clone DO server so i don't mess my DO acc and Au3Info doesn't seem to detect any of the colors for bonus boxes, cargoes, booties and even npc's, i know that it detects colors of bases, backgrounds even my ship.
So, is there any tricks i could do to fix that? or here's another question, would it be possible for the script to find objects by images instead of pixels?
I mean, let's just replace the phrase for PixelSearch with ImageSearch and everything else could remain the same, simple and clear.
Can that happen or i am just daydreaming?
|
|
|
10/09/2017, 03:56
|
#21
|
elite*gold: 138
Join Date: Apr 2012
Posts: 3,495
Received Thanks: 1,769
|
Quote:
Originally Posted by Michael_Mazepa
Hey there. First want to thank you all for such simple and clear tutorial.
I am one of those guys without any knowledge in coding and scripting but already understand how it works.
I understand that it might be a different system now, but i am curious if there's still somehow a way for the script to identify the colors of the pixels?
doing my practice on a clone DO server so i don't mess my DO acc and Au3Info doesn't seem to detect any of the colors for bonus boxes, cargoes, booties and even npc's, i know that it detects colors of bases, backgrounds even my ship.
So, is there any tricks i could do to fix that?
|
AutoIt does detect those pixels, but the problem is that the boxes in darkorbit are gif's, so they are constantly changing which is making it hard for pixel- or imagesearch to find them.
Quote:
Originally Posted by Michael_Mazepa
or here's another question, would it be possible for the script to find objects by images instead of pixels?
I mean, let's just replace the phrase for PixelSearch with ImageSearch and everything else could remain the same, simple and clear.
Can that happen or i am just daydreaming?
|
Yes, there is a function called ImageSearch. You can find plenty of tutorials how to use it by using google
|
|
|
10/09/2017, 05:55
|
#22
|
elite*gold: 0
Join Date: Feb 2013
Posts: 4
Received Thanks: 0
|
1st try
Quote:
Originally Posted by Moneypulation
AutoIt does detect those pixels, but the problem is that the boxes in darkorbit are gif's, so they are constantly changing which is making it hard for pixel- or imagesearch to find them.
Yes, there is a function called ImageSearch. You can find plenty of tutorials how to use it by using google
|
Hey Moneypopulation, seems like you would know if this is somewhere near right or not.
So i got an extra set of codes, a script which i am not sure how to include in the main script that everyone contributed to make.
Code:
#include <image_search.au3>
Func get_bonusbox_sign()
Local $sign[9]
$sign[0] = 3685189
$sign[1] = 1974825
$sign[2] = 397346
$sign[3] = 987953
$sign[4] = 16580556
$sign[5] = 13404266
$sign[6] = 15117442
$sign[7] = 11439477
$sign[8] = 14257235
return $sign
EndFunc
$img_pos = image_search(get_bonusbox_sign(),48,44)
if $img_pos[0] <> -1 then
MouseMove($img_pos[0],$img_pos[1])
endif
Could someone please help me understand the whole set and what else it needs or what it doesn't need and how eventually to run main script with this "function"?
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 " & [MENTION=3576271]CRLF[/MENTION] & "in ~ " & $Diff & " Seconds")
Exit
EndFunc
Func _Pause()
If $pause = True Then
$pause = False
ElseIf $pause = False Then
$pause = True
EndIf
EndFunc
+
Code:
#include <image_search.au3>
Func get_bonusbox_sign()
Local $sign[9]
$sign[0] = 3685189
$sign[1] = 1974825
$sign[2] = 397346
$sign[3] = 987953
$sign[4] = 16580556
$sign[5] = 13404266
$sign[6] = 15117442
$sign[7] = 11439477
$sign[8] = 14257235
return $sign
EndFunc
$img_pos = image_search(get_bonusbox_sign(),48,44)
if $img_pos[0] <> -1 then
MouseMove($img_pos[0],$img_pos[1])
endif
=
|
|
|
10/09/2017, 07:55
|
#23
|
elite*gold: 138
Join Date: Apr 2012
Posts: 3,495
Received Thanks: 1,769
|
Quote:
Originally Posted by Michael_Mazepa
Hey Moneypopulation, seems like you would know if this is somewhere near right or not.
So i got an extra set of codes, a script which i am not sure how to include in the main script that everyone contributed to make.
Code:
#include <image_search.au3>
Func get_bonusbox_sign()
Local $sign[9]
$sign[0] = 3685189
$sign[1] = 1974825
$sign[2] = 397346
$sign[3] = 987953
$sign[4] = 16580556
$sign[5] = 13404266
$sign[6] = 15117442
$sign[7] = 11439477
$sign[8] = 14257235
return $sign
EndFunc
$img_pos = image_search(get_bonusbox_sign(),48,44)
if $img_pos[0] <> -1 then
MouseMove($img_pos[0],$img_pos[1])
endif
Could someone please help me understand the whole set and what else it needs or what it doesn't need and how eventually to run main script with this "function"?
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 " & [MENTION=3576271]CRLF[/MENTION] & "in ~ " & $Diff & " Seconds")
Exit
EndFunc
Func _Pause()
If $pause = True Then
$pause = False
ElseIf $pause = False Then
$pause = True
EndIf
EndFunc
+
Code:
#include <image_search.au3>
Func get_bonusbox_sign()
Local $sign[9]
$sign[0] = 3685189
$sign[1] = 1974825
$sign[2] = 397346
$sign[3] = 987953
$sign[4] = 16580556
$sign[5] = 13404266
$sign[6] = 15117442
$sign[7] = 11439477
$sign[8] = 14257235
return $sign
EndFunc
$img_pos = image_search(get_bonusbox_sign(),48,44)
if $img_pos[0] <> -1 then
MouseMove($img_pos[0],$img_pos[1])
endif
=
|
I don't even know what that first script is. Read this
If you still have any questions regarding this, you should post them here:
But without any coding knowledge, you won't come far by just copy pasting scripts from other people
|
|
|
11/11/2020, 00:59
|
#24
|
elite*gold: 0
Join Date: Jan 2015
Posts: 1
Received Thanks: 0
|
Sorry but i idid it but it minimalize my game and clicking on my screen ? any bug ?
|
|
|
|
|
Similar Threads
|
[TUT] How to write your own Pixelbot [AutoIT]
06/22/2017 - Coding Tutorials - 37 Replies
At first you need to find the right pixel colour...
We will do it with the AutoIT Tool:
AutoIT Window Info
http://picpanda.com/images/xk1z5i2yeot12mc1zn2_th umb.png
When we found the pixel we need to add that your ship moves:
|
Autoit Pixelbot für Browsergame
12/05/2012 - AutoIt - 5 Replies
Hy leute suche ein paar leute die lust und laune
haben mit mir einen Pixelbot für das Spiel Darkorbit zu machen.
Was ihr können müsst:
ihr solltet etwas erfahrung haben
|
AutoIT PixelBot Hilfe
03/01/2010 - AutoIt - 3 Replies
Hey ich hätte mal ein paar Fragen...
Also wie ja oben steht brauche ich Hilfe bei einem PixelBot zum Farmen.
Der Bot soll davon unterscheiden können ob er einen Mob anvisiert hat oder nicht.
Das funktioniert bei meinem Bot folgendermaßen:
Er Scannt oben die Farbe von der HP Leiste des Monsters (Rot),wenn diese vorhaden ist dann fängt er an die Skills auszuführen und zu looten.
Wenn sie nicht vorhaden ist drückt er einfach TAB um ein Mob anzuvisieren...und...danach...naja passiert gar...
|
All times are GMT +1. The time now is 11:06.
|
|