Confused: rules

Hi all,

I’m still getting confused by i7 stuff:

The following works fine and does what it says on the tin:

Rule for printing the banner text when the tutorial_mode is true: do nothing.

The following refuses to compile:

Rule for printing the room description heading when the tutorial_mode is true: do nothing.

with the following error: but the punctuation here ‘:’ makes me think this should be a definition of a phrase and it doesn’t begin as it should…etc…

I’ve got rules on, and it quite clearly says :
[Rule “room description heading rule” applies.]

I am completely baffled as to how to refer to this, how to turn it off, why the first example works and why the second doesn’t. I feel like I should understand this, but I don’t.

Thanks in advance,

McT

You can write “Rule for…” around activities. Printing the banner text is an activity.

The room description heading rule is part of the carry out looking rulebook. It is not an activity, but you can delist it from that rulebook as follows:

The room description heading rule is not listed in the carry out looking rules.

Thank you. So how do I align this with a conditional? i.e. in the previous case, to be only not listed when the tutorial_MODE IS true?

You can now conditionally disable a named rule, like so:

The room description heading rule does nothing when the tutorial_mode is true.

Not only that, but you can conditionally substitute a rule as needed - see §19.5. Changing the behaviour of rules.

Thank you!

So, for clarity,
If it’s a rule, I can write :

The room description heading rule does nothing when the tutorial_mode is true.

but not

Rule for printing the room description heading when the tutorial_mode is true: do nothing.

So, I can change the action of a rule, but not replace the rule.

And some things are action, in which case the reverse it true.

Does anyone not familiar with i7 realise how deeply deeply unintuitive this sort of thing is?

Actions, activities, rules, and rulebooks are distinct concepts in I7, although they overlap in some ways.

I assume you mean to ask people who are familiar with I7… yes, it’s unintuitive. It’s not the system I would have designed. However, I was never able to design the system I would have designed, and Graham shipped his.

I didn’t mean to sound snippy. It’s just that of all the bits of i7 - this rules piece could use a bit of extra documentation. The big confusion I was finding was using multiple semantic meanings for rule.

As zarf says, it’s a bit more intuitive when you appreciate the difference between a rule, a rulebook, and an activity. Emily already explained this, but this may help a bit until you get to the relevant parts of the documentation.

Printing the banner text is an activity. An activity can have rules, but an activity is not quite the same as a rulebook, even though they’re similar. You are allowed to attach rules before (“before …”), attach rules after (“after …”), or overwrite the normal behavior for that activity (“rule for …”).

There’s a whole chapter about Activities in WWI that tries to explain the difference between activities and rulebooks, but it’s definitely not obvious when you’re just starting out. However, it does make more sense in the long run. I tend to think of activities (at least those like “printing the banner text”) as places where what’s being done is part of the lowest-level functionality provided by I6 layer – though that’s not the complete picture.

The “room description heading rule” is a part of the action-processing rules: it’s a rule within the carry out rulebook for the looking action provided by the Standard Rules. There’s another whole chapter about action processing in WWI. You can remove, replace, conditionally disable, or write a new rule more specific than this rule within that rulebook, but when you say “Rule for printing room description heading…” you’re basically asking to create a rule for a rule. That doesn’t make any sense, as you can imagine.

Where you say “I can change the action of a rule, but not replace it,” neither is strictly true. Saying " does nothing when " is changing the action of the associated rulebook, i.e. telling it to skip that rule if the condition is true. A rule can be replaced within a rulebook, if desired, but creating a new rule with specific conditions (e.g. “Carry out looking when tutorial mode is true”) does not automatically replace a similar rule with a different or no condition (e.g. “Carry out looking”).

Why some things are governed by rules and others are governed by activities is not always obvious, and may seem arbitrary, but you will get familiar with the dividing line over time. For now, brace yourself, do some more reading (especially the chapters on Action, Activities, and their code examples in the Recipe Book), and don’t get too frustrated just because I7 is big and complex – the people here are almost always willing to help.

otistdog : That’s a really kind and thoughtful response. Thank you.

Yeah, I can totally see how it’s not the most obvious.

If it helps at all:

– activities tend most often to be used in cases where it seemed like the behavior was going to need a lot of hooks, because we anticipated authors wanting to either make calculations or print text before, during, or after the activity. Various kinds of printing that appear decoupled from action rulebooks are particularly common for this purpose.

– the current way of delisting or conditional-izing rules comes about as a replacement for the procedural rules, which used to be perhaps more obviously different from activity-manipulation. Procedural rules went away as an optimization for speed, though.

Out of curiosity, supposing one were to add to the documentation, where would you have looked for information about this? The actions index currently does show how to unlist this rule once you’ve found it (though admittedly not how to make it apply conditionally).

Hmmmm…Good question. It’s not so much that the information isn’t there. It’s more…concatenating it into a form that enables a developer to choose the appropriate syntax/structure for something I want to do. I’ve read the documentation from end to end (a couple of times). This is, after all, my fourth (well to be honest 3rd - Hard Puzzle hardly counts) game I’ve written in i7. Yet I still find it difficult to know what to look for in the documentation when something new hoves into view.

Rules and acrtions - the replacing of and changing of - seem to be a common thread in this help forum. i.e. How do I stop X showing automatically. The difference between rules, actions and rulebooks might feel obvious, but isn’t. I get it’s enormously useful to differentiate between them, but it feels a useful thing to, maybe, have more in the way of a directed help in the IDE for this. I’m not sure what this would look like. Maybe more worked examples. Maybe a section that lists common things you might be trying to do and how to do them.

I’m being no help! But this is just some feedback from a user of the platform, and might be useful at some point. It would be really cool, if someone were willing, to have workshops on Euphoria every now and again for people to ask questions in real time / work through a real-time examples. That would be awesome! :slight_smile:

McT

At this point I tend to be conservative about adding new examples (barring cases where there’s actually a new feature). It’s not that I’m opposed categorically – I’m willing to think about it. But there are hundreds of them already, which makes me think that a lot of the time whatever people are looking for may well be exemplified already, and the problem is just finding it, so that adding one more piece of hay to the haystack is not going to help.

People do ask realtime questions on the I7 channel on ifMUD, and they get answered by whoever happens to be around and know the answer. The same could happen on an ad-hoc basis on Euphoria, I imagine. Or (she said cautiously, really not volunteering) is there something about having a set workshop time that you would find useful? I would have assumed that synchronizing this kind of thing would just make it less useful to people, since you aren’t guaranteed to have your question at 3 PM Eastern / 8 PM British time on a Saturday…