Destiny Bot 1.0

Few days back, I was learning and working on a game Bot for Destiny Online Legend of the Golden Plumes. It was rather an interesting adventure to create this bot. Lots of stuff need to be considered especially for a newbie like me.

Hop on to the bot itself as we are not wasting our time on talking some unuseful stuff for the bot. To create a game bot what you need the most is a code writer and a code runner (script runner). Among the most advance method is by using C++ but  for a beginner, you can start by using Autoit and in this article, I consider that you’ve at least know something about autoit and anything that it need to create the bot.

After installing all the Autoit stuff and considering you already read what it need from the Autoit website itself, we go directly to the code.

In this code, the one and foremost important thing is to know the name of the Destiny Online window that you open. So you have this code for it;

WinWaitActive(“xxx”) ;The script waits for the window named “xxx” to become active.

Where this means the script wait for the window named xxx to active then only it will continue to run the other command inside the script. So remember to change the “xxx” value into the “Destiny Online Window Name”.

So for this script I set

$win = “xxx”

Since I will use the control function which I will tell you later on the $win variable is rather useful as to avoid mistake from writing the long window name. The xxx value should be the window name.

$k = 1
Do
_monstersearch()

until $k = 2 ;Loop Repeated non stop since $k is always 1. So you need to press End key to stop the script

So this will be the main function of the script that will run first. Since I want the bot to run over and over, I set variable $k into 1 and run the Do loop until $k = 2. Remember that since I did not put any function such as $k = $k + 1 inside the loop, so it will run over and over non stop. So if anything happen, the “END” key is always there.

So from the simple non stop repeating main function above, we proceed to the hard thing (sub function), it is slightly hard but you will understand later. Here the whole thing related to the _monstersearch() function;

Func _monstersearch()

$w = 1
Do
Send(“{Tab}”) ;Select Nearest Monster
Sleep(500)
If PixelGetColor(461,39) = 0x397594 Then ;If the monster is selected then attack
Do
ControlSend($win ,”” ,”” ,”2″)  ;send key 2 for the 2nd Skill
Sleep(2000) ;stop for 1 sec
ControlSend($win ,”” ,”” ,”1″) ;send key 1 for the 1st Skill
Sleep(1000) ;stop for 1 sec
If PixelGetColor(107,62) <> 0xFF7531 Then ;Look if HP is less than specified (Only Instant HP should be used)
ControlSend($win ,”” ,”” ,”9″) ;Press 9 for + instant HP

EndIf

If PixelGetColor(68,74) <> 0x1069FF Then ;Look if MP less than specified (Only Instant MP should be used)
ControlSend($win ,”” ,”” ,”0″) ;Press 0 for + instant MP
EndIf
Until PixelGetColor(461,39) <> 0x397594 ;Keep repeating until the selected monster died
ControlSend($win ,”” ,”” ,”{Space}”) ;Loot item
ControlSend($win ,”” ,”” ,”8″) ;Training Scroll

Else
;Random Move Start
$LowerLimit = 60
$UpperLimit =740
$randomx = Random($LowerLimit,$UpperLimit,1)
$lowery = 112
$uppery = 550
$randomy = Random($lowery,$uppery,1)
ControlClick($win ,”” ,”” ,”Left”, 1, $randomx, $randomy)
Sleep(2000)
$w = 2
EndIf
Until $w = 2
EndFunc

Same as above this _monstersearch function i keep it looping, it could run as the main function directly but for the mean time I make it as a sub function so that anything, i could add around it.

Send(“{Tab}”) ;Select Nearest Monster
Sleep(500)
If PixelGetColor(x,y) = 0x397594 Then ;If the monster is selected then attack

Above, for the _monstersearch function, I added the button Tab so that I could detect the monster on the Destiny online screen. If you notice, everytime you press tab, there will be a selected monster and if you press tab again, it will change to the other nearby monster. So for the beginning, I need to put the tab as for selecting the monster. Since, I quite to change my script as to use the PixelSearch function (quite complicated in the beginning and makes things easier if you understand), I use the PixelGetColor function. The coordinate you need to change to the location of the monster health on the top screen. You can use Autoit Window Info (AWI) to change this. Then also change the 0x397594 to the respected colour number that you get from the AWI. Using AWI is rather complicated to teach but it is actually easy to use. My tips is; >>Options>>Freeze then drag the finder tool on the stuff that you want to know the position and color.

