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.

设置

To set a temporary variable, use storage.setTempVariable. 该函数具有以下参数:

  • name:要设置的变量名称。
  • value:要设置的变量的值。
import { storage } from '@drincs/pixi-vn'

storage.setTempVariable("myTempVariable", 42);

获取

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

Remove

To remove a temporary variable, use storage.removeTempVariable. 该函数具有以下参数:

  • name:要移除的变量名称。
import { storage } from '@drincs/pixi-vn'

storage.removeTempVariable("myTempVariable");

On this page