Lionhead Challenge Language Documentation

Up to contents.

6 Conditions

A condition is something that is eaither true or false. It is used primarily for if blocks, while loops and wait until.

See also:

6.1 Conditions testing generic objects

A condition is something that is eaither true or false. These conditions can be used to test whether or not any object is doing something or is in a particular state.

  1. get villagers ignore object resource
  2. object active
  3. object can view camera
  4. object left_right clicked
  5. object hit
  6. object hit land
  7. object hit land position
  8. object locked interaction
  9. object played
  10. object decayed
  11. object skeleton
  12. object of type types
  13. object on fire
  14. object in object hand
  15. object in limbo
  16. object not in object hand
  17. object is constant
  18. object is not constant
  19. object exists
  20. object not exists
  21. object frozen
  22. object hit by arrow
  23. object controlled by script
  24. object is moving
  25. object has damage decal
  26. object has damage cleave

6.2 Conditions testing navigation

These only work on navigatable objects. Namely, villagers, animals, creatures and army units.

  1. object can navigate to coord_expression
  2. object can navigate to object object
  3. object preview nav ready
  4. can object preview nav succeed
  5. is navigation stable

6.3 Conditions testing the sky

These conditions test what state the sky is in

  1. sky is in transition
  2. hand over sky

6.4 Conditions testing miracles

These conditions test the state of miracles, both normal and epic.

  1. spell constant in object
  2. spell constant for player expression
  3. player expresion spell charging
  4. player expresion specific spell charging
  5. wonder fire near coord_expression radius expression
  6. wonder in hand

6.5 Conditions testing dialogue and sound

These conditions test wheather dialogue, music and sound has been played, as well as tests on the advisors.

  1. constant music played
  2. spirit_type played
  3. spirit_type speaks expressions
  4. spirit_type speaks in expression
  5. dialogue ready
  6. spirit not ready
  7. read
  8. sound exists
  9. sound string playing
  10. music line expression

6.6 Conditions testing containers

These conditions test containers and the objects within them

  1. object within flock distance
  2. object in object
  3. object not in object

6.7 Conditions testing creatures

These conditions test what a creature is doing.

  1. leash is in hand
  2. object cast by object
  3. creature constant is available
  4. desire of object is constant
  5. object leashed
  6. object leashed to object
  7. object knows action constant
  8. object fighting
  9. object is auto fighting
  10. ask creature object to enter scripted learning for constant with object
  11. creature object finished script action

6.8 Conditions testing objectives

These conditions test what state objectives are in.

  1. get player expression objective constant status
  2. player expression objective constant complete
  3. land end objectives processed
  4. player expression objective constant hidden

6.9 Conditions testing towns

These conditions test what state a town is in.

  1. is town object of size type constant
  2. is town object settlement
  3. town object is under takeover from player expression
  4. can town object recruit constant platoon of size expression
  5. can town object recruit constant siege weapon
  6. object in hand can be placed
  7. pilgrimage object ready

6.10 Conditions testing hand demos and video playback

These conditions test what state videos and hand demos are in.

  1. video is playing
  2. hand demo played
  3. hand demo trigger

6.11 Conditions testing the whole game

These conditions test what state the game is in, as well as providing general true/false functionality

  1. expression second[s]
  2. help system on
  3. creature help on
  4. game is min spec

6.12 Conditions testing villagers

These conditions test what state a villager is in

  1. object is male
  2. object is drowning
  3. animation marker string on object played
  4. villager object can be imprisoned
  5. villager object can react
  6. villager object available
  7. villager object using alternative mesh

6.13 Conditions testing armies

These conditions test what state a platoon or a catapult is in.

  1. platoon object ranged
  2. platoon object melee
  3. platoon object melee fighting
  4. platoon object ranged fighting
  5. platoon object fighting
  6. platoon object attacking platoon object
  7. platoon object under fire
  8. platoon object idle
  9. army unit object is fighting
  10. object interacting with object
  11. object is on wall
  12. army flag constant held
  13. coord_expression is in range of object
  14. object recruiting
  15. object disbanding
  16. does platoon respond to town attack
  17. does platoon respond to local platoon attack
  18. platoon object current action is constant using object
  19. platoon object current action is constant using coord_expression
  20. siege weapon object current action is constant using object
  21. siege weapon object current action is constant using coord_expression

