Links
  • Home - AI SCripters homepage
  • Reference - AI Scripters reference library
  • Forums - discussion forums for all aspects of AI Scripting.
  • Tournaments - Tournament news

Parameters
xxxxxxxxxxxxxxxxx

Parameter

Std AI uses

Description

<age>

y

one of the following: dark-age feudal-age castle-age imperial-age starting age facts also use: post-imperial-age

<building>

y

see separate table for details.

<civ>

y

> is one of the following: gaia aztec briton byzantine celtic chinese frankish gothic hun japanese korean mayan mongol persian saracen spanish teutonic turkish viking

<commodity>

y

is one of the following: food stone wood

<difficulty>

y

one of the following: easiest easy moderate hard hardest The ordering of difficulty settings is the opposite of what one would expect! Make sure that this is taken in account when using facts to compare difficulties. easiest > easy > moderate > hard > hardest

<difficulty-parameter>

y

one of the following: ability-to-dodge-missiles ability-to-maintain-distance Description: ability-to-dodge-missiles Chance of a computer player’s unit dodging a missile. Valid range 0-100. Default value is 100. ability-to-maintain-distance Chance that a computer player’s ranged unit will maintain the distance. Valid range 0-100. Default value is 100. Note that 100 =ability fully off, 0 = ability fully on.

<diplomatic-stance>

y

one of the following: ally neutral enemy

<event-id>

 

a valid event id. Event ids have a range that depends on the event type. For trigger events the id is in the range from 0 to 255.

<event-type>

 

one of the following: trigger

<game-type>

 

Undocumented. No system defined names exist for it, but their number values do work. 0 = random, 1 = regicide, 2 = death match, 3 = scenario, 5 = king of the hill, 6 = wonder race, 7 = defend the wonder, 8 = turbo random (no system symbols exists for this - this is the only way to detect this new game type). Note that custom will be from 0 to 8 depending on what the source of the map / game was.

<goal-id>

y

is a valid goal id. Goal ids have a range from 1 to 40.

<map-size>

 

one of the following: tiny small medium normal large giant

<map-type>

y

one of the following: arabia archipelago baltic black-forest coastal continental crater-lake fortress gold-rush highland islands mediterranean migration rivers team-islands scandanavia mongolia salt-marsh yucatan arena oasis ghost-lake nomad real-world-spain real-world-england real-world-midEast real-world-texas real-world-italy real-world-caribbean real-world-france real-world-jutland real-world-nippon real-world-byzantium custom_map scenario-map

<perimeter>

y

a valid wall perimeter. Allowed values are 1 and 2, with 1 being closer to the Town Center than 2. Perimeter 1 is usually between 10 and 20 tiles from the starting Town Center. Perimeter 2 is usually between 18 and 30 tiles from the starting Town Center.

<player-number>

y

a valid player number or one of the wildcard parameters (if explicitly allowed by the fact/action): any-ally any-computer any-computer-ally any-computer-enemy any-computer-neutral any-enemy any-human any-human-ally any-human-enemy any-human-neutral any-neutral every-ally every-computer every-enemy every-human every-neutral For a detailed description of wildcard parameters, see the "Wildcard Parameters" section later in this document. Note: Wildcard parameters applying to allies do not apply to self.

<rel-op>

y

is one of the following (two versions, either can be used): full: less-than less-or-equal greater-than greater-or-equal equal not-equal short: < <= > >= == !=

<research-item>

y

see separate table for details.

<resource-type>

y

is one of the following: food gold stone wood

<score>

 

a signed 16-bit integer.

<shared-goal-id>

 

a valid shared goal id. Shared goal ids have a range from 0 to 255.

<signal-id>

 

a valid signal id. Signal ids have a range from 0 to 255.

<starting-resources>

y

one of the following: low-resources medium-resources high-resources

<strategic-number>

y

see separate table for details.

<string>

y

a sequence of characters in double quotes.

<string-id>

y

a valid string id from a localized string table.

<string-id-range>

y

the size of a string id range.

<string-id-start>

y

is a valid string id (from a localized string table) that defined beginning of a string id range.

<taunt-id>

y

a valid taunt id.

<taunt-range>

 

the size of a taunt range.

<taunt-start>

 

is a taunt that defines a beginning of a taunt range.

<timer-id>

y

a valid timer id (range 1-10).

<unit>

y

see separate table for details.

<value>

y

a signed 16-bit integer.

<victory-condition>

 

one of the following: standard conquest time-limit score custom

<wall>

y

one of the following: fortified-wall palisade-wall stone-wall or the following wildcard character: stone-wall-line

Wildcard Parameters
<player-number> wildcard parameters:

  • any-ally
  • any-computer
  • any-computer-ally
  • any-computer-enemy
  • any-computer-neutral
  • any-enemy
  • any-human
  • any-human-ally
  • any-human-enemy
  • any-human-neutral
  • any-neutral
  • every-ally
  • every-computer
  • every-enemy
  • every-human
  • every-neutral

