Inline Implicit Library

I am working with Jon Ingold’s “Considerate Holdall” and I have nearly got it running but I cannot figure out this inline implicit library deal.
Here is the part from his extension:

[code]Use inline implicit library translates as (- Constant INLINE; -).

[section in code that has problem]
if the current stashable thing is a thing begin;
[ we’re happy with the combination of stashable thing and holdall… ]
if using the inline implicit library option begin; [THIS IS THE LINE THAT IS GIVING TROUBLE]
[ this is an entry point for implicit libraries, such as Eric Eve’s, to use, to tidy up more complicated lines. ]
spit inline library message as appropriate for the current stashable thing into the considered holdall;
if the current stashable thing is not inside the considered holdall, stop the action;
otherwise;[/code]

I have the holdall named in my source as follows:

The carrying capacity of the player is 5. The backpack is an open container. The player carries the backpack. The backpack is a player's holdall.

This will not compile. I have looked at everything I can find but cannot solve the problem. I am actually wondering if I even really need this in the code as the extension is the only definition being used for the holdall. Any ideas will be greatly appreciated.

You say it doesn’t compile. What is the error message?

In Inform 6L02 (and later) “if using the inline implicit library option” has been changed to “if the inline implicit library option is active.” Change that line and you should get the intended result, if there isn’t anything else that needs updating.

(What this does is it allows the author of the main program to make a certain change in the behavior of the extension by writing “Use inline implicit library”–if the author puts that line in their source code then the stuff after the “if using…” line will happen. See “Use options” in the Inform manual. So you don’t need it at all if you know whether you want to use inline implicit library or not–though then again if you want to use the extension in more than one project you might want to have it around, and in any case it’s probably easier to just change that line than to figure out what you need to zap.)

By the way if you’re fixing up old extensions so they will compile for the latest Inform you might want to post them here. I’m sure many people would appreciate it!

Now that I’ve looked at the source text for Considerate Holdall, it looks like the “spit library message” business involves a lot of Inform 6 inclusions that I think have been changed for the latest Inform releases and that would be pretty annoying to try to change if you don’t know Inform 6. That is, stuff like this:

(- GL__M(##Take,12); -)

It also seems pretty contrary to the spirit of the latest Inform, where instead of having library messages you have rule responses–so instead of saying “spit library message as appropriate for the current stashable thing into the considered holdall” you might write something like:

say "[We] [put] [the current stashable thing] into [the considered holdall]." (C)

–see section 14.10 of the documentation on response rules for this. Unfortunately figuring out the actual text that is supposed to go in here is non-trivial, or at least is more work than I’m going to do right now. I also don’t know what Jon meant by implicit libraries like Eric Eve’s, so I’m not quite sure what you would want to do there. But this may be a bit more work than just fixing the “if using inline implicit library option.”

(One suggestion–don’t give the player an inventory limit and don’t bother with the holdall. Inventory limits and holdalls are a bit passé, because players often find it easier to suspend disbelief about the number of things they’re carrying than to spend a lot of time foofing around with putting stuff in their holdall. I say this, hypocritically, as someone who always complains about inventory limits and who put an inventory limit in his last game.)

The idea about posting your updated version still stands, though!

Thanks for the advice and direction. I typed the keywords into my Adobe doc search for 6L02 and did not see that, course I was getting pretty crossed eyed trying to find a solution to the problem. That Inform 6 code is still above my head so doubt I would have caught that for a bit yet. I will work on these new angles, thanks again for all of the help.

I believe it refers to extensions like “Implicit Actions” and “NPC Implicit Actions” by Eric Eve, which simplified things like implicit opening (before it was included in the Standard Library).

I will go through the ones I am working with and post them, that’s a great idea Matt. Mostly they are small changes that I understood from my initial studies. A few are more difficult as can be seen by the posts I have created.

I may revisit this as time goes on. I am going to write with the idea that this may be altered or deleted in future episodes.

Yeah, I think the word that would’ve got that for you would’ve been “using,” which is not much help as a search term. I only caught this because I’d just been looking at that section of the changelog. And the Inform 6 code is over my head too–the only reason I recognize this as an issue is because I copy-pasted some I6 code from the new parser to replace some similar bits in another of Jon’s extensions.

That makes the functionality seem kind of… old. I really can’t figure out what that code is doing at all, though.

It does some other nice things as well, such as reporting “(first unlocking the cabinet, then opening the cabinet, then trying to take the spatula)”. But yes. I am quite confused by that section as well, as I can’t find where __stash is defined (in the templates or an extension).

Well, when I tried to compile a project with it under 6G60, I got a No such constant as “__stash” I6 error. (I just took the first example from the Considerate Holdall documentation and added “Use inline implicit library.”) Could it be from an older version of Inform’s I6 templates? Have you got anything to compile and use that?

Got the inline implicit library lines to work (made a note to try deleting, or updating, them in the future), As you state in the quote Draconis their is probably issues with the Inform 6 side but the first line causing problems comes before the _stash line, it is

(- GL__M(##Take,12); -)

and produces the following error.

auto.inf(21076): Error:  No such constant as "GL__M"

I will try to hunt for this fix. I also searched for the _stash issue but have not found anything yet.

EDIT-

I have searched heavily for these Inform 6 Inclusions and I have found GL__M in the 6F95 Build but none of these appear to work any longer and I cannot find any info on fixing them. Here is the end of the Main Loop in Considerate Holdall

[code]To spit library message for failure of holdalls:
(-GL__M(##Take,12,);
-)

To spit inline library message as appropriate for (n - a thing) into (s - a thing):
(- SACK_OBJECT = {s}; #ifdef INLINE; __stash({n}); #endif;
-)

To spit library message as appropriate for (n - a thing) into (s - a thing):
(- SACK_OBJECT = {s}; GL__M(##Take,13,{n});
-)[/code]

It seems that all of this would need to be deleted which would require a complete re-write of section 3 in the extension as well as some associated lines throughout the extension.

2nd EDIT (let me see how many edits I can get into this post)

I went back to the Inform 6 code above and it looks like its only function is to return some sort of default action, whether that is to do something, say something, or to cause another action I am not sure. It looks to me as if the extension is writing an end rule to display default messages following certain conditions, true or false, in the stashing of objects in the holdall. With this in mind I simply replaced the Inform 6 inclusions with simple say “message” lines and the extension compiles nicely. I will have to run some conditions in game to determine if this is the correct function for these bits of code but I do have all my fingers crossed.

L__M and GL__M were the old way of printing “library messages”, which were replaced by the Response system in 6L02. Setting the SACK_OBJECT might be important, but I don’t think printing library messages ever had side effects. Using Responses instead shouldn’t cause any problems.

Revised version of Jon Ingold’s Considerate Holdall, will compile in 6L38
Original code that has been changed has been commented out

[code]Version 9 of Considerate Holdall by Jon Ingold begins here.

[revised by Albert Minugh]

“Provides an improving stashing mechanism for the player’s holdall. Objects that haven’t been used in a long time will be stashed first. A rulebook is provided to contextualise the stashing process.”

A thing can be stashable or unstashable. A thing is usually stashable.

Use inline implicit library translates as (- Constant INLINE; -).

Section 1 - remembering handled items

Table of Recent Items
recent item time
a thing a time
with 15 blank rows

To decide if (item - a thing) is not a recently handled item:
if the item is not a recent item listed in the Table of Recent Items, decide yes;
decide no.

Definition: a thing is forgotten-about if it is not a recently handled item.

Before when the noun is a thing:
if the noun is not unstashable, note the noun.
Before when the second noun is a thing:
if the second noun is not unstashable, note the second noun.

To note (n - a thing):
if the n is a recent item listed in the Table of Recent Items begin;
now the[change] the time entry is[to] the time of day;
otherwise;
sort the Table of Recent Items in time order;
if the number of blank rows in the Table of Recent Items is zero, choose row 1 in the Table of Recent Items;
otherwise choose a blank row in the Table of Recent Items;
now[change] the recent item entry is[to] the n;
now the[change] the time entry is[to] the time of day;
sort the Table of Recent Items in time order;
end if;

The considerate player’s holdall rule is listed instead of the use player’s holdall to avoid exceeding carrying capacity rule in the check taking rules.

Section 2 - Rulebooks, one for each type

part 1 - Holdall rules

The holdall rules are an object-based rulebook. The holdall rules have outcomes allow stashing (success), no decision (no outcome - the default) and disallow stashing (failure).

Holdall rule for a thing not enclosed by the player: disallow stashing.

Holdall rule for a thing (called the item) when multi (this is the remove all from a holdall rule):
if taking something inside the item, disallow stashing;

Holdall rule for a closed player’s holdall (this is the require an open holdall rule):
if the inline implicit library option is not active,[if not using the inline implicit library option] disallow stashing;

A holdall rule for a thing (called the item) (this is the check the size of a holdall rule):
if item provides the property carrying capacity and the number of things in item is at least the carrying capacity of item, disallow stashing.

The last holdall rule: allow stashing.

A player’s holdall can be CHavailable or CHunavailable. A thing can be CHviable or CHunviable.

To decide if multi: (- (multiflag) -).

part 2 - Stashable object rules

The stashing rules are an object-based rulebook. The stashing rules have outcomes allow stashing (success), no decision (no outcome - the default) and disallow stashing (failure).

Definition: a thing is a body-part if it is a part of the player.

First stashing rule for thing (called the item): if the item is unstashable, disallow stashing;
Stashing rule for the considered holdall: disallow stashing.
Stashing rule for something enclosing the considered holdall: disallow stashing.
Stashing rule for a body-part thing: disallow stashing.
The last stashing rule: allow stashing.

section 3 - the main loop

The considered holdall is a thing that varies. The current stashable thing is a thing that varies.

This is the considerate player’s holdall rule:
[ if you’ve got too much in your hands…]
if the number of things carried by the player is at least the carrying capacity of the player begin;
now every player’s holdall is CHunavailable;
repeat with current holdall running through player’s holdalls enclosed by the player begin;
[ mark-up holdalls to see if they’re appropriate to use…]
follow the holdall rules for the current holdall;
if the outcome of the rulebook is the disallow stashing outcome, now the current holdall is CHunavailable;
if the outcome of the rulebook is the allow stashing outcome, now the current holdall is CHavailable;
end repeat;
repeat with current holdall running through CHavailable player’s holdalls begin;
[ try each holdall individually… hopefully we won’t actually have to try very many! ]
now[change] the considered holdall is[to] the current holdall;
repeat with item running through things carried by the player begin;
[ see if we can stash items in this particular holdalll… ]
follow the stashing rules for the item;
if the outcome of the rulebook is the disallow stashing outcome, now the item is CHunviable;
if the outcome of the rulebook is the allow stashing outcome, now the item is CHviable;
end repeat;
now[change] the current stashable thing is[to] a random forgotten-about CHviable thing held by the player;
[ is there anything you could stash which you’ve never used…? ]
if the current stashable thing is not a thing begin;
[ if not, find the oldest thing we can stash … ]
repeat through Table of Recent Items in time order begin;
if the recent item entry is CHviable and the recent item entry is carried by the player begin;
now[change] the current stashable thing is[to] the recent item entry;
[ we’re happy with this item .]
break;
end if;
end repeat;
end if;
if the current stashable thing is a thing begin;
[ we’re happy with the combination of stashable thing and holdall… ]
if the inline implicit library option is active begin;[if using the inline implicit library option begin]
[ this is an entry point for implicit libraries, such as Eric Eve’s, to use, to tidy up more complicated lines. ]
spit inline library message as appropriate for the current stashable thing into the considered holdall;
if the current stashable thing is not inside the considered holdall, stop the action;
otherwise;
[ try putting it away, and report if we managed to … ]
try silently inserting the current stashable thing into the considered holdall;
if the current stashable thing is not inside the considered holdall, stop the action;
spit library message as appropriate for the current stashable thing into the considered holdall;
end if;
continue the action;
end if;
end repeat;
[ we give up! ]
spit library message for failure of holdalls instead;
end if;

To spit library message for failure of holdalls:
say “You cannot put that in there.”[(-GL__M(##Take,12,);
-)]

To spit inline library message as appropriate for (n - a thing) into (s - a thing):
say “You succeed in stashing the object.”[(- SACK_OBJECT = {s}; #ifdef INLINE; __stash({n}); #endif;
-)]

To spit library message as appropriate for (n - a thing) into (s - a thing):
say “You succeed in stashing the object.”[(- SACK_OBJECT = {s}; GL__M(##Take,13,{n});
-)]

Include (- Constant CONSIDERATE_HOLDALL; -).

Considerate Holdall Revised ends here.
[/code]

1 Like