6.14 Conditions testing gates

These conditions test what state a gate or wall is in

  1. gate object open
  2. gate object moving
  3. does object connect to object

6.15 Conditions testing the camera

These conditions test what state the camera is in, as well as whethere the game is in widescreen or not.

  1. in widescreen
  2. camera ready
  3. cinema skipped
  4. widescreen transistion complete
  5. fade ready
  6. camera not ready

6.16 Conditions testing the interface

These conditions test what the player is doing, as well as what the menu and tooltips are doing.

  1. if bindable action constant performed
  2. key constant down
  3. mouse left_right_middle button down
  4. mouse left_right_middle opt_double clicked
  5. within rotation
  6. player has mouse wheel
  7. toolbar handle held

6.17 Conditions testing coord_expressions

A condition is something that is eaither true or false. These conditions can be used to test whether or not a location is somewhere compared to another location.

  1. coord_expression viewed
  2. coord_expression ahead of camera
  3. player expression cast miracle MY_MIRACLE near coord_expression radius expression
  4. coord_expression valid for creature
  5. coord_expression left_right clicked radius expression
  6. fire near coord_expression radius expression
  7. coord_expression near coord_expression radius
  8. coord_expression not near coord_expression radius
  9. coord_expression at coord_expression
  10. coord_expression not at coord_expression
  11. coord_expression near constant cast by player expression radius effect range expression
  12. coord_expression is under landscape
  13. coord_expression and coord_expression on same side of line between coord_expression and coord_expression
  14. coord_expression on land
  15. coord_expression under water
  16. position coord_expression scrubbed radius epression

6.18 Logical Operators

Operators that return BOOLEAN values.

  1. not condition
  2. condition and condition
  3. condition or condition
  4. expression == expression
  5. expression != expression
  6. expression >= expression
  7. expression <= expression
  8. expression > expression
  9. expression < expression

6.1.1 get villagers ignore object resource

returns whether or not villagers are ignore the fact that the object has a resource

Ignoring = get villagers ignore MyTree resource

6.1.2 object active

If an object is active - eg. ScriptHighlight is active, spell dispenser active or reward is opened

Reward active

6.1.3 object can view camera

Returns if an object can view the camera

LostBrother can view camera

6.1.4 object left_right clicked

If an object is the last object clicked and has been clicked in the last few seconds then this check is true.

6.1.5 object hit

Checks what if an object hit something since you last checked. Must have physics tracking enabled on the object.

6.1.6 object hit land

Checks if an object has hit the land since you last checked. Must have physics tracking enabled on the object.

Puck hit land

6.1.7 object hit land position

Checks where the object hit the land. Must have physics tracking enabled on the object.

Puck hit land position

6.1.8 object locked interaction

If an object is in locked interaction - eg. Totem moving up and down, creature stroking.

6.1.9 object played

A check on if an object has finished playing it's animation or if weather has finished it's current storm.

LostBrother played

6.1.10 object decayed

A check on an object to see if it is decayed

LostBrother decayed

6.1.11 object skeleton

A check on an object to see if it is a skeleton

LostBrother skeleton

6.1.12 object of type types

A check on an object to see if it is of a certain type

Animal of type ANIMAL COW

6.1.13 object on fire

A check on an object to see if it is on fire.

LostBrother on fire

6.1.14 object in object hand

Checks if in an object is in an objects hand. Suitable for checking if a creature is holding a particular object.

MyToy in MyCreature hand

6.1.15 object in limbo

Checks if in an object is in limbo

Johhny in limbo

6.1.16 object not in object hand

Checks if in an object is not in an objects hand.

MyToy not in MyCreature hand

6.1.17 object is constant

Casts the result of a get property to BOOLEAN - Not sure if this function is used...

MyHouse is HOUSE_A

6.1.18 object is not constant

Checks if an object is not a specified constant.

MyHouse is not HOUSE_A

6.1.19 object exists

checks a variable to see if it has a game thing.

LostBrother exists

6.1.20 object not exists

