Identifying scrolls & magical items ("Read Magic" style)


I was wondering how people deal with magical items and scrolls. I thought of three different approaches:

  1. Magical items and scrolls have different printed names before and after someone casts READ MAGIC or something similar on them. (I have dealt with this way in my topic Resetting the printed name.

The downside with this is that, even before casting Read Magic on a scroll, someone could still type “TAKE INVISIBILITY SCROLL” and succeed. I don’t really want that.

  1. Magical items and scrolls appear as identified from the start. (The Keep It Simple Stupid solution.) For example:

Thus, I simply place items with their real names, like Scroll of Invisibility or Ring of Painful Handshake or whatever and the player sees them for what they are.

However, this is not my best approach, since I would prefer adding another layer of mystery around such artifacts.

  1. I can use duplicate items:

An ordinary “paper scroll” is placed in the room, while a “Scroll of Invisibility” is placed nowhere. When Read Magic is cast, I swap the items, sending the paper scroll to nowhere and bringing in the Scroll of Invisibility.

My question here would be: how to create a rule that swaps the items, but in a precise (location-wise) way?

I thought about relating them, first, like I discussed in an earlier post of mine on siblings. Then:

Carry out casting the Read Magic Spell on something:
	now the sibling of the second noun is in the location;
	now the noun is nowhere.

However, I don’t know the instruction needed to bring an item on exactly the same position (eg. in the location or on the same supporter if any) as another item. Obviously, if the first item sits on a table, “now the sibling of the second noun is in the location” will not do a great job.

  1. Any other way of dealing with magical items?


Answering your Question 3: the word you’re looking for is “holder”.

Carry out casting the Read Magic Spell on something:
   move the sibling of the second noun to the holder of the second noun;
   now the second noun is nowhere.

The holder of a thing determines its exact position in the object tree; it can be a person, a container, a supporter, a room, or nothing.
(Also, if the thing in question is part of something else, then that something else is the holder.)

Thank you, yes!

By the way, is there a difference between:

move the sibling of the second noun to the holder of the second noun;


now the sibling of the second noun is in the holder of the second noun;


The key to the naming issue is in section 17.15 of Writing With Inform. You can use “Understand” with a property instead of text.

Here’s an example that gives the idea of what to do. You’ll want to substitute casting read magic for examining, of course.

[code]“Scroll Naming”

Generic Room is a room.

A scroll is a kind of thing.
A scroll has some text called spell name.
The spell name of a scroll is usually “blank”.
A scroll has some text called printed spell name.
The printed spell name of a scroll is usually “unread”.
A scroll usually has printed name “scroll”.
Understand “scroll” as scroll.
Understand the printed spell name property as describing a scroll.

Before printing the name of a scroll (called s):
say "[the printed spell name of s] ";

Instead of examining a scroll:
say “You see it is a [spell name of the noun] scroll.”;
now the printed spell name of the noun is the spell name of the noun.

Frotz-scroll is a scroll in Generic Room. It has printed spell name “dusty”. It has spell name “frotz”.

Cleesh-scroll is a scroll in Generic Room. It has printed spell name “musty”. It has spell name “cleesh”.

If you don’t need to distinguish between unidentified scrolls, they don’t need distinct printed names.

I don’t think so. There are some kinds of holder for which “in” isn’t idiomatic, if the second noun is on a supporter or carried by someone, but the phrase still works. (And in fact “now the present is in the player” compiles and moves the present to the player’s inventory, even though it’s weird.)

I’m not too well versed on the internals, but I think that containment, support, and carrying all have the same underlying representation–they all get represented in one giant object tree (which in fact can be displayed with the debugging command TREE). It’s the kind of the parent object in a tree that determines how this relationship manifests itself–if the parent is a container it contains its daughters, if it is a supporter it supports its daughters, if it is a person it carries them. So writing “now foo is in bar” will put foo under bar in the object tree, which will manifest as support, containment, or carrying as appropriate. I could be wrong, though.

Anyway, the reason “move… to…” isn’t totally redundant is that sometimes you want to write “Move the player to [some room], without printing a room description.” You can’t accomplish that with “Now the player is in [some room].”

Thanks Thomas and Matt,

All these are very helpful.

I have actually used the duplicate thing (version 3 in my original question) and it seems to be working out fine so far.

Regarding method 1:

  • Make the scrolls “privately named” to keep the player from referring to them by effect name before using them.
  • Put in a line like “Understand the effect property as describing a scroll.”

Normally I jump on any mention of “privately named” :slight_smile: – but this is a situation where it’s justified. You don’t want the player to “cheat” by typing the code names of the objects and seeing which one reacts.

Another solution would be to name the objects “dusty-scroll”, “musty-scroll”, etc. Then the code names are the ones visible to the player anyway, so there’s no reason for privately-named. But this is obfuscating your own source code in a way that might annoy you, so I won’t argue for it.

“Privately named” sounds interesting; I will have to check it out, in the documentation! :smiley: