1. Programming an Ares Bot / Client
  2.  
  3. Note: This tutorial will refer to making a bot using REALbasic ( http://www.realsoftware.com ).
  4. You will also to need to download WPE Pro 0.9a for packet sniffing Ares.
  5.  
  6. Step One: Startinf Out
  7. Start out by getting WPE ready to sniff Ares. When ready and Ares is open,chosse the name of your bot by the user name you would use in Ares, then start WPE then join a chatroom in Ares (anyone will work). When you have joined and recieved the motd text then stop WPE. Go back and Look at the text in WPE. What you are looking for is a packet that conyains your user-name (if non unicode it will appear) and the text Ares 1.8.12947. This is the connection packet. When you think you have got the packet, save it as a text file with IP's shown.
  8.  
  9. Step Two: The Protocol
  10. Open REALbasic 5.5. Now add a socket control to the window. By default it will be a TCPSocket (TCPSocket1). Leave it as a TCPSocket you need it! Double-click the socket control in window1 (your default project window), now in the Connected Event you will need to place the hex code from the packet. Open Notepad and find the packet we need. There is a line at the top of the packet that has the sending and receiving IP addreses, ignore that you don't need it. Now there is a set of four numbers at the beginning of every line in the packet, delete them all, they are nothing more than a counter for the packet sniffer. Now you will see some text and charaters at the right of the packet, delete those as well. Now all you should have left is the raw hex. Something like this:
  11.  
  12. 50 00 02 61 01 2A B7 47 2B 41 4A 86 EB 29 3E 3B
  13. 65 4C C0 00 00 00 43 2D 45 D1 86 DD B1 6F A8 61
  14. 00 00 5B C5 A6 CE 9E 5D C4 B6 C5 97 C5 B7 CF 81
  15. C5 A3 C4 B1 C3 A7 00 41 72 65 73 20 31 2E 38 2E
  16. 31 2E 32 39 34 37 00 42 BC 1B C2 42 BC 1B C2 01
  17.  
  18. Now reformat the hex code in this way:
  19.  
  20. chr(&h50)+chr(&h00)+chr(&h02)+chr(&h61)+chr(&h01)+chr(&h2A)+chr(&hB7)+chr(&h47)+chr(&h2B)+chr(&h41)+chr(&h4A)
  21.  
  22. And so on till you have the entire packet coded in this format. The whole packet must be in ONE line of code so if you format this way in Notepad first then turn off the word wrap so you make no mistakes.
  23.  
  24. Step Three: Writing The Connection
  25. Now that that everything is fromatted correctly we can move on to writing the code for the connection. Double click on TCPSocket1 and you will then be in the Connected Event of the socket. Now write this code:
  26.  
  27. TCPSocket1.write (your hex code here)
  28.  
  29. Example:
  30.  
  31. TCPSocket1.write chr(&h50)+chr(&h00)+chr(&h02)+chr(&h61)+chr(&h01)+chr(&h2A)+chr(&hB7)
  32.  
  33. That is all you need for the bot/client to connect to Ares and display your chosen name.
  34.  
  35. Step Four: Design The Interface
  36. A few things will need to be added to make your bot/client work correctly. Here is a list of controls that need to be added to Window1:
  37.  
  38. 1. 3 - EditFeilds
  39. 2. 2 - PushButtons
  40. 3. 1 - CheckBox
  41.  
  42. Arrange them like the following example or something similar to it:
  43.  
  44.  
  45.  
  46.  
  47.  
  48. Now click once on Pushbutton1. Now in the properties to the right of window1, go to Caption and type in Connect. Now do the same for Pushbutton2 but anme this one disconnect.
  49.  
  50. Step Five: More Code
  51. Double-click on Pushbutton1. You will, by default, be in the Action Event of Pushbutton1. Now place the following code there:
  52.  
  53. TCPSocket1.Address = Editfield1.text
  54. TCPSocket1.Port = val(editfield2.text)
  55. TCPSocket1.connect
  56.  
  57. That just enabled Pushbutton1 to connect using Editfield1 for the IP address ad Editfield2 for the port and then connects. Now double click on Pushbutton2. And in it's Action Event place the following code:
  58.  
  59. TCPSocket.disconnect
  60.  
  61. When you want to close your bot/client this wil disconnect it.
  62.  
  63. Step Six: Sending Text
  64. Double-click on Editfield3. You will, by default in the Key Down Event. Place the following code:
  65.  
  66. if key = chr(13) OR key = chr(3) then //Means both enter keyson your keyboard.
  67. if me.text = "" then //if the editfield is empty it will not send anything
  68. return true
  69. end
  70. Sock.write Chr(lenB(Editfield3.text))+chr(&h00)+chr(&h0A)+Editfield3.text
  71. me.text = "" //this causes the editfield to clear the text after sending
  72. return true
  73. end
  74.  
  75. That is pretty much it. Your bot.client will now connect to Ares and send text.
  76.