QVar Script Options

The scripts TrapSetQVar and TrigQVar read their options from the Trap\Quest Var property. The options must be specified in a particular format. The first character in the string is an operator. This determines how the script will apply the argument option to the current value of the quest variable. Immediately following the operator is a numerical argument. The number is negative if the first character is a hyphen ("-"); positive numbers have no special sign. The number ends at the first non-digit character after the optional hyphen. After the argument, there must be a colon (":") followed immediately by the name of the quest variable. The rest of the string is considered to be part of the name.

Example: "=42:meaning_of_life"

TrigQVar

These are the operators that are valid when used with TrigQVar.

Operator

Description

Example: Variable = 102

=

Is true if the variable is exactly equal to the argument.

=102 is true.
=101 is false.

<

Is true if the variable is less than the argument.

<102 is false.
<112 is true.
<101 is false.

>

Is true if the variable is greater than the argument.

>102 is false.
>112 is false.
>101 is true.

&

Is true if any of the bits in the argument are also set in the variable. (Bitwise 'and'.) Thief 2 only.

&102 is true.
&2 is true.
&1 is false.
&8 is false.
&127 is true.

"

Is true if the lowest decimal digits in the variable, the same number as there are in the argument, are the same as the argument. Thief 2 only.

"102 is true.
"101 is false.
"2 is true.
"1102 is false.

TrapSetQVar

These are the operators that are valid when used with TrapSetQVar.

Operator

When Turned On

When Turned Off

Example: Variable = 102

=

Sets the variable to the argument.

Sets the variable to 0.

=3 → 3

+

Adds the argument to the variable.

Subtracts the argument from the variable.

+3 → 105

-

Subtracts the argument from the variable.

Adds the argument to the variable.

-3 → 99

*

Multiplies the variable by the argument.

Divides the variable by the argument.

*3 → 306

/

Divides the variable by the argument. Discards the remainder.

Multiplies the variable by the argument.

/3 → 34

%

Sets the variable to the remainder of the variable divided by the argument.

multiplies the variable by the argument.

%4 → 2

!
|

Sets the bits in the variable that are set in the argument. (Bitwise 'or'.) "|" only available in Thief 2.

Clears the bits in the variable that are set in the argument.

!3 → 103

{

Shifts the bits in the variable left by argument bits. (Multiplies by 2 to the power of argument.)

Shifts the bits in the variable right by argument bits.

{3 → 816

}

Shifts the bits in the variable right by argument bits. (Divides by 2 to the power of argument.)

Shifts the bits in the variable left by argument bits.

}3 → 12

"

Multiplies the variable by 10, then adds the least-significant decimal digit of the argument (the "ones" place) to the variable. Thief 2 only.

Divides the variable by 10.

"13 → 1023

?

Adds to the variable a random value greater than or equal to zero and less than or equal to the argument. Thief 2 only.

Subtracts from the variable a random value greater than or equal to zero and less than or equal to the argument.

?3 → 102—105

d

Adds to the variable a random value greater than zero and less than or equal to the argument. Thief 2 only.

Subtracts from the variable a random value greater than zero and less than or equal to the argument.

d3 → 103—105