AICompile

Script Compiler for Baldur’s Gate

Public Release Version 1.0


Table Of Contents

Table Of Contents *

Disclaimer: *

Using the Script Compiler: *

Creating Scripts: *

Initial Planning: *

Preparation: *

Coding: *

Compiling: *

Definitions: *

Creature: *

Trigger: *

Condition: *

Action: *

Response: *

Response Set: *

Creature and Object Identification *

Some Special Object Identification Functions *

"NAME" *

LastAttackerOf(ObjectType Caller) *

LastCommandedBy(ObjectType Caller) *

LastHeardBy(ObjectType Type) *

LastHelp(ObjectType Type) *

LastHitter(ObjectType Type) *

LastSeenBy(ObjectType Type) *

LastTalkedToBy(ObjectType Type) *

LastTargetedBy(ObjectType Caller) *

LastTrigger(ObjectType Type) *

LeaderOf() *

LeastDamagedOf() *

MostDamagedOf() *

Myself *

Nearest(ObjectType Type) *

NearestEnemyOf(ObjectType Caller) *

Player1 *

Player2 *

Player3 *

Player4 *

Player5 *

Player6 *

Protagonist *

ProtectedBy(ObjectType Caller) *

ProtectorOf(ObjectType Caller) *

StrongestOf() *

StrongestOfMale *

WeakestOf() *

Trigger Descriptions *

Event Triggers *

AttackedBy(ObjectType X, Style Y) *

Die() *

Died(Object: X) *

Heard(Object:X, Integer: Y) *

Help(ObjectType X) *

HitBy(ObjectType X, Style Y) *

Description: I have just been hit by X the style is Y *

HotKey(HotKey X) *

ReceivedOrder(ObjectType X, OrderID Y) *

Said(Object:X) *

Trigger(Integer TriggerId) *

Status Triggers *

ActionListIsEmpty() *

Class(ObjectType X,CLASS) *

Delay(Integer: X) *

Use: Use to avoid excessive calling of slow triggers *

Exists(ObjectType X) *

False() *

Gender(ObjectType X,GENDER) *

General(ObjectType X,GENERAL) *

HasWeaponEquiped(O:Object*) *

HaveAnySpells() *

HaveSpell(Integer X) *

HP(ObjectType X, Y) *

HPGT(ObjectType X, Y) *

HPLT(ObjectType X, Y) *

HPPercent(ObjectType X, Integer: Y) *

HPPercentGT(ObjectType X, Integer: Y) *

HPPercentLT(ObjectType X, Integer: Y) *

InParty(ObjectType X) *

InWeaponRange(O:Object*) *

LOS(ObjectType X, RANGE) *

NotStateCheck(ObjectType X, Integer:Y) *

NumCreature(ObjectType X, Integer: Y) *

NumCreatureGT(ObjectType X, Integer: Y) *

NumCreatureLT(ObjectType X, Integer: Y) *

NumTimesInteracted(Integer:NPC, Integer num) *

NumTimesInteractedGT(Integer:NPC, Integer num) *

NumTimesInteractedLT(Integer:NPC, Integer num) *

OutOfAmmo() *

Race(ObjectType X,RACE) *

RandomNum(Integer: Range, Integer: Value) *

RandomNumGT(Integer: Range, Integer: Value) *

RandomNumLT(Integer: Range, Integer: Value) *

Range(ObjectType X, RANGE) *

See(ObjectType X) *

Specifics(ObjectType X,SPECIFICS) *

StateCheck(ObjectType X, Integer:Y) *

Description: Check if X is in State Y *

Time(TIME) *

TimeOfDay() *

True() *

Description: Always returns True *

Action Descriptions *

Attack(ObjectType X, Style Y, ObjectType Z) *

AttackOneRound(Object X) *

AttackReevaluate(O:Target,I:Period) *

Continue( ) *

EquipMostDamagingMelee() *

Description: Equip melee weapon which does the most damage *

EquipRanged() *

Formation(ObjectType Leader, Point Offset) *

GetItem(ResRef X) *

GiveOrder(ObjectType X, OrderID Y) *

GroupAttack(Object X) *

Help() *

Hide() *

Mouse Functions: *

MoveToObject(ObjectType X) *

