Roger Firth's IF pages | ![]() |
InFancy -- using Inform objects | ![]() |
![]() |
Here's a quick roundup of some of the standard object property variables and attribute flags, and how you can use them at run-time.
The Inform Library defines about 48 property variables (those marked "++" are additive, explained when we cover classes):
add_to_scope |
d_to |
grammar |
n_to |
react_after |
u_to |
The Library also defines about 31 attribute flags:
absent |
edible |
light |
on |
scenery |
visited |
These definitions are heavily inter-related with the actions and verbs supplied with the standard Library: for example, the verbs WEAR/DON and REMOVE/SHED/DISROBE/DOFF invoke the actions Wear and Disrobe respectively; these in turn use the object's clothing and worn attributes. But that doesn't stop you using Library attributes for your own purposes, if that makes logical sense, and it certainly doesn't prevent you from creating your own definitions.
Compare and contrast:
A property variable ... |
Whereas an attribute flag ... |
is usually a single (16-bit) word, but can be an array of up to 32 such words |
is always stored as a single bit |
can contain anything: a number, an address of a dictionary word, a (pointer to a) string, a (pointer to a) routine |
is either true (on, present, set) or false (off, absent, unset) |
may either be a common property, pre-declared by the directive Property prop_name; (as are all of the standard 48), or an individual property. A common property applies to all objects whereas an individual property, which can be instantiated simply by using a new prop_name in the with segment of an object definition, applies only to that object. Only 62 common properties can be declared, but there is no effective limit on the number of individual properties (so those are what I recommend you to use) |
are all common, pre-declared by the directive Attribute attr_name; (as are all of the standard 31). An attribute applies to all objects. Only 48 attributes can be declared |
can be tested at run-time by if (iname provides prop_name) ...; and by statements like if (iname.prop_name == value) ...; (for an array, by statements like if (iname.&prop_name-->0 == value) ...; ) |
can be tested at run-time by if (iname has attr_name) ...; and if (iname hasnt attr_name) ...; |
can be changed at run-time by iname.prop_name = value; (for an array, by iname.&prop_name-->0 = value;) |
can be changed at run-time by give iname attr_name; and give iname ~attr_name; |
the property variable number is defined by the Library but not used; it is freely available in every object for you to use for your own purposes |
the attribute flag general is defined by the Library but not used; it is freely available in every object for you to use for your own purposes |
Notes
In the next pages, we'll talk about some of the more commonly-encountered properties and attributes, starting with those that control the object's name and the way that it's addressed.