[I6] Invisible Inventory Items

Hello everybody,

I have a few invisible objects in the player’s inventory to make the parsing of a few abstract things easier. In the standard inventory (not overlayed with an own one) these invisible objects take up an empty line, like this:

You are carrying:

some stuff
some more stuff

How can I delete these empty lines? I tried “invent [; rtrue;],”, and even some fiddling with @get_cursor and @set_cursor, but to no avail.

Thanks and kind regards,
Grues

I don’t have a working Inform compiler on here so I can’t test this, but does the “concealed” flag stop it from being listed in the inventory?

It does.

Hm. It doesn’t in my case. The handbook says “On once being picked up, a concealed object ceases to be concealed.” I move the objects into the player at the beginning of the game, and even if I “give (them) concealed” after the move, they’re still being listed. :frowning:

As a fallback option I could probably overlay the standard inventory routine with an own one, but to avoid follow-up problems I’d really like to settle this smoothly.

Maybe something with an Invisible_Item class to make it easy to declare which items don’t show in the inventory, then let c_style = “”; in that class’s invent property to take care of the line returns…

Class Invisible_Item
    with
    invent [;
        if (inventory_stage == 1 && self in player) {
            c_style = "";
            rtrue;
        };
    ],
;

Object -> Gem "gem" class Invisible_Item
    with
    name "gem" "diamond",
    description [;
        print "OOoooOooOOo! SHINY! Put that in your pocket and speak not of it!^";
    ],
;

Little edit to the above just now. It’s probably kludgy, but it does appear to work.

It may be easier to keep those objects in scope by giving the player object an add_to_scope property.

Fiddling with c_style resulted in the entire inventory being reformatted, so I pushed that away. But scope worked, a simple

[ InScope;
		PlaceInScope(obj);
		rfalse;];

did the trick. Thanks!!!

Looks like I’m too late, but here’s a way to do it without fiddling in I6.

[code]Arena is a room.

A thing can be insubstantial.

A rock is here. A map is here.
conceptual metaphor is here. conceptual metaphor is insubstantial.

A temp box is a container.
Before taking inventory:
repeat with item running through things enclosed by the player:
if item is insubstantial:
move item to temp box.

Last report taking inventory:
if something is in temp box:
repeat with item running through things in temp box:
move item to the player.
[/code]

You can make an object concealed and start it off in the player’s inventory, like so:

Object hidden_obj "If you see this, it didn't work." selfobj
has concealed;

To move it to the player whilst keeping it concealed, you may want to write a routine to fix this problem, E.G.

[ MoveConcealed o l;
move o to l;
give o concealed;
];

Then, let’s say you want to move a topic (or some such) to the player, you’d run MoveConcealed() like this:

MoveConcealed(player, topic)

I compiled all of these tests under Inform 6.33, library 6.12.1 and it works properly on my end.

…Except for the missing semicolon in the MoveConcealed() example, of course.

The original question was about I6.

In I7, you can (again) add it to scope, or make the object part of the player.