MoveToOffset(Point: P) *

Description: Move to P offset from current location *

ProtectObject(ObjectType X) *

ProtectPoint(Point X, Integer range) *

RandomWalk() *

Description: Wander around randomly *

RunAwayFrom(ObjectType X, Time) *

SendTrigger(ObjectType X, Integer ID) *

SetInterrupt(Integer X) *

Description: Turn interrupt on or off *

Shout(Integer Y) *

Description: Send all in range Heard trigger *

SmallWait(Integer X) *

Spell(ObjectType X, SpellID Y) *

SpellPoint(Point X, SpellID Y) *

Wait(Integer X) *

Description: Enter ready state for X seconds *

Sample Script File *

Syntax Overview *

File *

Weight *

Condition *

Response *

Trigger *

Action *

ObjectType *

Example File *

Disclaimer:

The "Baldur’s Gate Script Compiler," this document, and any information contained herein, are provided in an "as is" state. No support will be provided for either the use of the compiler or for any script files generated by the compiler. Neither BioWare Corp. or Interplay Productions are responsible for any problems encountered in running the compiler or in creating scripts.

BALDUR'S GATE: Developed and (c)1998 BioWare Corp. All Rights Reserved. Baldur's Gate, Forgotten Realms, the Forgotten Realms logo, Advanced Dungeons & Dragons, the AD&D logo, and the TSR logo are trademarks of TSR, Inc., a subsidiary of Wizards of the Coast, Inc., and are used by Interplay under license. All Rights Reserved. BioWare, the BioWare logo and The BioWare Infinity Engine are the trademarks of Bioware Corp. All Rights Reserved. Interplay, the Interplay logo, Black Isle Studios, the Black Isle Studios logo, and "By Gamers. For Gamers." are trademarks of Interplay Productions. All Rights Reserved. Exclusively licensed and distributed by Interplay Productions. LUA copyright 1994-1998 TeCGraf, PUC-Rio. LUA written by Waldermar Celes, Robert Ierusalimschy and Luiz Henrique de Figueirido. All other trademarks and copyrights are property of their respective owners. All rights reserved.

Using the Script Compiler:

Before using the script compiler, you must copy the entire ScriptCompiler directory from Baldur’s Gate CD1 to your hard drive. You will be unable to run the script compiler directly from the CD. Once the ScriptCompiler directory has been copied, follow the instructions in the following sections.

Creating Scripts:

Initial Planning:

Decide what you want the script to do before actually starting one. For example, "When attacked by an XX I want my character to react according to the range of my attacker. If I am within a range of 4 search squares I will run to get some distance between us. If I am further than 4 search squares I will attack with a ranged weapon."

Preparation:

After you have decided what you want the script to do open notepad or whatever else you would like to use and begin entering in the commands you will need. For mine I will need to use the commands, AttackedBy, Range, RunAwayFrom, EquipRanged and Attack.

Coding:

This is how my script would look:

IF

AttackedBy([ANYONE],DEFAULT)

Range(LastAttackerOf(Myself),4)

THEN

RESPONSE #100

RunAwayFrom(LastAttackerOf(Myself),45)

END

IF

!Range(LastAttackerOf(Myself),4)

THEN

RESPONSE #100

EquipRanged()

Attack(LastAttackerOf(Myself))

END

In the first part of the script I check to see if I was attacked by [ANYONE]. The object type parameter uses any function that returns an object type or objects referenced by ENEMYALLY, RACE, CLASS, etc. Examples of these are: [ANYONE], [ENEMY], [PC], etc. The object type can also be Myself. But in this case it would be useless since you would not attack yourself.

Once I have determined if someone attacked me I check to see if the Range was within 4 search squares. (The screen is about 30 search squares). If the last attack of myself is within range I run away from the target for about 3 seconds. The time is given in 15ths of a second.

If the range of the target is not within 4 search squares the script falls through to the next set of checks. In this next set I just check to see if the target’s range is not (using the ! to reference not) within 4 search squares. If so then I equip my ranged weapon and attack the last attacker of myself.

If I do not have a ranged weapon or ammo the function will equip a melee weapon and then approach the target to get within weapons range.

 

Compiling:

Once the script is done I save it to the Source directory of the script compiler. The filename must be 1 – 8 characters with the extension .BAF. I then run the compiler by typing COMPILE <FILENAME>. The compiler will notify you of any errors in the script by placing a error file in the ERRORS directory with the script’s filename and extension .ERR. If the file size is 0 then the script compiled successfully. And the final script will be placed in the COMPILED directory with the filename and extension .BS. This will then have to be copied into your SCRIPTS directory of Baldur’s Gate.

 

Definitions:

Creature:

Creatures include all objects capable of action. This includes player characters.

Trigger:

A trigger is sent to a creature when a certain event occurs. A trigger includes the knowledge of the cause of the trigger

Condition:

A combination of triggers joined with ands.

Action:

A specified response to a condition. An action requires the knowledge of who (or what) to perform the action upon.

Response:

A combination of actions which will be performed sequentially. It is possible for a response to be interrupted.

Response Set:

A combination of Responses, each with a weighting from 1 to 100. This weighting is used to randomly determine which response is actually executed.

 

Creature and Object Identification

Creature and Object Identification is done through the ObjectType Class.

ObjectType is arranged as follows

BYTE EnemyAlly General

BYTE General |

BYTE Race |

BYTE Class |

BYTE specifics V

LONG Instance Specific

BYTE SpecialCase

EnemyAlly is a range between the PC and the evil NPC’s Creatures can fall anywhere along this range.

General specifies the generic characteristics of the creature (Humanoid, animal, object etc.…)

Race is the race of the creature (Elf, Dwarf …)

Class is the class information (Mage, fighter …) Alternatively it can be used for more detailed information (e.g. Drow is more specific then elf)

Specifics holds the identification for special NPC’s

Instance is unique for each creature within the game. It should not generally be specifies in the AI scripting but will be set by the AI code once a target is selected

SpecialCase is used to specify whether or not to use any special case information. Currently this will only be used for LAttacked and LTargetted. Protecting, Protector and Myself must be stored in a different way so that you can do things like Protecting.Lattacked.

To specify all of a subtype, set the more specific variables to 0.

e.g. To specify all Enemy Dwarfs, set Class, specifics and instance to 0.

 

Some Special Object Identification Functions

The following functions return ObjectType variables corresponding to some special cases. They are called using the following syntax:

Function(Source)

For Example: LAttacked(Spud) will return the ObjectType of the last thing to attack Spud.

If One of Leader, Weakest, Strongest, MDamaged, LDamaged is called, the Source will be used ONLY to determine which group to use.

For Example: Leader(Spud) will return the leader of Spud’s Group

These functions can be used as the Source for any other of these functions. HOWEVER, this nesting can only go 5 deep.

For Example: Protector(LAttacked(LTargeted(Protecting(Myself)))) is valid and will return the protector of the person last attacked by the person last targeted by the person protecting myself. Any more then this depth of nesting is NOT allowed, however.

Note: If you ever use this level of nesting, please seek professional help.

"NAME"

-Returns ObjectType with the instance field filled out if the object currently exists.

LastAttackerOf(ObjectType Caller)

-Returns ObjectType

- The Creature that last did Caller damage

LastCommandedBy(ObjectType Caller)

-Returns ObjectType

-Returns the last person who issued Caller an order

LastHeardBy(ObjectType Type)

-Returns ObjectType

-last heard by type

LastHelp(ObjectType Type)

-Returns ObjectType

-Last person type heard call for help

LastHitter(ObjectType Type)

-Returns ObjectType

-Last person who hit type

LastSeenBy(ObjectType Type)

-Returns ObjectType

-Last seen by type

LastTalkedToBy(ObjectType Type)

-Returns ObjectType

-Last talked to by type

LastTargetedBy(ObjectType Caller)

-Returns ObjectType

- The Creature that Caller last targeted for attack

LastTrigger(ObjectType Type)

-Returns ObjectType

-Last triggerer of type

LeaderOf()

-Returns ObjectType

-Current leader of Player group

LeastDamagedOf()

-Returns ObjectType

- Group member with highest percentage of remaining hit points

MostDamagedOf()

-Returns ObjectType

- Use Source to specify Enemy / Ally status of group

- Group member with the lowest percentage of remaining hit points

Myself

-Returns ObjectType

-Yourself

-Me

