Conditions:Type

''Conditions: type and expression'

The map makers will have noticed that some conditions are marked by strange code lines: "type" and "expression", whose meant is unknown to the more. This tutorial proposes to give some elucidations about it.

Some condition are marked with the codes Type 1 and Type 2, and some others don't show this marks.

Make attencion to the following examples:

No type marks

{condition {term 1 "event" {"id" 9} }                   {term 2 "event" {"id" 10} }                   {term 3 "actors" {"selector" {"actors/mids" "21"} {"actors/type" "human"} {"actors/state" "not dead"} }                   }               }

When a condition is structured in this way, it means that the related actions will starts only when all the terms are happened.

In our case the trigger will start its action only when the terms 1, 2 and 3 are happened.

Type 1 marks

{condition {type 1} {term 1 "event" {"id" 7} }                   {term 2 "event" {"id" 14} }              }

In this case, the "type 1" mark means that the trigger actions will start when one or more that one of the listed terms are happened. It is not needed that all the terms are happened.

In our case the actions will start when the term 1 is happened, or when the therm 2 is happened, or when both terms are happened.

Type 2 marks The conditions marked with the line "type 2" are advanced conditions which use some boolean terms. To better explain this we should entroduce the line expression.

This particular code line works only under the line "type 2". So you will find always together these two lines.

The terms that you can use in the line "expression" are:

! = false, not & = and
 * = or

You can use a combination of this terms in order to define the situation in which the trigger actions will start.

Here are some examples:

{condition {type 2} {expression "!1"} {term 1 "actors" {"selector" {"actors/mids" "21"} {"actors/type" "human"} {"actors/state" "not dead"} }                   }               }

In this case the trigger will start when the term 1 is false (i.e. is not happened).

{condition {type 2} {expression "!1 & 2"} {term 1 "actors" {"selector" {"actors/tag" "pl"} {"actors/type" "human"} {"actors/state" "not dead"} }                   }                    {term 2 "task" {"name" "scappa"} {"state" "shown"} }              }

In this case the trigger will start when the term 1 is false and the term2 is true (i.e. is happened).

{condition {type 2} {expression "!1 | (2 & 3)"} {term 1 "actors" {"selector" {"actors/tag" "pl"} {"actors/type" "human"} {"actors/state" "not dead"} }                   }                    {term 2 "task" {"name" "scappa"} {"state" "shown"} }                   {term 3 "event" {"id" 14} }              }

And now, this is a very advanced condition. As you can see it uses a combination of the different boolean terms. In this case the trigger actions will start when the term 1 is false, or when the terms 2 and 3 are true.

It is clear that you can create a large number of combo that will help you defining an infinity of possible conditions.