Checks a variable to see if it has not been assigned a game thing.

LostBrother not exists

6.1.21 object frozen

returns true if object is frozen

if MyGoolies frozen

6.1.22 object hit by arrow

returns true if the given object has been hit by an arrow. must have physics tracking enabled.

if MyVillager hit by arrow

6.1.23 object controlled by script

returns true if the object is at the final position in its waypoint schedule

MonsterFood controlled by script

6.1.24 object is moving

returns true if the object is moving from one location to another (as opposed to moving on the spot or wanting to move somewhere)

Army324 is moving

6.1.25 object has damage decal

returns true if the has a damage decal on it

RodleHouse has damage decal

6.1.26 object has damage cleave

returns true if the has been cleaved

TorledHouse has damage cleave

6.2.1 object can navigate to coord_expression

Does navigation think this object can navigate succesfully to the indicated position. This may not be stable, even if 'is navigation stable' returns true... as the player may build a wall in the way after the navigation starts...

OverLord can navigate to {GodHome}

See also:

6.2.2 object can navigate to object object

Does navigation think this object can navigate succesfully to the indicated object. This may not be stable, even if 'is navigation stable' returns true... as the player may build a wall in the way after the navigation starts...

OverLord can navigate to object GodHome

6.2.3 object preview nav ready

has the preview nav finished calculating?

ReadyToCheck = MyPlatoon preview nav ready

6.2.4 can object preview nav succeed

can the platoon's preview nav succeed

CanGo = can MyPlatoon preview nav succeed

6.2.5 is navigation stable

is a call to 'object can navigate to coord_expression' guaranteed?

is navigation stable

See also:

6.3.1 sky is in transition

checks to see if the sky is in transition

wait until sky is in transition

6.3.2 hand over sky

Is the hand over the sky?

wait until hand over sky

6.4.1 spell constant in object

Has an object got a spell. (Worship sites/towns/towncentres)

spell MAGIC_TYPE_WOOD in MyWorshipSite

6.4.2 spell constant for player expression

checks if a player has a specific spell

spell SPELL_HEAL_LEVEL_1 for player 1

6.4.3 player expresion spell charging

Check if a spell (any) is charging for a player

player 1 spell charging

6.4.4 player expresion specific spell charging

Check if a specific spell is charging for a player

player 1 spell SPELL_FOOD charging

6.4.5 wonder fire near coord_expression radius expression

Returns true if a wonder has recently been fired near the specified location

if wonder fire near {ScriptLoc} radius 100

6.4.6 wonder in hand

Returns true if the player's hand is holding a wonder spell

if wonder in hand

6.5.1 constant music played

Returns if the script music passed is no longer playing

MUSIC_TYPE_SCRIPT_MISSIONARIES_VERSE_1 music played

6.5.2 spirit_type played

A check on if a spirit_type has finished playing it's animation.

good spirit played

6.5.3 spirit_type speaks expressions

A check on if a spirit_type speaks the text? Hasn't been used in a long time. May not work.

good spirit speaks 102

6.5.4 spirit_type speaks in expression

Does the spirit_type speak in the text group? Hasn't been used in a long time. May not work.

good spirit speaks in GroupID

6.5.5 dialogue ready

Returns if we can have dialogue control.

dialogue ready

6.5.6 spirit not ready

Returns true if a spirit is not ready.

spirit not ready

6.5.7 read

Checks if text is being outputted to the screen. Often used after a say statement in the form: wait until read.

read

6.5.8 sound exists

checks if a player has sound

sound exists

6.5.9 sound string playing

Is a say sound playing?

if say sound "HELP_TEXT_DEFINITELY_NEWEST_INTRO_01" playing

6.5.10 music line expression

Look at the last line of music that was playing. Has not been used for a long time and may not work.

wait until music line 6

6.6.1 object within flock distance

Returns all members of a flock within their flock limits?

MyFlock within flock limits

6.6.2 object in object

Checks if an object is within a container ie. Dance, Flock or Town.

MySheep in MyFlock

6.6.3 object not in object

Checks that an object is not within a container.

MySheep not in MyFlock

6.7.1 leash is in hand

Checks if the creature leash is in the hand

wait until leash is in hand