Nearest(ObjectType Type)

-Returns ObjectType

-Returns the instance of the nearest ObjectType of the given Type.

NearestEnemyOf(ObjectType Caller)

-Returns ObjectType

-Returns the nearest creature with Enemy / Ally flag opposite to the Caller.

Player1

-Returns ObjectType

-Character in portrait slot 1

Player2

-Returns ObjectType

-Character in portrait slot 2

Player3

-Returns ObjectType

-Character in portrait slot 3

Player4

-Returns ObjectType

-Character in portrait slot 4

Player5

-Returns ObjectType

-Character in portrait slot 5

Player6

-Returns ObjectType

-Character in portrait slot 6

Protagonist

- The Protagonist

ProtectedBy(ObjectType Caller)

- Returns ObjectType

- The Creature currently protected by Caller

ProtectorOf(ObjectType Caller)

- Returns ObjectType

- The Creature Caller is currently being protected by

StrongestOf()

-Returns ObjectType

- Group member with the highest threat rating

StrongestOfMale

- Returns ObjectType

- Male group member with the highest threat rating

 

WeakestOf()

-Returns ObjectType

- Group member with lowest threat rating

 

Trigger Descriptions

Event Triggers

Event Triggers only last until the next AI cycle. At that point they are examined and processed. At the end of the AI cycle all of the triggers are removed from the pending list.

AttackedBy(ObjectType X, Style Y)

Returns: Boolean (True or False)

Description: I was just attacked by creature X using style Y.

Information required:

Attack type: DEFAULT

MELEE

RANGED

X is an ObjectType variable.

Die()

Returns: Boolean (True of False)

Description: I have just died

Died(Object: X)

Returns: Boolean (True or False)

Description: X just died in my hearing range.

Heard(Object:X, Integer: Y)

Returns: Boolean (True or False)

Description: I heard X shout Y

Help(ObjectType X)

Returns: Boolean (True or False)

Description: a call for help is heard from X

Information required: X is an ObjectType

HitBy(ObjectType X, Style Y)

Returns: Boolean (True or False)

Description: I have just been hit by X the style is Y

HotKey(HotKey X)

Returns: Boolean(True or False)

Description: key X has just been pressed when I was the selected creature

Currently hotkeys are restricted to letters A through Z.

ReceivedOrder(ObjectType X, OrderID Y)

Returns: Boolean (True or False)

Description: Just received order Y from X

Information Required: X specifies the creature that sent the order. OrderID specifies type of the order.

Said(Object:X)

Returns: Boolean (True or False)

Description: X said something to me

Trigger(Integer TriggerId)

Returns: Boolean (True or False)

Description: I have just been sent the trigger TriggerId

Status Triggers

Status triggers are checked every time through the AI cycle. As a result they always apply if they are true.

ActionListIsEmpty()

Returns: Boolean (True or False)

Description: I have no actions on my queue

Class(ObjectType X,CLASS)

Returns: Boolean (True or False)

Description: Is the Class of X equal to CLASS?

Information Needed: X is an ObjectType CLASS is the class

ANKHEG

BARD

BASILISK

BASILISK_GREATER

BEAR_BLACK

BEAR_BROWN

BEAR_CAVE

BEAR_POLAR

CARRIONCRAWLER

CLERIC

CLERIC_MAGE

CLERIC_RANGER

CLERIC_THIEF

DOG_WAR

DOG_WILD

DOPPLEGANGER

DOPPLEGANGER_GREATER

DRIZZT

DRUID

ELMINSTER

ETTERCAP

FAIRY_DRYAD

FAIRY_NEREID

FAIRY_NYMPH

FAIRY_SIRINE

FIGHTER

FIGHTER_CLERIC

FIGHTER_DRUID

FIGHTER_MAGE

FIGHTER_MAGE_CLERIC

FIGHTER_MAGE_THIEF

FIGHTER_THIEF

GHOUL

GHOUL_GHAST

GHOUL_REVEANT

GIBBERLING

GNOLL

GREEN_SLIME

GREY_OOZE

HOBGOBLIN

KOBOLD

KOBOLD_TASLOI

KOBOLD_XVART

MAGE

MAGE_THIEF

MUSTARD_JELLY

NO_CLASS

OCRE_JELLY

