Still very much a newbie, I was wondering if there was a particular solution for a situation one should come across quite often.
For examle, when the player asks the NPC the same question twice, there surely should be a different response to the second question. (“I already told you”, or such.)
I know, this can be realized with flags attached to the situation, raising them etc., but this seems to be a bit cumbersome if it is to be repeated every time, so I wondered if there is a particular mechanism which would help to decide whether any situation is encountered for the first time, or if it’s already “known”, something like –
life[;
ask:
switch(second){
'runestone': firsttime("It's an ancient runestone.");
"Have you already forgotten?";
}
Or similar.
Is there a mechanism like this in place, or does it have to be reimplemented each time?
You might want to download my EventList extension for I6. (It’s in the if-archive, at http://www.ifarchive.org/indexes/if-archiveXinfocomXcompilersXinform6XlibraryXcontributions.html.) It allows you to create TADS-style event lists of various kinds, including the “stopping” kind. After creating such a list with the replies you want, you can call the list object from your life or orders routine (or from wherever you like).
The “general” attribute is great for doing one-shot stuff. Consider this:
Object -> TeflonBlock "teflon block"
with name "block" "of" "teflon",
description "It's a block of slippery teflon.",
before [;
Take:
if (self hasnt general) {
give self general;
"You try to pick up ", (the) self, " but it slips out of your fingers.";
}
print "Carefully, you pick up ", (the) self, " so it doesn't slip.^";
AttemptToTakeObject(self);
rtrue;
];
The “general” attribute is intended as a catch-all for whatever one-off purpose you can think of. I’ve used it for one-shots, toggling frozen/unfrozen state, and more. For lots more examples of the use of the general attribute, see the source code for my Shadowgate reimplementation.