Installing BeBot 0.6

This installation documentation is a work-in-progress. All contributors are welcome to fix things as they find them.

TO DO:

  • Write up installation instructions for PHP/MySQL on Unix/Linux

This bot works for both, Anarchy Online (AO) and Age of Conan (AoC). Some settings and modules only make sense for AO and some make only sense for AoC. Whenever something is only applicable for one of the games, it is marked as “AO only” or “AoC only”.

Prerequisites (What do you need?)

To install and run BeBot you need the following:

  • Anarchy Online (free or paid) or Age of Conan
  • PHP version >= 5.2 (PHP 5.3 is highly recommended)
  • MySQL database server version >= 4.1.1
  • The BeBot files

Optional (helps run it effectively):

  • An “always-on” internet connection
  • A dedicated machine to run the bot

Create a player

A bot is basically a regular player character so you'll need to start AO/AoC and create a character on the appropriate dimension/server. The breed, gender, and profession (AO only) or the class and race (AoC only) is irrelevant for the function of the bot. The name of the character will be the name of the bot. You can use an already existing player.

Notes for guild-style bot

A guild bot needs to be a member of the guild it is to be a bot for. For AO this means that it needs to have the same faction as the guild.

Notes on towers (AO only)

For tower wars to work as intended the bot needs to be in the top three ranks of an org. This is because the [ALL TOWERS] channel is restricted to these ranks.

Install the bot files

To install the bot simply unzip the files to a directory maintaining the directory structure.

Important: if you are running on Windows Vista or Windows 7 you must NOT install the bot anywhere below C:\Program Files\ as the operating system will interfere with the normal operation of the bot.

Install PHP on Windows

We highly recommend installing the parts of PHP you really need instead of a full PHP install. First obtain the latest stable release of PHP from http://windows.php.net/download/ At the time of writing this, you want the VC9 x86 Non Thread Safe version packaged as a zip archive.

From this archive you want to copy the following files into your BeBot directory:

  • libeay32.dll
  • php.exe
  • php5.dll (If you have a php5ts.dll instead you have the thread safe binaries)
  • ssleay32.dll

Then you want to create a folder in your BeBot directory named: phpext In this directory copy the following files from the PHP archive ext/ folder:

  • php_curl.dll
  • php_mbstring.dll
  • php_mysql.dll
  • php_sockets.dll

The last thing we need now is a php.ini file containing some PHP settings. You can use the following php.ini as a starting point:

;;;;;;;;;;;;;;;;;
; BeBot php.ini ;
;;;;;;;;;;;;;;;;;
 
; BeBot should normally stay way below this limit
memory_limit = 30M
 
; The following settings control what warnings and errors PHP will output.
; Please note that BeBot 0.6 still outputs a lot of notices and warnings that can be safely ignored.
;
; Error Level Constants:
; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR           - fatal run-time errors
; E_RECOVERABLE_ERROR  - almost fatal run-time errors
; E_WARNING         - run-time warnings (non-fatal errors)
; E_PARSE           - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to an
;                     empty string)
; E_STRICT          - run-time notices, enable to have PHP suggest changes
;                     to your code which will ensure the best interoperability
;                     and forward compatibility of your code
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                     initial startup
; E_COMPILE_ERROR   - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE     - user-generated notice message
; E_DEPRECATED      - warn about code that will not work in future versions
;                     of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
error_reporting = E_ALL & ~E_NOTICE
 
display_errors = On
log_errors = On
error_log = log/php_errors.log
 
; This is where PHP can find the PHP extensions like sockets and mysql.
extension_dir = "phpext"

Configuring the bot

StartBot.php

Open the file StartBot.php which is located in the install directory in a text editor. Here you need to set the $php_bin to the path and name of your php executable.

