Skip to content
csprajeeth edited this page Jul 31, 2013 · 55 revisions

githalytics.com alpha BOT FORUMS

There have been attempts at making a bot for RK/NK in the past. Here is one guy who tried to do it. However it was never complete and didn't even come close to working....

Conqueror is currently the only bot that EXISTS and WORKS for native kingdoms. This is not some cheap script that does a bunch of clicks on your browser. This is a bot that runs from the command line without your intervention (apart from setting it up) and without getting in your way plays the game. There is another parallel bot much like this one being developed by me for renaissance kingdoms too. It's more or less the same as this one but with minor differences.

Features of the bot

Use game items

  • Can use food, tools
  • Can equip weapons

Buy and sell items

  • Can buy items from the market. Specify item name and quantity. Specify price in one of the 3 ways:
    • A specific price like 15.00 in which case the bot buys the item for that price
    • A range of price like (4.0, 4.5) in which case the bot buys the item if its in that price range
    • Don't specify any price in which case the bot buys for the least price.
  • Other features of buying from the market that the bot has is retries if item got purchased off by someone with higher charisma. Waits for the item purchased to be in your inventory (markets reset once every 10 mins).
  • Can sell items on the market. Specify item to sell and price.

Consume food

  • It consumes food by minimizing costs. You just supply a list of food items to consider consuming along with an optional maximum price of that food (per item). It then eats minimal costing food to satisfy your character's hunger by examining the market prices and the food already available in your inventory.
  • You can also prioritize eating certain food items which can be used for raising stats. Ex: Priotize eating meat to raise the character's strength.
  • Can be configured to eat in 1-2-1-2 fashion to save money.

Perform Activites

  • Mining: Can set the duration of the mining and optionally tell which mine to work in.
  • IMW: Working for IMW is also supported with the option of setting the duration.
  • Field jobs: Can apply for player posted jobs on the townhall. By default it selects the maximum wage job it is eligible for.
  • Resource: Can work in clan's resources. All the 3 resources (lake/orchard/forest) are supported. It selects the spot with the highest yield depending on the character's traits (int, str, whether he has the tool or not). Optionally you can set whether the bot can buy the tool automatically if the character doesn't have or if the tool gets broken.
  • Herb picking: Can pick herbs with option to set duration.
  • Search for rare material: Can look for rare material on the node.
  • Church: Can work in the church.
  • Militia job: Can apply for militia jobs (if the character is level 1 and above).
  • Retreat: Can put the character into retreat.

Travel

  • Yes. The bot can also travel from one clan to another. You just specify your destination and it will figure out the path that takes the least time to reach that destination. The destination can be the name of another clan or a node number (for those planning to rob).
  • You can also tell the bot to avoid traveling to certain nodes (in case you know that the nodes have robbers or a hostile army).
  • There is also support for noble traveling (3 nodes). If you are a noble then you don't have to worry. The bot will cover 3 nodes for you.
  • Turn is not wasted if the character is overloaded.

Field Management

  • Can post field jobs (hire other players to work on your fields). The bot knows when to hire and has internal values for stats and wages depending on the field. All you need to do is - char.field1.manage() (and char.field2.manage())
  • Currently supported fields are Beans, Maize, Vegetables, Agaves and Hibiscus.

Studying at the University

  • Can attend classes at the university. Specify a list of subjects to study and the bot will do the rest.

Other features

  • Can play the mentor tutorial for level 0 characters.
  • Automatically resurrects the character if he dies.
  • Pauses if server is under maintainance
  • Can display the character's mails.

Logging

  • All the major activities that the bot does can be logged in a log file (that is created when you run the bot) or on the screen. You can easily verify what your character is doing at any point.

How to use this thing [Windows]

  • First of all install python 2.7 for your platform.

  • We need to install easy_install . Right click and choose "save link as" distribute_setup.py. Double click to run it. It will now be easier to install additional python modules.

  • We need the beautiful soup module. Open command line (Press win+r. Type cmd and press enter). Type easy_install beautifulsoup4 and press enter. Beautiful soup will be installed.

  • Download the source code of the bot. Extract the folder.

  • The bot is written in the python programming language. Go through the source files and see which functions do what (see the comments). Then write your own script that tells overall what the bot must do.

Example script to farm as much money as you can:

import sys
import urllib2
import cookielib
import activity

from character import Character
from diet import MinCostDiet
from gameplay import min_eat

cj = cookielib.CookieJar()
br = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
username = "your-username"
password = "your-password"
char = Character(username, password, br, sys.stdout) 

while True:
    activity.work_in_mine(char, duration=1) #work in the mine for 1 hour
    diet = MinCostDiet(char, food = ["beans", "tortilla", ("meat",20), ("fish",19), ("vegetable",11)]) #price of meat, fish and vege should not exceed 20,19 and 11 per item respectively
    min_eat(char, diet) #eat food in 1-2-1 fashion
    char.sleep_till_next_event() #wake up when your activity is over
  • Use IDLE(Python GUI) that got installed when you installed Python2.7. File->New Window. Paste the script. Change username and password in the script to your nativekingdoms username and password. Save your script (say script.py) and put it in the folder where the sources are.

  • Run the script it !

    • You can run the script from the command line (path-to-source-folder> python script.py)
    • Or Double click to run

You can put the script on startup so that every time you switch on your computer the bot automatically starts. In the above script the character will keep on working in mine for a duration of 1 hour and eats minimal food if he/she is hungry.

There is much more you can do. Just explore the sources.

The Future ?

  • Support for forming and joining groups - base for forming armies and group robbing
  • Support ranches in field management.

Developers please contribute in the form of pull requests or on the forums.