FKiSS Value Pools

See also: FKiSS, General Syntax, Data Types, If-Endif Structure, Shortcuts, %Tags, Cel Groups, HINTs, Events, Actions, valuepool, savevalue, loadvalue, deletevalue

Description

Value Pools are a new concept introduced in FKiSS4. Value Pools provide a way for variable values to be saved to disk and loaded again later, even during later sessions. For example, a game-based KiSS set could use a Value Pool to save the high score and load it again the next time that KiSS set is played. Another example is a KiSS doll might use a value pool to remember whether the user wanted the snap-to feature turned on and start with the same setting the next time that doll is loaded.
Each Value Pool can store any number of values, one for each named value entry.

Types of Value Pools

There are two types of Value Pools: Private Pools and Public Pools.

Private Value Pools:

Each KiSS set has its own Private Value Pool which is unique to that KiSS set. The Private Value Pool is the default Value Pool for the KiSS set and cannot be accessed by any other KiSS set, not even different CNFs in the same LZH KiSS archive. This protects the values from accidental interference from other KiSS sets. Private Value Pools do not have names since they are identified by the KiSS set which owns them.

Public Value Pools:

Public Value Pools have names. Values in a Public Value Pool can be accessed by any KiSS set which knows the name of that Public Value Pool. This makes it possible for one KiSS set to react to changes made in a different KiSS set. However, it is possible for two KiSS sets to use the same Value Pool by accident so it is strongly recommended that you try to give your Public Value Pool as unique a name as possible to avoid accidents.

Specifying A Value Pool

Before saving a value to a Value Pool, you can select the Private Value Pool or a Public Value Pool with the valuepool action. Public Value Pools must be named while Private Value Pools have no name.
Public Value Pool names:

Example:

;@ valuepool("DavesAdventure_By_ChibiWuwu") ; uses the specified public value pool
;@ valuepool("") ; uses the private value pool

Values and Value Pools

Values can be saved, loaded, and deleted from Value Pools by using the savevalue, loadvalue, and deletevalue actions.
If you want to specify a value pool other than the current pool without changing the current pool, you can specify it in the value name by separating it with a period (.).

Example:

;@ savevalue("HighScore", score)               ; Save the value in score to the "HighScore" value in the current value pool
;@ savevalue("Johns_Adventure1.strength", str) ; Save the value in str to the "strength" value in the public pool "Johns_Adventure1"
;@ savevalue(".SnapTo", snap)                  ; Save the value in snap to the "SnapTo" value in the private value pool
;@ loadvalue(score, "HighScore")
;@ loadvalue(str, "Johns_Adventure1.strength")
;@ loadvalue(snap, ".SnapTo")
;@ deletevalue("HighScore")
;@ deletevalue("Johns_Adventure1.strength")
;@ deletevalue(".SnapTo")