If you start the bot from the same directory as the binary php file (for windows “php.exe”) you can just enter the name. Otherwise you'll have to enter the name and path of the binary executable (ie C:/Program files/PHP/php.exe or C:\\Programfiles\\PHP\\php.exe or /usr/local/bin/php5). Note that you can use forward slashes (recommended) or double backslashes (not recommended) on windows systems. Using single backslashes WILL NOT WORK as php interpets \ as a special escape character.

Set $main_php to the location of the “Main.php” file. Once again you can just enter “Main.php” if you're starting the bot from the directory its in.

If StartBot.php is in another directory than the bot itself (not recommended) you must specify the complete path to Main.php.

conf/Bot.conf

Open the file Bot.conf, which is in the conf directory where you installed the bot, in a text editor. Here you will have to enter the AO/AoC username, password, and the name of the bot along with the dimension number (AO only) or server name (AoC only) you would like to run it on.

$owner is the super-duper admin of the bot. This user has got all rights. This should be the name of the character, which you intend to configure the bot with, as some settings require you to be owner in order to change.

Below that is the configuration lines for your super admins. You can add as many superadmins as you like. Just copy and past that line and exchange the name. These names cannot be downgraded in-game so it is recommended that you hard-code as few super admins here as possible. Instead of putting the names in here we recommend using the !adduser <username> SUPERADMIN in-game to add superadmins.

The next section works just like the superadmins. You can tell the bot what other bots it may encounter in the guild. This is so that the bot just ignores tells and messages from the other bot and doesn't end up in a spam war with it.

For setting up the guild bot section please see bottom of this section.

To switch logging off set “$log” to “off”. You can also set it to “chat” which will only log incoming and outgoing messages. If set to “all” everything displayed on the console will be put into the log. The default is “chat”. Set “$log_path” to the place where you want logs to be saved.

With “$command_prefix” you can determine what symbol commands start with. The default here is “!”. Note that you need to use the regex string here. This means that to use “.” as your command prefix you need to enter “\.” because “.” has got a special meaning in regular expressions. This goes for a lot of other characters as well.

The last 4 values are probably best left at default.

Guild bot

To make a guild bot set “$guildbot” to true. Change “$guild_name” to the exact name of your guild.

AO only: Set “$guild_id” to the id of your guild. The easiest way to find out the guild ID is going to http://www.anarchy-online.com/content/community/people/ and finding your guild. The URL will now read something like this: “http://www.anarchy-online.com/org/stats/d/1/name/xxxxxx” where the “xxxxxx” would be your guild ID.

To relay chat to another guild bot you want to set $guild_relay_target = “Name_of_other_guildbot”; If you do not want this feature set $guild_relay_target = False; (note: False, not “False”. If you use quotes your bot will attempt to relay to the player named 'False')

Raid bot

To make a raid bot set “$guildbot” to false and leave “$guild_name” blank. Set “$guild_id” to 0. For a raid bot you most likely want to set $guild_relay_target = false; (note: false, not “false”)

conf/MySQL.conf

Set the MySQL username, password, server IP adress or server host name and database name for the bot (see below).

Starting the bot

  • Open a console (In windows press “Start” ⇒ “Run” ⇒ enter “cmd” and press enter).
  • Now run the start.php
  • Windows: Navigate to the directory of your bot assuming you have the php.exe in the same directory and write “php start.php”.
  • Linux: Assuming your can run php5 from anywhere navigate to your bot directory and write “php5 start.php” (assuming your php binary is named “php5”).

The console should now state that the bot is loading the modules, authenticating and connecting. Once this is done (AoC only: wait 5 minutes now) you can log onto an character in-game which you have configured as “superadmin”. You should now be able to talk to the bot.

Playing while running the bot (AO only)

You can run the bot and play AoC from the same account (with different characters).

Playing while running the bot (AoC only)

You can run the bot and play AoC from the same account (with different characters). However the bot must connect first and you have to wait at least 5 minutes after logging the bot in, before you can connect with your client. If the bot (re)connects while you are logged in, you get disconnected.

In-game setup

