Programming Inform


21 May 1995 11:57:26 +0100

I am a first-time writer using Inform. In my game there are a few occasions
where I need numeric values to be stored for later use. For example:

An object, players_money, is defined to hold the current amount of cash the
player has. The amount is stored as a number of cents (eg, 500) and
converted to dollars and cents by the verb 'count' (eg, $5.00). I can see
three ways to store this information:

a) in a global variable -- eg,
Global your_money = 500;

b) by using the property 'number' and giving it the value 500 -- eg,
Object players_money "money"
with ...,
number 500,
...;

c) by creating a new property, say 'value', and using it in the Object
definition -- eg,
Property long value;
...
Object players_money "money"
with ...,
value 500;
...;

Is one of these possibilities preferable to the others? Will large-scale use
affect the speed (compiling and run-time)? Is it just a matter of preferred
source-code style (in which case, have I wasted your time? Sorry).

Any advice appreciated.

-- 

Jools jools@arnod.demon.co.uk