LogoPixi’VN

Temporary storage

In many cases, it is useful to use variables only during a certain period of the narrative. Using normal storage, you would need to manually remove these variables when they are no longer needed, to keep saves light and efficient.

To solve this problem, Pixi’VN has a temporary storage system. Temporary variables initialized in a label will be deleted when the label is closed. If another label is called from it, the temporary variable will still be accessible from the child label. However, if another label is called with jump (so the current label will be closed and the new one started), the temporary variable will no longer be accessible.

Set

To set a temporary variable, use storage.setTempVariable. This function has the following parameters:

  • name: The name of the variable to set.
  • value: The value of the variable to set.
import { storage } from '@drincs/pixi-vn'

storage.setTempVariable("myTempVariable", 42);

Get

To get a temporary variable, use the normal storage.getVariable function.

Remove

To remove a temporary variable, use storage.removeTempVariable. This function has the following parameters:

  • name: The name of the variable to remove.
import { storage } from '@drincs/pixi-vn'

storage.removeTempVariable("myTempVariable");

On this page