6.7.2 object cast by object

A check on if an object (Spell) was cast by a specific object. Hasn't been used in a long time. May not work.

MySpell cast by MyCreature

6.7.3 creature constant is available

See if player has a creature type available.

creature CREATURE_TYPE_LEOPARD is available

6.7.4 desire of object is constant

Compares the desire of an object to a specified desire. Suitable for checking the desire of a creature.

desire of MyCreature is TO_REST

6.7.5 object leashed

Returns if an object is leashed or not.

object leashed

6.7.6 object leashed to object

Returns if an object is leashed to an object or not.

MyCreature leashed to Rock

6.7.7 object knows action constant

Returns if an object knows an action (see CREATURE_ACTION_KNOWN_ABOUT in enum.h)

MyCreature knows action CREATURE_ACTION_KNOWN_ABOUT_BUILD

6.7.8 object fighting

Returns if a creature object is fighting.

object fighting

6.7.9 object is auto fighting

checks if a creature is auto fighting whenin a fight. This hasn't been used for a long time and may not work.

object is auto fighting

6.7.10 ask creature object to enter scripted learning for constant with object

Asks the creature to enter scripted learning mode. This hasn't been used for a long time and may not work.

IsInLearning = ask creature MyCreature to enter scripted learning for CREATURE_THROW_BALL_AT_OBJECT with Mouth

6.7.11 creature object finished script action

returns true if the given creature has finished a script action

if creature MyCreature finished script action

6.8.1 get player expression objective constant status

gets the status of an objective

ObjStat = variable get player 0 objective TRIBUTE_OBJECTIVE_COLLECT_WOOD status

6.8.2 player expression objective constant complete

Check to see if an objective is complete

if player 0 objective TRIBUTE_OBJECTIVE_COLLECT_WOOD complete

6.8.3 land end objectives processed

Have the end of land objectives been processed

wait until land end objectives processed

6.8.4 player expression objective constant hidden

Check to see if an objective is hidden

if player 0 objective TRIBUTE_OBJECTIVE_COLLECT_WOOD hidden

6.9.1 is town object of size type constant

how big is a town - village, town, city?

is town BigTown of size type SCRIPT_SETTLEMENT_SIZE_TOWN

6.9.2 is town object settlement

is the town object actually a settlement?

is town MyTown settlement

6.9.3 town object is under takeover from player expression

returns true if the town is being taken over by the player

wait until town MyTown is under takeover from player 1

6.9.4 can town object recruit constant platoon of size expression

Returns true if the town can recruit x soldiers

CanRecruit = can town MyTown recruit ARMY_UNIT_TYPE_MELEE_1 platoon of size 100

6.9.5 can town object recruit constant siege weapon

Returns true if the town can recruit the siege weapon

CanRecruit = can town MyTown recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_1 siege weapon

6.9.6 object in hand can be placed

returns whether the building placement in the hand can be placed

CanPlace = object in hand can be placed

6.9.7 pilgrimage object ready

returns true if a pilgrimage object is ready to be asked to accept or decline

if pilgrims object ready

6.10.1 video is playing

checks to see if a video is playing

wait until not video is playing

6.10.2 hand demo played

Checks to see if a hand demo is running

hand demo played

6.10.3 hand demo trigger

If the hand demo trigger has been set to TRUE. The hand demo can be created with triggers. Calling this will tell when a trigger is come across. Not that triggers are clear once this function is called.

hand demo trigger

6.11.1 expression second[s]

Waits for a number of second(s) to elapse from the moment the instruction is called.

6.11.2 help system on

Returns if the help system is on.

help system on

6.11.3 creature help on

Returns if the creature help system is on.

creature help on

6.11.4 game is min spec

returns true if the game is in min spec

if game is min spec

6.12.1 object is male

Checks the sex of an object for if it's male.

6.12.2 object is drowning

Checks if the object is drowning. May provide odd results for non-villagers.

6.12.3 animation marker string on object played

returns true if the animation marker has been reached

animation marker "MyMarker" on MyVillager played

6.12.4 villager object can be imprisoned

returns true if the villager object can be imprisoned

villager MyLittleThief can be imprisoned

6.12.5 villager object can react

