Home Memoirs of a Gamer Movies I watched Guidebook Code Projects Links

The Gorgon Engine

The Player Inventory

Player inventory is internally tracked as a bitfield, flagging whether or not the player has acquired said item. As the system is procedural, Scriptor currently assumes the script writer will reference items IDs directly via a constant integer (whether explicitly or via a define) or possibly even a variable / result of an equation.

There are four routines in the inventory subsystem, which are referenced via dot notation and take the following format:

The first three take a single parameter, the item's ID number. The last takes no parameters. The exact nature of the four routines is as follows.

item.has

This instruction returns whether or not the specified item ID is currently marked as possessed by the player.

Clauseexample code
if statementif (item.has 10)
assignment statement= var1,(item.has 10)

item.add

This instruction will set the internal register for the item ID provided. Like with .has and .drop, defined constants may also be used.

item.add 10
item.add DEFITEM010

item.drop

This instruction will clear the internal register for the item ID provided. Similarly with the previous two instructions, equations may also be used.

item.drop 10
item.drop (+ 10,var2)

item.clr

This instruction will clear all item registers, reseting the player inventory to a known state.