There is a settings module to handle configuration of most aspects and many modules for BeBot. Most notable is the Security module. To start configuring it send a tell to your bot with “!settings security”. For a list of modules whose settings are configurable by the new interface send a tell to your bot with “!settings”.

Adding and Removing Modules

If you do not wish for certain modules to be used by a bot just put an underscore (“_”) at the front of the name in the “modules” directory. There are several files already in the distribution that have been commented out in this way: Most notable is _ExampleModule.php which is a template to make your own modules.

Installing 3rd party modules

We recommend you put any 3rd party modules into the directory named custom instead of putting it directly into the modules or core directories. This is because if a 3rd party module has got the same name as a standard module or a module with that name is added later it will be over-written if you upgrade the bot. Modules in the 'custom' directory are never touched by installing upgrades to BeBot.

Installing MySQL on windows

First, you'll need MySQL. Download the Windows Essentials package from MySQL.com. This is a MSI based installer. If it doesn't work for you, go to Microsoft Update to install the latest Windows Installer.

The installer is simple.

Phase 1: MySQL Installer

  1. Click Next.
  2. Select Typical, Click Next.
  3. Click Install.
  4. Select Skip Sign-Up, Click Next.
  5. Check Configure MySQL Server Now, Click Finish.

Now you should be in the MySQL Server Instance Configuration Wizzard.

Phase 2: MySQL Server Instance Configuration Wizzard

  1. Click Next.
  2. Select Detailed Configuration, Click Next.
  3. Select Developer Machine, Click Next.
  4. Select Multifunctional Database, Click Next.
  5. Select C: and Installation Path, Click Next.
  6. Select Decision Support, Click Next.
  7. Check Enable TCP/IP Networking and Enable Strict Mode, Click Next.
  8. Select Standard Character Set, Click Next.
  9. Check Install As Windows Servers, Check Launch the MySQL Server automatically, Check Include Bin Directory in Windows PATH, Click Next.
  10. Enter and confim your root password. Write down your root password and do not loose it!!! Do not check Enable root access from remote machines. Click Next.
  11. Click Execute.
  12. Click Finish. Reboot your computer.

At this point, you have MySQL installed and configured, but you haven't yet created a MySQL database.

Phase 3: Logging into MySQL

  1. Open a command prompt. (Start > Run > CMD, Click OK)
  2. In the command prompt, enter the command mysql -u root -p
  3. Enter your root password (You did write it down so you wouldn't forget it right?)

You should now have a MySQL prompt that looks like: mysql>

Phase 4: Create a Database and Database User for BeBot

  1. Type CREATE DATABASE databasename CHARACTER SET latin1; (replace databasename with the name of the database you wish to create)
  2. Press Enter/Return.
  3. CREATE USER [email protected]; (Change username to the username you want, keep @localhost)
  4. Press Enter/Return.
  5. SET PASSWORD FOR [email protected] = PASSWORD('newpassword'); (Change username and newpassword to your selected username and password, again keep @localhost)
  6. Press Enter/Return.
  7. Type GRANT ALL on databasename.* TO [email protected]; (Again, change username, keep @localhost)
  8. Press Enter/Return.
  9. Type quit then Enter/Return to exit the MySQL Monitor.

Phase 5: Configure BeBot

  1. Edit MySQL.conf, add the values you selected.
  $dbase = "databasename";
  $user = "username";
  $pass = "newpassword";
  $server = "localhost";

That's it, you should now be able to start the bot provided PHP is set up correctly.

Backing Up and Restoring your Database

It's reccomended that you backup your database. If the worst happens, you can easily recover. And the command to do so is simple:

  mysqldump -u username -p --databases databasename --add-drop-table -a -f  > filename.sql

Restoring a database fom a backup

To restor the database from a previously made backup:

  mysql -u username -p databasename < filename.sql

IMPORTANT: All changes made to the guild and bot after the backup WILL BE OVERWRITTEN!

 
installation.txt · Last modified: 2013/09/12 22:49 (external edit)
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
WikiForumIRCBugs
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki