Rules and line breaks

Here is some code:

[code]“Mind” by Victor Gijsbers

Test lab is a room.

Asking status is an action out of world. Understand “stats” as asking status.

Carry out asking status:
say “[bold type]Mind[roman type]: [mind][paragraph break]”.

The mind bonus rules are a rulebook.
Mind score is a number that varies.

To decide which number is the mind:
now mind score is 0;
consider the mind bonus rules;
decide on mind score.

A mind bonus rule:
increase mind score by 1.[/code]
Typing “stats” gives us:

If you comment out the mind bonus rule, the line break between “Mind:” and “1” disappears. Why is this rule – which doesn’t ‘say’ anything – inserting a line break?

It seems that the only way to get around the problem is by writing

Carry out asking status: say "[bold type]Mind[roman type]: [run paragraph on][mind][paragraph break]".
but I don’t understand why that is necessary. Any thoughts?

1 Like

There is some system in there which adds an line break between messages from different rulebooks. I do not understand it very well.

The I6 function “ProcessRulebook” includes the I6 function “DivideParagraphPoint”, which causes it to automatically adds line breaks when it sees fit. Try this.

[code]“Mind” by Victor Gijsbers

To process (RL - a rule): (- ProcessRulebook({RL}, 0, true); -).

Test lab is a room.

Asking status is an action out of world. Understand “stats” as asking status.

Carry out asking status:
say “[bold type]Mind[roman type]: [mind][paragraph break]”.

The mind bonus rules are a rulebook.
Mind score is a number that varies.

To decide which number is the mind:
now mind score is 0;
process the mind bonus rules;
decide on mind score.

A mind bonus rule:
increase mind score by 1.[/code]

You need to set the third parameter “bits” to true in order to suppress line breaks, as is done for activities such as “printing the name of something”.

Hope this helps.

1 Like

Thanks!

Appendix A also reveals that when considering (or following) rulebooks based on other values than actions, the offending argument is set to true by default.

So this, too, gives the desired output:

Test lab is a room.

Asking status is an action out of world. Understand "stats" as asking status.

Carry out asking status:
	say "[bold type]Mind[roman type]: [mind][line break][bold type]Body[roman type]: [body][paragraph break]".

The bonus rules are a number based rulebook.
Mind score is a number that varies.
Body score is a number that varies.

To decide which number is the mind:
	now mind score is 0;
	consider the bonus rules for the mind score;
	decide on mind score.

To decide which number is the body:
	consider the bonus rules for the body score;
	decide on body score
   
A bonus rule for the mind score:
	increase mind score by 1.

A bonus rule for the body score:
	increase body score by 1.

EDIT: Well, no! It obviously doesn’t give you the desired output.
It does prevent the line break, but it doesn’t compute the figures.
I suppose I must have messed the syntax up somehow.

This works as expected:

[code]
Test lab is a room.

Asking status is an action out of world. Understand “stats” as asking status.

Carry out asking status:
say “[bold type]Mind[roman type]: [mind][line break][bold type]Body[roman type]: [body][paragraph break]”.

The mind bonus rules are a number based rulebook.
Mind score is a number that varies.
Body score is a number that varies.
The body bonus rules are a number based rulebook.

To decide which number is the mind:
now mind score is 0;
consider the mind bonus rules for the mind score;
decide on mind score;

To decide which number is the body:
follow the body bonus rules for the body score;
decide on body score

A mind bonus rule:
increase mind score by 1;

A body bonus rule:
increase body score by 1;[/code]
But you could equally well write “consider the mind bonus rules for 0 [or whatever number]”, so the above is pretty inelegant.
Of course, there’s gotta be a way to have a single bonus rulebook take care of both mind and body score bonuses: I just suck at writing value-based rulebooks.

I have no experience writing these rulebooks, but it seems to me that you’d have to pass both the initial score and some parameter that told you which score you’re calculating: body or mind… and I see that you can’t actually have a rulebook based on two values. Maybe that’s hackable with a new kind, but in this case the initial value is always zero. Maybe we can do that with zarf’s abstract-stat parameter from here:

[code]“Mind” by Victor Gijsbers

Test lab is a room.

Asking status is an action out of world. Understand “stats” as asking status.

An abstract stat is a kind of thing.
Body-stat is an abstract stat. The printed name of body-stat is “body”.
Mind-stat is an abstract stat. The printed name of mind-stat is “mind”.
Spirit-stat is an abstract stat. The printed name of spirit-stat is “spirit”.

