$optOff

Can only be used in BDScript 2. Executes functions with turned off optimizations.

As stated in the function description, $optOff disables the optimization of the functions in its arguments.
This means that functions such as $random, $randomText and others won’t return the previous response, but instead a new response will be returned.

Syntax

$optOff[Functions to be executed]

Parameters

  • Functions to be executed (Type: String || Flag: Emptiable): The functions to execute with turned off optimizations.

Example

Let’s try to run this simple code without $optOff:

The 1st random: $random[1;101]
The 2nd random: $random[1;101]
The 3rd random: $random[1;101]

Example

As we can see, all three randoms returned the same number. Let’s fix this by adding $optOff:

$optOff[
The 1st random: $random[1;101]
The 2nd random: $random[1;101]
The 3rd random: $random[1;101]
]

Example

But what if we want to make only the 1st random different from others? In that case we shouldn’t put all this code into $optOff, but only put a particular random into it - the 2nd one:

The 1st random: $random[1;101]
The 2nd random: $optOff[$random[1;101]]
The 3rd random: $random[1;101]

Example

As you can see, the 3rd random will inherit the response of the 2nd one, since it’s not included in $optOff.