OGRE

OGRE_HALFOGRE

OGRE_MAGE

OGRE_OGRILLON

OLIVE_SLIME

PALADIN

RANGER

SAREVOK

SKELETON

SKELETON_BANEGUARD

SKELETON_WARRIOR

SPIDER_GIANT

SPIDER_HUGE

SPIDER_PHASE

SPIDER_SWORD

SPIDER_WRAITH

THIEF

VOLO

WOLF

WOLF_DIRE

WOLF_DREAD

WOLF_VAMPIRIC

WOLF_WINTER

WOLF_WORG

WYVERN

Delay(Integer: X)

Returns: Boolean (True or False)

Description: returns False except every X seconds

Use: Use to avoid excessive calling of slow triggers

Exists(ObjectType X)

Returns: Boolean (True or False)

Description: Is X a valid ObjectType?

Information Needed: X is an ObjectType variable.

False()

Description: Always return FALSE

Gender(ObjectType X,GENDER)

Returns: Boolean (True or False)

Description: Is the X’s gender equal to GENDER?

General(ObjectType X,GENERAL)

Returns: Boolean (True or False)

Description: Is the General type of X equal to GENERAL?

Information Needed: X is an ObjectType GENERAL is the general type.

HUMANOID

ANIMAL

DEAD

UNDEAD

GIANTHUMANOID

FROZEN

MONSTER

HasWeaponEquiped(O:Object*)

Description: Does the Object have a weapon equiped?

HaveAnySpells()

Returns: Boolean (True or False)

Description: Do I have any Spells?

HaveSpell(Integer X)

Returns: Boolean (True or False)

Description: Do I have spell X

