Suppose you're making a Lucasarts-style game, and you want all your hotspots to have a default interaction (so if the player right-clicks a window, for example, "Open" will be the default, but if they click on a pen, "Pick up" will be the default).
To do that, surely you would have to script in lots of code to change the default mode over each different object?
This is where Custom Properties come to the rescue. You can create a custom property for "Default interaction", for example, and then have some simple code in the global script to use the setting accordingly.
How do I use them?
You'll notice that characters, objects, hotspots, rooms and inventory items all have a "Properties" button. Click it.
Since you don't yet have any custom properties, you are sent to the Schema Editor. This allows you to create the various properties you want in your game. To begin with you are presented with an empty list box, so right-click in it and choose "Add property".
In the "Add Property" window you can set various options about the new property:
For example, add a new "Boolean" property. Close the schema editor, and then click the "Properties" button again. You'll now have a window with a checkbox with the description text you typed in. You can click the "Edit schema" button there to return to the schema editor if you like.
All types of game item share the same schema. That is, if you create a "Jibble" property in the schema editor for a hotspot, it will also appear in the properties window for characters, objects, and so on.
Getting values in the script
To access the properties from the script, there are various script functions. See their descriptions for how they work:
Character.GetProperty, Character.GetPropertyText
Hotspot.GetProperty, Hotspot.GetPropertyText
InventoryItem.GetProperty, InventoryItem.GetPropertyText
Object.GetProperty, Object.GetPropertyText
GetRoomProperty, GetRoomPropertyText
Custom property values cannot currently be set from within the game script - they are read-only at runtime.
Browser Based Help. Published by chm2web software. |