Skip to reading
PCA Script Programming

is_valid()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page
Code example
is_valid(value)

Check a record’s existence, an object’s validity or whether an ordinary value is non-null.

Returns: Boolean.

Code example
is_valid(0)

False and 0 are valid values. This is not a truthiness test.

type_of()#

Code example
type_of(value)

Return the PCA-facing type name of a value.

Returns: Text such as integer, number, text, array, dictionary, vector3, color, record or null.

Code example
type_of([1, 2])

exists()#

Code example
exists(value)

Test whether a record reference exists, or an ordinary value is non-null.

Returns: Boolean.

Code example
exists(objects.archive_door)

For a text value it does not interpret that text as a record ID; use an actual reference or a specific lookup.

has_inventory() and aliases#

Code example
has_inventory(item, character = "player", count = 1)

Check inventory possession through the game’s inventory route.

Returns: Boolean.

Aliases: player_has()

Code example
has_inventory("key", "player", 1)

The item comes first. Character-owned and shared inventory modes affect the result.

Page 61 of 357Permalink
Go to page