HP(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are EXACTLY Y

Information needed: the value of Y (as a percentage). X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPGT(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are GREATER THEN Y

Information needed: the value of Y (as a percentage) . X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPLT(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are LESS THEN Y

Information needed: the value of Y (as a percentage) . X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPPercent(ObjectType X, Integer: Y)

HPPercentGT(ObjectType X, Integer: Y)

HPPercentLT(ObjectType X, Integer: Y)

Returns: Boolean (True or False)

Description: Is the HP percent of X equal to Y?

InParty(ObjectType X)

Returns: Boolean (True or False)

Description: Is X in the Party

InWeaponRange(O:Object*)

Description: Is object in Weapon range?

LOS(ObjectType X, RANGE)

Returns: Boolean (True or False)

Description: Is Object X within RANGE search map blocks? Also, is there a clear line of sight to X?

Information Needed: X is an ObjectType variable. RANGE is an integer count of intervening blocks.

NotStateCheck(ObjectType X, Integer:Y)

Returns: Boolean (True or False)

Description: Is X in state Y

NumCreature(ObjectType X, Integer: Y)

NumCreatureGT(ObjectType X, Integer: Y)

NumCreatureLT(ObjectType X, Integer: Y)

Returns: Boolean (True or False)

Description: Is the number of X’s visible Equal to Y

NumTimesInteracted(Integer:NPC, Integer num)

NumTimesInteractedGT(Integer:NPC, Integer num)

NumTimesInteractedLT(Integer:NPC, Integer num)

Returns: Boolean (True or False)

Description: Have I interacted with NPC num times?

OutOfAmmo()

Returns: Boolean (True or False)

Description: Is my current weapon out of ammo. Melee always returns false.

Race(ObjectType X,RACE)

Returns: Boolean (True or False)

Description: Is the Race of X equal to RACE?

Information Needed: X is an ObjectType RACE is the race to be compared to.

Development Notes: Simply compare X.m_type.Race to RACE.

ANKHEG

BASILISK

BEAR

CARRIONCRAWLER

DOG

DOPPLEGANGER

DWARF

ELF

ETTERCAP

FAIRY

GHOUL

GIBBERLING

GNOLL

GNOME

HALF_ELF

HALFLING

HOBGOBLIN

HUMAN

KOBOLD

NO_RACE

OGRE

SKELETON

SLIME

SPIDER

WOLF

WYVERN

RandomNum(Integer: Range, Integer: Value)

RandomNumGT(Integer: Range, Integer: Value)

RandomNumLT(Integer: Range, Integer: Value)

Returns: Boolean (True or False)

Description: Generate a number from 0 to Range and check against Value.

Range(ObjectType X, RANGE)

Returns: Boolean (True or False)

Description: Is Object X within RANGE search map blocks?

Information Needed: X is an ObjectType variable.

Development Notes: Pure distance, no line of sight. Use SpecificID for Range.

See(ObjectType X)

Returns: Boolean (True or False)

Description: Object X is in visual range

Information Needed: Several options for specifying X

  1. The ObjectType class must be specified for X (this allows a general description)
  2. Foe / friend

Specifics(ObjectType X,SPECIFICS)

Returns: Boolean (True or False)

Description: Is the Specific information of X equal to SPECIFICS?

Information Needed: X is an ObjectType SPECIFICS is the specific information flag.

StateCheck(ObjectType X, Integer:Y)

Description: Check if X is in State Y

Time(TIME)

Returns: Boolean (True or False)

Description: The game time is TIME. Game time is the time that has passed in the game world.

Information needed: TIME specifies the time (in seconds) since the beginning of the game

TimeOfDay()

Returns: Boolean (True or False)

Description: Is the time of day TOD?

Information needed: Time of day (TOD) is a reference to the current world time in hours. Constants are:

MIDNIGHT

NOON

DAWN_START

DAWN_END

DUSK_START

DUSK_END

True()

Description: Always returns True

 

Action Descriptions

Overall Development Note:

For any action that requires movement before the action, set the current action to move (with the correct target) and set the next action as the desired action. In general, when a movement is taking place, it will continue as long as the next action is No Action or the target of the next action is the same as the target of the movement and the next action is one that would require movement to the target.

Attack(ObjectType X, Style Y, ObjectType Z)

Description: Attack creature X using Style Y. If no X then attack Z by default.

Information Required: Y specifies the style of attack desired

DEFAULT

RANGED

MELEE

X is used to specify the target. Unless X includes an Instance, then X will be used to indicate the preferred target. Once a target is selected, an Instance will be obtained so that target don’t constantly change. A second ObjectType Z is used to specify general targets.

Development Notes: To do this, place all of type X or Z on the search map. Add Threat radii. However, give the creatures of type X a much lower threat radius penalty.

AttackOneRound(Object X)

Description: Attack X for one round

AttackReevaluate(O:Target,I:Period)

Description: Attack target but reevaluate target every Period clock ticks

Continue( )

Description: Use the actions currently selected, but continue looking for more.

Information Required: none

EquipMostDamagingMelee()

Description: Equip melee weapon which does the most damage

EquipRanged()

Description: Equip a ranged weapon.

Formation(ObjectType Leader, Point Offset)

Description: follow the leader with offset of Offset.

GetItem(ResRef X)

Description: Get Item X and add it to inventory. Walk to the item if necessary.

Information Required: X is a ResRef

GiveOrder(ObjectType X, OrderID Y)

Description: Give order Y to X. X must have a trigger to respond to the order or nothing will happen

Information Required: X specifies the creature(s) to send the order to. OrderID specifies type of the order.

Development Notes: Send a ReceivedOrder trigger to X. Limit range to hearing range of Targets

GroupAttack(Object X)

Description: Attack all of type X

Help()

Description: Call for help

Information Required: None

Development Notes: Send a Call for help Heard trigger to ALL creatures in hearing range (regardless of which side they are on)

Hide()

Description: Hide in shadows / Move silently

Information required: None

Development Notes: This action should continue until an action that would counter this occurs. That is you should be able to simultaneously move silently and move. Perhaps a flag in the thief character should indicate that the character is moving silently.

Mouse Functions:

ClickLButtonPoint(Point X, SCROLLSPEED)

ClickRButtonPoint(Point X, SCROLLSPEED)

DoubleClickLButtonPoint(Point X, SCROLLSPEED)

DoubleClickRButtonPoint(Point X, SCROLLSPEED)

MoveCursorPoint(Point X, SCROLLSPEED)

ClickLButtonObject(ObjectType X, SCROLLSPEED)

ClickRButtonObject (ObjectType X, SCROLLSPEED)

DoubleClickLButtonObject (ObjectType X, SCROLLSPEED)

DoubleClickRButtonObject (ObjectType X, SCROLLSPEED)

Description: Click or move cursor to designated spot

MoveToObject(ObjectType X)

Description: Plot a path to X and begin moving

Information requires: X is an ObjectType

Development Notes: Once a path is obtained, it should be followed as long as no other action is chosen. Further, if the Move To X action reoccurs then, if the two destinations are equal, the existing path should be used.

MoveToOffset(Point: P)

Description: Move to P offset from current location

ProtectObject(ObjectType X)

Description: Protect Object X. Stay within a certain distance of X. Attack enemies in range.

Information required: X is an ObjectType.

Development Notes: Center the In Range check around X. If outside range, move back.

ProtectPoint(Point X, Integer range)

Description: Protect X. Stay within a certain distance of X. Attack enemies in range.

Information required: X is an ObjectType.

Development Notes: Center the In Range check around X. If outside range, move back.

RandomWalk()

Description: Wander around randomly

RunAwayFrom(ObjectType X, Time)

Description: Run away from X for Time seconds.

Information required: X is an ObjectType, Time is in seconds

Development Notes:

SendTrigger(ObjectType X, Integer ID)

Description: Send trigger number ID to X.

SetInterrupt(Integer X)

Description: Turn interrupt on or off

Shout(Integer Y)

Description: Send all in range Heard trigger

SmallWait(Integer X)

Description: Enter ready state for X 15ths of a second

Spell(ObjectType X, SpellID Y)

Description: Cast the spell Y on target X.

Information Required:

The desired spell can be specified as follows:

CLERIC_AID

CLERIC_ANIMAL_SUMMONING_1

CLERIC_ANIMAL_SUMMONING_2

CLERIC_ANIMATE_DEAD

CLERIC_BARKSKIN

CLERIC_BLESS

CLERIC_CALL_LIGHNING

CLERIC_CHANT

CLERIC_CHARM_PERSON

CLERIC_COMMAND

CLERIC_CURE_CRITICAL_WOUNDS

CLERIC_CURE_LIGHT_WOUNDS

CLERIC_CURE_SERIOUS_WOUNDS

CLERIC_DETECT_EVIL

CLERIC_DISPEL_MAGIC

CLERIC_DRAW_UPON_HOLY_MIGHT

CLERIC_ENTANGLE

CLERIC_FIND_TRAPS

CLERIC_FLAME_BLADE

CLERIC_FLAME_STRIKE

CLERIC_FREE_ACTION

CLERIC_GLYPH_OF_WARDING

CLERIC_GOOD_BERRIES

CLERIC_HOLD_ANIMAL

CLERIC_HOLD_PERSON

CLERIC_INVISIBILITY_PURGE

CLERIC_KNOW_ALIGNMENT

CLERIC_MAGIC_STONE

CLERIC_MISCAST_MAGIC

CLERIC_NEUTRALIZE_POISON

CLERIC_PROTECT_FROM_EVIL

CLERIC_PROTECTION_FROM_FIRE

CLERIC_RAISE_DEAD

CLERIC_REMOVE_CURSE

CLERIC_REMOVE_FEAR

CLERIC_REMOVE_PARALYSIS

CLERIC_RESIST_FIRE

CLERIC_RIGID_THINKING

CLERIC_SANCUTARY

CLERIC_SHILLELAGH

CLERIC_SILENCE_15_FOOT

CLERIC_SLOW_POISON

CLERIC_SPIRITUAL_HAMMER

CLERIC_STRENGTH_OF_ONE

WIZARD_AGANNAZAR_SCORCHER

WIZARD_ANIMATE_DEAD

WIZARD_ARMOR

WIZARD_BLINDNESS

WIZARD_BLUR

WIZARD_BURNING_HANDS

WIZARD_CHARM_PERSON

WIZARD_CHILL_TOUCH

WIZARD_CHROMATIC_ORB

WIZARD_CLAIRVOYANCE

WIZARD_CLOUDKILL

WIZARD_COLOR_SPRAY

WIZARD_CONFUSION

WIZARD_DETECT_EVIL

WIZARD_DETECT_INVISIBILITY

WIZARD_DIMENSION_DOOR

WIZARD_DIRE_CHARM

WIZARD_DISPEL_MAGIC

WIZARD_FIREBALL

WIZARD_FLAME_ARROW

WIZARD_FRIENDS

WIZARD_GHOST_ARMOR

WIZARD_GHOUL_TOUCH

WIZARD_GREASE

WIZARD_HASTE

WIZARD_HOLD_PERSON

WIZARD_HOLD_PORTAL

WIZARD_HORROR

WIZARD_IDENTIFY

WIZARD_INFRAVISION

WIZARD_INVISIBILITY

WIZARD_INVISIBILITY_10_FOOT

WIZARD_KNOCK

WIZARD_KNOW_ALIGNMENT

WIZARD_LARLOCH_MINOR_DRAIN

WIZARD_LIGHTNING_BOLT

WIZARD_LUCK

WIZARD_MAGIC_MISSILE

WIZARD_MELF_ACID_ARROW

WIZARD_MINOR_GLOBE_OF_INVULNERABILITY

WIZARD_MIRROR_IMAGE

WIZARD_MONSTER_SUMMONING_1

WIZARD_MONSTER_SUMMONING_2

WIZARD_MONSTER_SUMMONING_3

WIZARD_NON_DETECTION

WIZARD_PROTECTION_FROM_EVIL

WIZARD_PROTECTION_FROM_NORMAL_MISSILES

WIZARD_PROTECTION_FROM_PETRIFICATION

WIZARD_RESIST_FEAR

WIZARD_SHADOW_DOOR

WIZARD_SHIELD

WIZARD_SHOCKING_GRASP

WIZARD_SKULL_TRAP

WIZARD_SLEEP

WIZARD_SLOW

WIZARD_STINKING_CLOUD

WIZARD_STRENGTH

WIZARD_VAMPIRIC_TOUCH

WIZARD_VOCALIZE

WIZARD_WEB

 

Target X is specified using an ObjectType variable.

 

SpellPoint(Point X, SpellID Y)

Description: Cast the spell Y on target X.

Wait(Integer X)

Description: Enter ready state for X seconds

 

Sample Script File

Syntax Overview

File

IF

Condition1

THEN

RESPONSE #weight

Response1

RESPONSE #weight

Response2

END

IF

Condition2

THEN

RESPONSE #weight

Response3

RESPONSE #weight

Response4

END

Weight

weight is a number between 1 and 100.

Condition

Trigger1

Trigger2

Response

Action1

Action2

Action3

Trigger

Trigger(Parameter1, Parameter2, …)

Action

Action(Parameter1,Parameter2, …)

ObjectType

SpecialCase1( SpecialCase2( SpecialCase3( SpecialCase4(…)))))

or

"NAME"

or

[Allegiance . General . Race . Class . Specifics]

Example File

IF

Class(LastAttackerOf(Myself), MAGE)

HPGT(Myself,50)

THEN

RESPONSE #80

Attack(LastAttackerOf(Myself),MELEE)

RESPONSE #40

Help()

RunAway()

END

IF

Exists(LastAttackerOf(ProtectedBy(Myself))

THEN

RESPONSE #100

Attack(LastAttackerOf(ProtectedBy(Myself)), RANGED)

END

IF

HPLT(MostDamagedOf(GroupOf(Myself)),25)

THEN

RESPONSE #76

Spell(MostDamagedOf(GroupOf(Myself)),MOST_HEALING)

Protect(MostDamagedOf(GroupOf(Myself)))

RESPONSE #76

Attack(LastAttackerOf(MostDamagedOf(GroupOf(Myself))),RANGED)

END

IF

See(NearestEnemyOf(Myself))

THEN

RESPONSE #54

Attack(NerestEnemyOf(Myself), DEFAULT)

END

Explanation:

  1. If I’m attacked by a mage and my hit points are more then 50%, either attack the mage using melee (66.7%) OR yell for help and run away (33.3%)
  2. If the person I’m protecting is attacked, attack their attacker using a ranged attack (100%)
  3. If the most damaged person in my group has less then 25% of his hit points, then either cast the most powerful healing spell on him and start protecting them (50%) OR attack the last person who attacked them (50%).
  4. Attack the nearest enemy using my default attack. (100%)

Define ANYONE as the ObjectType with all 0’s. Define ENEMY as the ObjectType with all 0’s except EnemyAlly set to enemy.