returns true if the villager object can react

villager MyLittleThief can react

6.12.6 villager object available

returns false if the villager object is doing anything easily testable for

villager MyBigBoy available

6.12.7 villager object using alternative mesh

returns true if the position is on land

villager Guy42 using alternative mesh

6.13.1 platoon object ranged

returns true if the given platoon is ranged

platoon MyPlatoon ranged

6.13.2 platoon object melee

returns true if the given platoon is melee

platoon MyPlatoon melee

6.13.3 platoon object melee fighting

returns true if the platoon is currently engaged in fisticuffs

platoon MyPlatoon melee fighting

6.13.4 platoon object ranged fighting

returns true if the platoon is currently ranged fighting

platoon MyPlatoon ranged fighting

6.13.5 platoon object fighting

returns true if the platoon is currently fighting

platoon MyPlatoon fighting

6.13.6 platoon object attacking platoon object

returns true if the platoon is currently fighting with the second platoon

if platoon MyPlatoon attacking platoon TheirPlatoon

6.13.7 platoon object under fire

returns true if the platoon is currently being shot at

if platoon MyPlatoon under fire

6.13.8 platoon object idle

returns true if the platoon is idle

wait until platoon MyPlatoon idle

6.13.9 army unit object is fighting

returns true if the unit is fighting

if army unit SwordGuy is fighting

6.13.10 object interacting with object

Is object interacting with an object. Works only on creatures and platoons.

MyCreature interacting with Totem

6.13.11 object is on wall

Returns true if the object is on a wall. Works for army units.

if MyGuy is on wall

6.13.12 army flag constant held

checks to see if the given type of army flag is held

wait until army flag ARMY_FLAG_INFO_GREEK_MELEE held

6.13.13 coord_expression is in range of object

checks to see if the position is within firing range of the object (siege weapon or ranged platoon)

wait until {TownCentre} is in range of MyTroops

6.13.14 object recruiting

checks to see if a platoon or siegeweapon is recruiting

wait until not MyPlatoon recruiting

6.13.15 object disbanding

checks to see if platoon is disbanding

wait until MyPlatoon disbanding

6.13.16 does platoon respond to town attack

Returns true if platoon is set to respond to attack on that town

ResponseEnabled = does platoon MyPlatoon respond to town MyTown attack

6.13.17 does platoon respond to local platoon attack

Returns true if platoon is set to respond to attack on local platoons

ResponseEnabled = does platoon MyPlatoon respond to local platoon attack

6.13.18 platoon object current action is constant using object

Returns true if platoons current action is the one specified

if platoon MyPlatoon current action is PLATOON_AGENDA_ACTION_ATTACK_TOWN_CENTRE_FOR_TAKE_OVER using MyTown

6.13.19 platoon object current action is constant using coord_expression

Returns true if platoons current action is the one specified

if platoon MyPlatoon current action is PLATOON_AGENDA_ACTION_MOVE_TO_POS using {MyPos}

6.13.20 siege weapon object current action is constant using object

Returns true if siege weapons current action is the one specified

if siege weapon MyCatapult current action is SIEGEWEAPON_AGENDA_ACTION_ATTACK_THING using MyWall

6.13.21 siege weapon object current action is constant using coord_expression

Returns true if siege weapons current action is the one specified

if siege weapon MyCatapult current action is SIEGEWEAPON_AGENDA_ACTION_MOVE_TO_POS using {MyPos}

6.14.1 gate object open

returns true if the given gatehouse object is open

gate TheTownGatehouse is open

6.14.2 gate object moving

returns true if the given gatehouse object is moving

gate TheTownGatehouse is moving

6.14.3 does object connect to object

Returns true if two objects are connected (wall towers connected by a wall)

Connected = does MyTower connect to MyOtherTower

6.15.1 in widescreen

Checks are we in a widescreen section.

wait until in widescreen

6.15.2 camera ready

Has the camera has reached the position it is going to.

wait until camera ready

6.15.3 cinema skipped

Has the interruptible cinema been skipped

if cinema skipped

6.15.4 widescreen transistion complete

Has the widescreen transition finished.

wait until widescreen transition complete

6.15.5 fade ready

