I have a mysterious problem, but I think it stems from my not understanding what looks like a global variable.
ActiveService is a kind of value. ActiveService is none, loaning, and repaying.
then later in the code I try to print it out:
...
if player consents:
now ActiveService is loaning;
say "Active service = [activeService]";
I get a parsing error?!
You wrote ‘say “Active service = [activeService]”’ but ‘activeService’ is used in a context where I’d expect to see a (single) specific example of a sayable value, not a description.
The Index shows that ActiveService is a sayable value, so why the error?
This value for ActiveServie is causing tests to fail intermittently.
ActiveService is a kind of value.
The currentService is an ActiveServices that varies. CurrentService is none, loaning, and repaying.
The parser kicks out: The sentence ‘CurrentService is none, loaning, and repaying’ tells me that ‘currentService’, which is an activeservice that varies, should start out with the value ‘none’, but this is an object and not an activeservice.
I’m totally in the fog about this. I get the kind part, but how can an currentService as none (or anything else) be an object?
I tried to follow the docs:
Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing.
Unless I misunderstand, this should be a working variation of the code in the OP.
lab is a room.
ActiveService is a kind of value. ActiveService is none, loaning, and repaying.
CAS is an ActiveService that varies.
instead of jumping:
now CAS is loaning;
say "Active service = [CAS]";
say line break;
In the code except you cited in the post Nathaniel was replying to, you didn’t define the possible values when you set up the kind - you just said the specific instance was [list of values], but inform didn’t know what to do with that.
To zoom out a bit, the broader issue is that a kind of value isn’t a thing that exists in the world but rather a statement about the kinds of things that can exist in the world. So you need to both tell Inform “ActiveServices are this sort of thing, here’s what they can look like” - via creating the kind and its possible values - but also “here’s one particular ActiveService that I want to create, modify, and check.”
Hopefully that distinction is clear in the excerpt Drew posted above - personally I find the difference makes sense in theory but I often struggle to come up with names for the kind and specific examples that feel intuitive. So spending a little time figuring out good names at the get-go can often make it easier once you need to start using this stuff; based on the context it seems like this is basically about loans, right? So maybe “Loan status is a kind of value… indebtedness is a loan status.” Or something like that?
Yeah, I think that’s a great craft question! My usual thought is that names ought to be whatever feels most readable to the author. Inform is pretty flexible about naming things, so my own ideal is reaching a compromise between readability (it makes sense at a glance) and time to type.
In my own practice, I usually have longer kind names and shorter variable names.
Still, people have different reading and retention strategies, so ultimately an author should choose names that will help them read and write their own code.