Delete

The *delete command enables the complete removal of any variable from a game, at any point during the game. It can be applied to both temporary (*temparrow-up-right) variables or permanent ones (defined using the *createarrow-up-right command in startup.txtarrow-up-right). *delete 命令能够从游戏中完全移除任何变量,且可在游戏进程中的任意时间点执行。该命令既适用于临时(*temp)变量,也适用于永久变量(在 startup.txt 中使用 *create 命令定义的变量)。

Usage 用法

A typical example of use might be conditional, as follows: 一个典型的使用场景可能是条件性的,如下所示:

*temp var 100

*if var > 99

    *delete var

Any attempt to reference a deleted variable later in the game will result in a "Non-existent variable" errorarrow-up-right. 在游戏后续进程中,任何尝试引用已删除变量的操作都将导致“变量不存在”错误。

Practical use 实际应用

Generally speaking, it's not used very much at all except perhaps to (fairly needlessly) 'tidy up' unwanted variables once they have served their purpose. In particular, bear in mind that all *temp variables are automatically removed from memory with each loading of a new scene filearrow-up-right. 总的来说,除了(相当不必要地)在无用变量完成使命后“清理”它们之外,这个命令几乎很少被使用。尤其要记住,所有 *temp 变量在每次加载新场景文件时都会自动从内存中移除。

Origin and purpose 起源与用途

The *delete command is believed to be one of the original commands available in the very first version of ChoiceScript, and which to date has simply never been removed. However, you won't find it listed in any official Helpfiles so its actual purpose remains a mystery, as it no longer appears to serve a practical purpose (who wants to generate even more errors in their game?). *delete 命令被认为是 ChoiceScript 最初版本中就存在的原始命令之一,并且至今从未被移除。然而,你在任何官方帮助文件中都找不到它的身影,因此其实际用途仍然是个谜,因为它似乎已不再具有实用价值(谁会在自己的游戏中制造更多错误呢?)。

It has been speculated that *delete may originally have served some sort of debugging purpose, with more recent versions of ChoiceScript having since rendered the command more or less obsolete. 有人推测,*delete 最初可能用于某种调试目的,而 ChoiceScript 的更新版本已使该命令或多或少变得过时。

We would welcome discussion on the subject in the Comments section below - especially if you have used, or have seen examples of use, where *delete serves a purpose of some value to other authors. 我们欢迎您在下方评论区就此主题展开讨论——特别是如果您曾使用过,或见过其他作者利用 *delete 指令实现某些有价值用途的实例。