|
|
Up |
|
  |
Author: puzzlerpuzzler Date: Dec 29, 2007 05:42
The current flow of rules in Inform 7 is:
before
instead
check
carry out
after
report
I argue that the most commonly desired insertion point for a new rule
is between the check and carry out rules, and sadly, this is the one
insertion point that is NOT provided. Ideally, you want to make sure
that an action is going to be carried out, and then interrupt it right
before it actually is carried out.
Because this desired insertion point is not provided, you can see many
examples in the manual and in the sample code where the instead hook
is used for this purpose. But this is fragile, and is easily broken,
for example, if you add a chair to your game (see example below).
Therefore, the frequent use of instead rules will ultimately result in
potentially buggy Inform code.
|
| Show full article (5.10Kb) |
|
| | 51 Comments |
|
  |
Author: Andrew PlotkinAndrew Plotkin Date: Dec 29, 2007 06:15
Here, puzzler gmail.com> wrote:
> The current flow of rules in Inform 7 is:
> before
> instead
> check
> carry out
> after
> report
>
> I argue that the most commonly desired insertion point for a new rule
> is between the check and carry out rules, and sadly, this is the one
> insertion point that is NOT provided.
It sounds like what you want to do is write a carry out rule which is
listed before the standard carry out rules.
(I7 isn't really structured in terms of insertion points, but in terms
of rulebooks. Some rulebooks have rules by default, some are empty by
default. Rather than trying to provide a "empty hook" between every
possible pair of steps, the language tries to let you control the
whole sequence.)
|
| Show full article (1.65Kb) |
|
| | no comments |
|
  |
Author: puzzlerpuzzler Date: Dec 29, 2007 06:40
> It sounds like what you want to do is write a carry out rule which is
> listed before the standard carry out rules.
I don't see how that would help. Presumably, you mean something like
this:
Carry out entering the green bed for the first time (this is the snake
appearing rule):
say "My goodness there is a snake in the bed!";
move the snake to the green bed;
stop the action.
The snake appearing rule is listed first in the carry out entering
rulebook.
But this doesn't work either. The player still ends up getting into
the bed. The stop the action has no effect. According to the
manual, carry out rules cannot stop the action.
Putting it at the end of the check rules also wouldn't work, because
check rules are forbidden from causing any change.
It really seems that what is needed is a way to make this rule happen
between check and carry out.
|
| Show full article (0.99Kb) |
| no comments |
|
  |
Author: JDCJDC Date: Dec 29, 2007 07:14
On Dec 29, 12:40 am, puzzler gmail.com> wrote:
>> It sounds like what you want to do is write a carry out rule which is
>> listed before the standard carry out rules.
>
> I don't see how that would help. Presumably, you mean something like
> this:
>
> Carry out entering the green bed for the first time (this is the snake
> appearing rule):
> say "My goodness there is a snake in the bed!";
> move the snake to the green bed;
> stop the action.
>
> The snake appearing rule is listed first in the carry out entering
> rulebook.
>
> But this doesn't work either. The player still ends up getting into
> the bed. The stop the action has no effect. According to the
> manual, carry out rules cannot stop the action.
> ...
|
| Show full article (2.01Kb) |
| no comments |
|
  |
Author: puzzlerpuzzler Date: Dec 29, 2007 08:20
> Variation rules is a rulebook. The variation rules have default
> success.
> A first action-specific rule: abide by the variation rules.
>
> A variation for entering the green bed for the first time:
> say "My goodness there is a snake in the bed!";
> move the snake to the green bed.
I tried this code snippet, but it doesn't seem to work. It says the
message "My goodness there is a snake in the bed!", but it doesn't
actually make the snake appear. Am I missing something?
|
| |
| no comments |
|
  |
Author: Emily ShortEmily Short Date: Dec 29, 2007 09:00
On Dec 29, 12:40 am, puzzler gmail.com> wrote:
> Putting it at the end of the check rules also wouldn't work, because
> check rules are forbidden from causing any change.
I'm not sure where you're getting this, but they certainly *can*: for
example,
A last check entering the green bed for the first time:
say "My goodness there is a snake in the bed!";
move the snake to the green bed instead.
appears to do what you want.
The manual may seem to discourage this, but what it means is that you
usually want to isolate world-model changes that result from
successful action in the carry out rules.
There's also nothing to stop you specifically invoking the check rules
as part of an instead rule, if you wanted. For example, this does what
you want:
|
| Show full article (1.23Kb) |
| no comments |
|
  |
Author: TatianaTatiana Date: Dec 29, 2007 12:44
> You can also add enter rulebooks pretty much wherever you want (it
> takes me a little fiddling sometimes to find the right placement). You
> can also set default outcomes (like failure is the default for instead
> rules). Go nuts.
Sort of OT here but maybe not....
What you say here is exactly one of the things I find to be a shortcoming of
Inform 7. And even though Andrew says not to think of "hooks" (and I agree)
but instead think of rulebooks, it's still all...
|
| Show full article (1.22Kb) |
| no comments |
|
  |
Author: James JolleyJames Jolley Date: Dec 29, 2007 13:45
On Dec 29, 11:44 am, "Tatiana" netnews.net> wrote:
> the bigger debate is really whether rule-based systems are a way to go for
> IF.
I think Graham just wanted to explore that avenue. His paper on it
does make good arguments for it being a valuable effort. It will be
interesting to see what others think though, but I wonder what can of
worms you have opened up by bringing this subject up?
All the best
-James-
|
| |
| no comments |
|
  |
Author: TatianaTatiana Date: Dec 29, 2007 17:08
> I think Graham just wanted to explore that avenue. His paper on it
> does make good arguments for it being a valuable effort.
I'm not saying that it may not be a valuable effort, at least to try it. But
rule-based systems are not exactly new. They've been tried numerous times
before in various contexts (including programming...
|
| Show full article (2.70Kb) |
| no comments |
|
  |
|
|
  |
Author: James JolleyJames Jolley Date: Dec 29, 2007 17:35
On Dec 29, 4:08 pm, "Tatiana" netnews.net> wrote:
> Well, if people wanted to "explore this avenue" I'm not sure why this would
> be can of worms. Isn't the goal to explore and then discuss? I've noticed
> some people seem very reluctant to criticize Inform 7 too much, even when
> they're stumbling over some of its roadblocks. People assume *they* are the
> stupid ones for not getting it instead of looking into whether or not
> Inform's way of doing things is viable. IMHO, I think that's a bigger can of
> worms.
I take your point there. I myself like I7 and what it is trying to
offer folks. There are things I find difficult in it as anyone else
does but it seems rather good at what it offers new users. There
aren't many systems to date that have done so much for newcomers. Look
at the entries in the 2006 comp. Primrose path was written by a
complete newby to Inform as I understood it anyway.
|
| Show full article (1.82Kb) |
| no comments |
|
|
|
|