Has the fade transition finished.

wait until fade ready

6.15.6 camera not ready

camera not ready

6.16.1 if bindable action constant performed

returns whether this bindable action is currently being performed

if bindable action BINDABLE_ACTION_TILT_ROTATE_ON performed

6.16.2 key constant down

If an key is pressed down.

key KB_SPACE down

6.16.3 mouse left_right_middle button down

If a mouse button is down.

mouse left button down
mouse middle button down

6.16.4 mouse left_right_middle opt_double clicked

If a mouse button is clicked or double clicked.

mouse left button  clicked

6.16.5 within rotation

Is the player within the interface rotation border?

within rotation

6.16.6 player has mouse wheel

Returns if the player has a mouse wheel.

player has mouse wheel

6.16.7 toolbar handle held

returns true if the toolbar handle is currently held

if toolbar is held

6.17.1 coord_expression viewed

Is a position on screen.

{House} viewed

6.17.2 coord_expression ahead of camera

Is a position ahead of the camera plane

if {House} is ahead of camera

6.17.3 player expression cast miracle MY_MIRACLE near coord_expression radius expression

Detects whether a miracle has been cast at a position. Triggers when the miracle is poured or bounces.

if player 0 cast miracle MIRACLE_TYPE_HEAL near {MyMarker} radius 15

6.17.4 coord_expression valid for creature

Is the position valid for a creature to be at (Eg. Not a mountain side).

{SheepPos} valid for creature

6.17.5 coord_expression left_right clicked radius expression

If the last postion clicked (if in the last few seconds) is within the defined radius of the defined position this check is true.

{House} right clicked radius 5

6.17.6 fire near coord_expression radius expression

A check on an position to see if it there is a fire within the defined radius.

fire near {WoodPile} radius 10

6.17.7 coord_expression near coord_expression radius

Checks if a position is within a radius of another position.

{MyVillager} near {VillagerHome} radius 20

6.17.8 coord_expression not near coord_expression radius

Checks that a position is not within a radius of another position.

{MyVillager} not near (VillagerHome} 20

6.17.9 coord_expression at coord_expression

Checks if a position is the same as another position.

{MyVillager} at {VillagerHome}

6.17.10 coord_expression not at coord_expression

Checks that a position is not the same as another position.

{MyVillager} not at {VillagerHome}

6.17.11 coord_expression near constant cast by player expression radius effect range expression

returns true if the spell has been cast within the given range of the given point

{MonsterMine} near SPELL_TYPE_HEAL cast by player 0 radius effect range 50

6.17.12 coord_expression is under landscape

returns true if the given position is under the landscape

{MyPos} is under landscape

6.17.13 coord_expression and coord_expression on same side of line between coord_expression and coord_expression

returns true if the two given positions are on the same side of the line defined by two positions

{EnemyPlatoon} and {HomeTown} on same side of the line between {WestPos} and {East Pos}

6.17.14 coord_expression on land

returns true if the position is on land as opposed to on the occean

{Rock} on land

6.17.15 coord_expression under water

returns true if the position is under the level of the water. If an object is far enough under the landscape, it will also be under the water.

{Rock} under water

6.17.16 position coord_expression scrubbed radius epression

Has this position just been scrubbed with the fist?

wait until {MyPos} scrubbed radius 10

6.18.1 not condition

Returns true when the condition is not true.

6.18.2 condition and condition

Returns true when both conditions are true.

6.18.3 condition or condition

Returns true when one or more of the conditions is true.

6.18.4 expression == expression

Returns true when the expression evaluate as the same.

6.18.5 expression != expression

Returns true when the expression do not evaluate as the same.

6.18.6 expression >= expression

Returns true when the expression on the left of the operator evaluates to be greater than or equal to the expression right of the operator.

6.18.7 expression <= expression

Returns true when the expression on the left of the operator evaluates to be less than or equal to the expression right of the operator.

6.18.8 expression > expression

Returns true when the expression on the left of the operator evaluates to be greater than the expression right of the operator.

6.18.9 expression < expression

Returns true when the expression on the left of the operator evaluates to be less than the expression right of the operator.

This documentation generated by LHDOC, © Lionhead Studios 2000