That do the trick for selecting monster Then;

Do
ControlSend($win ,”” ,”” ,”2″)  ;send key 2 for the 2nd Skill
Sleep(2000) ;stop for 1 sec
ControlSend($win ,”” ,”” ,”1″) ;send key 1 for the 1st Skill
Sleep(1000) ;stop for 1 sec

You need to start a loop for Attacking the monster. In this case I always use skill to kill monster and I put it in hotkey 1 and 2. Wondering why I put 2 and 1 first? Remember there is some skill which when activated will make your character keep on attacking the monster. So the skill 2 is the skill that when activated did not keep attacking monster but the skill 1 is the one that keep on attacking it until it dies. By the way you can reduce the skill above or add it to your needs.

If PixelGetColor(x,y) <> 0xFF7531 Then ;Look if HP is less than specified (Only Instant HP should be used)
ControlSend($win ,”” ,”” ,”9″) ;Press 9 for + instant HP

EndIf

If PixelGetColor(x,y) <> 0x1069FF Then ;Look if MP less than specified (Only Instant MP should be used)
ControlSend($win ,”” ,”” ,”0″) ;Press 0 for + instant MP
EndIf

Then After attacking monster, you need to check on your HP and MP. So you need to put IF condition above. I’m not sure if you can put both HP and MP check together but I prefer having separate condition which will be done after the first one done. In this case, you need to use AWI to find the HP and MP coordinate. Remember to have your HP and MP full for this as to get the color of your HP and MP at full. If I not wrong, I set the HP to use the +500 HP instantly so, you can set it around the value of 1600 if your HP is 2200. And since my MP is low and the instan MP refill is +600, I set my MP near to the finishing of MP. Adjust using AWI following your needs. Remember just use instant HP and MP refill as I make it not works for the slow recovery since using that, it is more complicated to write.

So as to end the attacking loop (Remember there is 2 loop for _monstersearch() function), we need to put condition on the second do loop;

Until PixelGetColor(x,y) <> 0x397594 ;Keep repeating until the selected monster died
ControlSend($win ,”” ,”” ,”{Space}”) ;Loot item
ControlSend($win ,”” ,”” ,”8″) ;Training Scroll

The function above will be the closing of the Loop on the attacking part. Since we are repeating the skill attack, we need to put an end to the attacking by detecting whether there is selected monster on the top of the Destiny online window or not. Then after detecting (The x and y and also the  color value should be same as the first “If PixelGetColor” function above) we send Space key as to loot any monster drop and also click 8 since the Training scroll is there.

That is the finish of the first part of _monstersearch function. The second part is when the condition “If PixelGetColor(461,39) = 0x397594” is not met;

Else
;Random Move Start
$LowerLimit = 60
$UpperLimit =740
$randomx = Random($LowerLimit,$UpperLimit,1)
$lowery = 112
$uppery = 550
$randomy = Random($lowery,$uppery,1)
ControlClick($win ,”” ,”” ,”Left”, 1, $randomx, $randomy)
Sleep(2000)
$w = 2
EndIf
Until $w = 2
EndFunc

This is the Else function if the If function is not met, where when the script press tab, there is no pixel was found. The else function is the function to move to a different location. It is random so you could see sometimes your character will be running around aimlessly. Above you can see I set up the upper and lower limit for coordinate x and y, so remember the school graph, x upper is the highest or the rigthest part if the Destiny Online window while the  x lower is to the leftest or lowest part of the window. And this is same goes to the y axis. As  I play in window mode, so the upper and lower limit is not big. Remember to do the upper and lower limit, it does not include any part or button inside the window. Else you are not clicking on the ground. To make things simple, imagine a limit of a Square that only on the ground(I put my chat box to the outer side XD).

This else part will close the If function and also will bring the $w = 2 which will end the _monstersearch loop. So finish with the hard thing, then will go to the final thing. A flower from all the hardwork above (edit to your needs);