To decide what number is the (stat - abstract stat) in numbers:
if stat is:
– body-stat: decide on the body;
– mind-stat: decide on the mind;
– spirit-stat: decide on the spirit.

Body score is a number that varies. Mind score is a number that varies. Spirit score is a number that varies.

To decide what number is the mind:
now mind score is 0;
consider the bonus calculating rules for the mind-stat;
decide on mind score.

To decide what number is the body:
now body score is 0;
consider the bonus calculating rules for the body-stat;
decide on body score.

To decide what number is the spirit:
now spirit score is 0;
consider the bonus calculating rules for the spirit-stat;
decide on spirit score.

The bonus calculating rules are an abstract stat based rulebook.

Bonus calculating body-stat: increase body score by 1.
Bonus calculating mind-stat: increase mind score by 2.
Bonus calculating spirit-stat: increase spirit score by 3.

Carry out asking status:
repeat with stat running through abstract stats:
let stat-name be indexed text;
now stat-name is the printed name of stat;
now stat-name is stat-name in sentence case;
say “[Stat-name]: [stat in numbers]. [run paragraph on]”;
say line break.
[/code]

This is working in this case, but I’m not sure if it scales up to a case where you want to calculate stats for different people – how can you pass a person and an abstract stat to the bonus calculating rules? And the indexed text is unfortunate. If the real problem is the spurious line break, climbingstars’s I6 solution is probably what we want.

The whole extra-linebreak thing only comes up for printed messages. You can avoid the whole schmear by doing this:

Carry out asking status:
   let N be the mind;
   say "[bold type]Mind[roman type]: [N][paragraph break]".

EDIT-ADD: Actually I guess it’s also a problem between printed messages. So if you’d printed something before the “let N be mind” phrase, you’d run into the same problem. You can often avoid this, however.

I see this code has the same effect, in a more localized way:

To skip upcoming rulebook break: (- say__pc = say__pc | PARA_NORULEBOOKBREAKS; -).

Carry out asking status:
	skip upcoming rulebook break;
	say "[bold type]Mind[roman type]: [mind][paragraph break]".
1 Like

Returning to this topic,

re: climbingstars’s neato ‘process a rule’ trick to run a rule/rulebook without the extra linebreaks:

To process (RL - a rule): (- ProcessRulebook({RL}, 0, true); -).

I just wanted to ask, what does the above code actually do to the rulebook? Does it follow it, consider it, abide by it?.. etc.

  • Wade

It is a “consider” invocation.

(“Abide” checks the return value of ProcessRulebook() and possibly returns. “Follow” invokes a difference entrance point, FollowRulebook(), which goes through the procedural-rules stuff.)

Following on the zarfian description above, the code is based on the consider code from The Standard Rules.

To consider (RL - a rule): (- ProcessRulebook({RL}); -).

Basically, ProcessRulebook takes 3 variables, two of which are optional. The first is for the rule, the second is for a value when the rule takes one and the third is a truth state deciding whether to print line breaks or not. We simply set the second one to zero (or the null value) so we can reach the third one in order to set it to true.

Hope this helps.

1 Like

Right. I think I can get away with Considering the rulebook from which I want to eliminate extra breaks.

  • Wade

Zarf, I just wanted to thank you for “skip upcoming rulebook break”. I have just achieved Inform 7 line spacing zen and can finally turn off TRACE_I7_SPACING and go to bed. Feels good

1 Like

I’m pretty sure that there’s nothing zen about Inform 7 line spacing.

I dunno, I’d describe it as koan-like.

I have just achieved the motorcycle maintenance of disambiguation.

So I suspect I’m running into this problem again now in 6L38. The problem is with Flexible Windows. When you run the refreshing activity it changes to another window, runs the for rules (for you to fill it with content) and then in an after rule changes back to the main window. An extra line break is printed however in the main rulebook, ie after the after rules.

But from looking at the code, ProcessActivityRulebook() calls FollowRulebook() with the third parameter set to true. From looking at FollowRulebook’s code, that should prevent the line breaks, I think.

Any ideas? How can I determine where the line break is actually being printed?

Under 6G60, I would use Brady Garvin’s debugging tools to step through to find out which library routine was calling line breaks. It was tedious, but usually effective.

So I tried adding “say run paragraph on;” after the carry our activity phrases, and it has stopped the extra line breaks, but it has also removed one line break from the response to the look command. Rather than doing that, would it be better to push/pull say__p and say__pc before carrying out the activities?