Navigation stuff goes here


Concepts: conditions

Conditions are used in if and while commands. They involve examining two values and doing different things depending on how they compare.

Psyscript implements four kinds of comparison: is, is not, is in and is not in. The things to be compared can be fixed text or variables. Anything starting with a dollar sign is a variable, anything else is fixed text.

Matching comparisons: is and is not

if $varMyLocation is Spain

These two comparisons are used to test two values and see whether they're identical or not. The case of letters (upper case vs. lower case) is not considered significant. In other words, 'caVERN' matches 'Cavern'.

Substring comparisons: is in and is not in

if $varMyLocation is not in Spain,France

These two comparisons are used to determine whether one string appears as part of another. The case of letters (upper case vs. lower case) is not considered significant. In other words, PsyScript believes that the text 'hello' does appear in the text 'HELLO MUM.'.

Warning on the syntax of conditions

Be careful when using ambiguous constructions. For instance …

if $varMyLocation is in Spain,France

… can be interpreted two ways. It might mean you want to test whether

If in doubt about how your script will be interpreted, do the following:

declare $varTestLocation set $varTestLocation to in Spain,France if $varMyLocation is $varTestLocation […] end while

See also