It’s been a long time since I did anything in Inform, and coming back to it I immediately ran up against a brick wall. I am trying to create an upgrade/tech tree system, and it mostly works properly; but I can’t get the rules to run to actually make any upgrade take effect. The error I get is:
Problem. You wrote ‘consider the exec of the noun’ , but ‘exec of the noun’ has the wrong kind of value: a rule rather than a rule.
I was trying to match this phrase:
consider (exec of the noun - rule)
This was what I found out:
exec of the noun = a property whose value is a rule, holding a rule
Removing the line causing the problem makes the error go away, but I can’t find any way to get the rules to actually run. Any solution or workaround is appreciated.
[spoiler][code]EXP is a number that varies. EXP is 3.
An upgrade is a kind of thing. Some upgrades are defined by the Table of Improvements.
Table of Improvements
upgrade cost prereq (list of objects) got exec (nothing based rule producing nothing)
Newstuff 1 {} False new stuff rule
Otherstuff 1 {} False new stuff rule
Morestuff 1 {Newstuff,Otherstuff} False new stuff rule
This is the new stuff rule:
say “Hello”
The player carries an upgrade tablet.
When play begins: now every upgrade is part of the upgrade tablet.
Definition: an upgrade (called X) is available:
if X is not part of the upgrade tablet:
decide no;
choose a row with an upgrade of X in the Table of Improvements;
if got of X is true:
decide no;
if prereq of X is empty:
decide yes;
repeat with U running through prereq of X:
if got of U is false:
decide no;
decide yes.
Listing upgrades is an activity.
Before printing the name of an upgrade (called X):
if the got of X is true:
say "(* ";
else if X is available:
say "( ";
else:
say "(X ".
After printing the name of an upgrade (called X):
if the got of X is true:
say " *)";
else if X is available:
say " )";
else:
say " X)".
An upgrade has a text called the tree. The tree of an upgrade is usually “N/A”.
To say nada:
do nothing.
The tree of Newstuff is
“[fixed letter spacing][Newstuff] [Otherstuff][line break]
[nada] \ /[line break]
[nada] [Morestuff][variable letter spacing]”
Instead of examining the upgrade tablet:
repeat with X running through upgrades that are part of the tablet:
if the tree of X is not “N/A”:
say the tree of X;
say paragraph break.
Instead of buying or taking an upgrade:
If got of the noun is true:
say “You have already purchased that upgrade.” instead;
if the noun is not available:
say “That upgrade is not currently available.” instead;
if the cost of the noun is greater than the EXP:
say “You cannot afford that upgrade.” instead;
decrease the EXP by the cost of the noun;
now got of the noun is true;
consider the exec of the noun;
rule succeeds.
Place is a room.
[/code][/spoiler]