LogoPixi’VN

Temporary storage

Explains how to use temporary storage in Pixi’VN for variables that are only needed during a specific narrative period.

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.

Establecer

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

  • name: El nombre de la variable a establecer.
  • value: El valor de la variable a establecer.
import { storage } from '@drincs/pixi-vn'

storage.setTempVariable("myTempVariable", 42);

Obtener

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

Eliminar

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

  • name: El nombre de la variable a eliminar.
import { storage } from '@drincs/pixi-vn'

storage.removeTempVariable("myTempVariable");

On this page