In Very Vile Fairy File I have a table where one column is a number. It acts as a sort of database of good guesses by the programmer. After some programming, I realized in some cases that number wasn’t always right, and it would be too hard to change it via normal programming methods. Here is an example
table of good rhyme guesses user-input-topic expected-number rule-for-valid "flake flee" 43 is-jake-g-present rule [this indicates that the desired command is 4 letters, then 3. Yes, I could use 2 columns for this, but see below...]
Now, the commands to get Jake moving change, and they change length, So what I did was to change expected-number to 100, then have
to decide which number is actual-word-length of (n - a number): if n is 100: if jake is sleepy, decide on 44; if jake is awake, decide on 43; if jake is fed, decide on 43; if jake is paid, decide on -54; [this is some more magic number trickery. It means the command is an LLP] [more examples but I'll cut it off here decide on 0; [give no hints] say "Uh oh, I didn't find a desired word length for this good guess."; decide on -1; [hint error]
Now, all this works, and it’s been tested. And I don’t have too many cases to keep track of, so magic numbers aren’t a huge deal. But I was wondering how I could track them in general. If I were programming in C or its variants, for instance, I would say
#define JAKE_G_BRANCH 100
#define GOLD_GAOL_BRANCH 101
#define STARK_STUMP_BRANCH 102
And this would make the code more readable.
Is there an easy way to do this in Inform 7 (or do stuff with I6 that would work in I7) so I could put these constants in a table?