; Destiny Bot 1.0
; By Shally Martin
; Http://www.hotonblog.com

;Use at your Own Risk ~ Please change the value as what explained

HotKeySet(“{END}”, “close”) ;So that we can press “END” to stop the script in case something goes wrong. ALWAYS do this!

WinWaitActive(“xxx”) ;The script waits for the window named “xxx” to become active.

$win = “xxx”

$k = 1
Do
_monstersearch()

until $k = 2 ;Loop Repeated non stop since $k is always 1. So you need to press End key to stop the script

Func _monstersearch()

$w = 1
Do
Send(“{Tab}”) ;Select Nearest Monster
Sleep(500)
If PixelGetColor(461,39) = 0x397594 Then ;If the monster is selected then attack
Do
ControlSend($win ,”” ,”” ,”3″)  ;send key 2 for the 2nd Skill
Sleep(2000) ;stop for 1 sec
ControlSend($win ,”” ,”” ,”2″) ;send key 1 for the 1st Skill
Sleep(1000) ;stop for 1 sec
If PixelGetColor(107,62) <> 0xFF7531 Then ;Look if HP is less than specified (Only Instant HP should be used)
ControlSend($win ,”” ,”” ,”9″) ;Press 9 for + instant HP

EndIf

If PixelGetColor(68,74) <> 0x1069FF Then ;Look if MP less than specified (Only Instant MP should be used)
ControlSend($win ,”” ,”” ,”0″) ;Press 0 for + instant MP
EndIf
Until PixelGetColor(461,39) <> 0x397594 ;Keep repeating until the selected monster died
ControlSend($win ,”” ,”” ,”{Space}”) ;Loot item
ControlSend($win ,”” ,”” ,”8″) ;Training Scroll

Else
;Random Move Start
$LowerLimit = 60
$UpperLimit =740
$randomx = Random($LowerLimit,$UpperLimit,1)
$lowery = 112
$uppery = 550
$randomy = Random($lowery,$uppery,1)
ControlClick($win ,”” ,”” ,”Left”, 1, $randomx, $randomy)
Sleep(2000)
$w = 2
EndIf
Until $w = 2
EndFunc

Func close() ;This is a function and doesn’t actually run unless you tell it to. For example
Exit
EndFunc

Something from me;

  1. This script is tested only for warrior and it is run with success, so since you have learn a lot from the AutoIt, adjust to your needs.
  2. Using this is illegal in game, so use it at your own risk.
  3. I’m sharing this as a word of knowledge so I bear no responsibility to what happen to you
  4. You can do whatever to the script, but please keep some part of my signature.

So enjoy using it, remember to change some of the stuff to make it works. There is still some bug inside but there is 1 bug that I wish not to fix since Destiny Online make it purposely to detect people using Bot other than their bot. I kind of getting the idea on how to fix it, but I was thinking of the risk I get of fixing that.

One last thing, it only works when you make the Destiny Online window on top of all windows. This means you can’t use other program while the bot is on. And always press End key to end the bot.

11 Replies to “Destiny Bot 1.0”

  1. yeah i dd solve it now, but it wont attack maybe have trouble in PIXELGETCOLOR…
    i did change the control send which is “1? >> unterminated string
    i change it to ControlSend($win, “”, “”, “{1}”) it works..
    it when works when i inserted this after the
    ControlSend($win, “”, “”, “{Tab}”)==which is for searching
    i really need to get the exact PIXEL color.. or can you post a downloadlink of some finished AUTOIT file, which contains the BOt for DEstiny Online?, i wll just edit the WinwaitActive which is very important to function.. Tnx in advance paL…

  2. I don’t seem to see the unterminated string. Btw, the code I put here is the one which I normally use. the ControlSend will be able to work like this too ControlSend($win, “”, “”, “1”) with out the {} symbol. If it appears that there is no closing ” then you have to put it there. Sorry for the badly written script XD.

  3. Maybe you can post your code.. does you paste all of it there or you got change something? I’ll be opening forum soon so that i can support it more..

  4. what code will i use to loot a specific item? and shally, when will u open a forum>? I can;t wait and discuss things with u and learn something new

Leave a Reply

Your email address will not be published. Required fields are marked *