Usage of <player-number> wildcard parameters:

  1. Wildcard parameters of the form "any-..." used in facts.
    The fact is true if it is true for at least one player that satisfies the given criteria.
    Example:
    (defrule 
      (players-current-age any-enemy == imperial-age)
     =>
      (chat-to-allies "At least one enemy in imperial")
    )
    
  2. Wildcard parameters of the form "every-..." used in facts.
    The fact is true if it is true for every player that satisfies the given criteria.
    Example:
    (defrule 
      (players-current-age every-enemy == imperial-age)
    =>
      (chat-to-allies "All enemies are in imperial")
    )
    
  3. Wildcard parameters of the form "any-..." used in actions.
    The action executes for the first player that satisfies the given criteria.
    Example:
    (defrule 
      (gold-amount > 10000)
    =>
      (tribute-to-player any-ally gold 1000)
    )
    
  4. Wildcard parameters of the form "every-..." used in actions.
    The action executes for every player that satisfies the given criteria.
    Example:
    (defrule 
      (true)
    =>
      (set-stance every-human enemy)
      (set-stance every-computer ally)
      (chat-to-all "All computer players are my allies, all humans are my enemies")
      (disable-self)
    )
    

Note: Wildcard parameters applying to allies do not apply to self.


<building> wildcard parameters:

watch-tower-line Note - this has a bug, use watch-tower instead of watch-tower-line, it also covers guard tower and keep !


<unit> wildcard parameters grouped by building:

archery range units:

  • archer-line
  • cavalry-archer-line
  • skirmisher-line

barracks units:

  • eagle-warrior-line
  • militiaman-line
  • spearman-line

castle units:

  • berserk-line
  • cataphract-line
  • chu-ko-nu-line
  • conquistador-line
  • huskarl-line
  • jaguar-warrior-line
  • janissary-line
  • longbowman-line
  • mameluke-line
  • mangudai-line
  • plumed-archer-line
  • samurai-line
  • tarkan-line
  • teutonic-knight-line
  • throwing-axeman-line
  • war-elephant-line
  • war-wagon-line
  • woad-raider-line

dock units:

  • cannon-galleon-line
  • demolition-ship-line
  • fire-ship-line
  • galley-line
  • longboat-line
  • turtle-ship-line

siege-workshop units:

  • battering-ram-line
  • mangonel-line
  • scorpion-line

stable units:

  • camel-line
  • knight-line
  • scout-cavalry-line

These parameters are sometimes referred to as unit line or line parameters.

For the use of <unit> wildcard parameters, see the "Usage of line parameters" section below.


<wall> wildcard parameters:

  • stone-wall-line

Usage of line parameters:

Line parameters are interpreted by facts/actions in two ways:

  1. They are translated into a currently available unit/building from a given line.

    For example, action (train knight-line) will train a unit from knight-line that is currently available. Which unit is trained (Knight, Cavalier, or Paladin) is determined by the current state of research upgrades.

    The following facts use line parameters in this fashion:

    • building-available
    • can-afford-building
    • can-afford-unit
    • can-build
    • can–build-wall
    • can-build-wall-with-escrow
    • can-build-with-escrow
    • can-train
    • can-train-with-escrow
    • unit-available

    The same is true for the following actions:

    • build
    • build-forward
    • build-wall
    • train

  2. They cause iteration on all buildings/units in the given line.

    All unit/building count facts use this interpretation of line parameters.

    For example (unit-type-count militiaman-line > 5) will take into account all units in the militia line: Militia, Man-at-Arms, etc.

    It is rare to see more than one type of unit from a line at the same time. Exceptions are scenarios where any combination of units can be placed in the editor, and cases when units are converted.

    The following facts use line parameters in an iterative fashion:

    • building-type-count
    • building-type-count-total
    • cc-players-building-type-count
    • cc-players-unit-type-count
    • players-building-type-count
    • players-unit-type-count
    • unit-type-count
    • unit-type-count-total

The implementation of line parameters is very fast so use it whenever needed. All line parameters are named after the first unit/building in the line.


Difficulty Parameters:

Difficulty parameters are tactical parameters that should be adjusted according to the game’s difficulty setting.

  • ability-to-dodge-missiles

    Chance of a computer player’s unit dodging a missile. Valid range 0-100. Default value is 100.

    For example, if an opponent shoots at your units with a cannon, this is the percentage chance that your units will try to avoid the area where the cannon ball will hit. Dodging makes the computer player harder to kill; when set to 0 the computer player will try to dodge every incoming shot.

  • ability-to-maintain-distance

    Chance that computer player’s ranged unit will maintain the distance. Valid range 0-100. Default value is 100.

    If a computer player is using an archer to attack an enemy knight, this is the percent chance that the archer will back up and fire if the knight advances toward it. If 0, the archer will always back up.

Last modified 14 August 2007
(c) Steven Berry 2007. All rights reserved.