written text...

I am experimenting to see if I can get a player to be able to write something on something, and I wondering why the following will not work…

Writing it on is an action applying to a topic and a thing and requiring light. Whatiwrote is a text that varies. Whatiwrote is "". After writing a topic on the piece of paper: say "You desecrate the virginal surface with your chicken scratching."; now whatiwrote is "[the topic understood]".

That part of the code seemed to work–it assigned the correct value to the text variable, but when I read the piece of paper, which is described by the following code—

A piece of paper is here. The description is "[blurb]". To say blurb: if whatiwrote is "":[if I did not write anything on it, yet] say "This is a blank piece of paper. Nothing is written on it."; otherwise:[if I had] say "It is something upon which you have written--[paragraph break][italic type][whatiwrote][roman type][paragraph break]You are a genius, Tolstoy."

—I get–
It is something upon which you have written–

paper

You are a genius, Tolstoy.

Can text variables not remain constant when you define them with [the topic understood]??

Thanks

It’s because you’re using “the topic understood” as a text substitution, which means that the last topic understood is checked every time the substitution is called.

It’ll work as you intended if you remove the brackets and quotation marks from ‘now whatiwrote is “[the topic understood]”’

Like this:

After writing a topic on the piece of paper: say "You desecrate the virginal surface with your chicken scratching."; now whatiwrote is the topic understood.

Oh my gosh. I thought I had tried every little thing. I thought that when you use a text variable, you would have to refer to any possible value using quotes and substitution brackets. Thank you so much. Your suggestion worked.

It should also work to use the “substituted form” phrase:

now whatiwrote is the substituted form of “[the topic understood]”.

(Haven’t tested to make sure, though.)

Thanks, zarf. Being able to do this(have the player write things) seems to open up a number of possibilities…although at some point what the player writes will probably have to match a topic in a table, but I like this possibility…

Zarf, your suggestion worked as well.

Next question…although I have included a Check rule to say “But you don’t have anything to write with.”, if the player doesn’t have a writing implement, the player may wish to type “Write I don’t know what I am doing. on the paper with the ballpoint pen”. That refers to three nouns-- the text, the paper and the pen. Can I alter my ‘Writing it on’ action to allow three nouns? Maybe I can use an Understand to include mention of the writing implement…??

Never mind—it worked. I used 'Understand “write [text] on [something] with the ballpoint pen” as writing it on. Of course, I will have to write an Understand rule for every moniker that a player is likely to use for the implement–and any other implement I should create–this can be tedious, but I like it as a possibility. Thanks

The only trouble is, what if I want each writing implement to have a unique affect? If I have three different ‘styluses’(‘A stylus is a kind of thing. The ballpoint pen, the stumpy pencil, and the sharpee are styluses.’) What I have so far does not differentiate between them. Maybe I can create three different actions–‘Writing it on’(for the sharpee), ‘Inscribing it on’(for the ballpoint) and ‘Penciling it on’(for the pencil)–all actions would have an Understand rule to include ‘write [text] on [something] with the…’, but this particular one would mention only the ‘stylus’ that the command was created for. Though I may create ‘Inscribing it on’ for the ballpoint, its Understand rules would include ‘Understand “write [text] on [something] with the ballpoint pen” as inscribing it on.’ And of course, I would write results of each action that would reflect the characteristics of the implement. Would this work? Just thinking out loud. Thanks.

Sounds like you want a Third Noun.

This extension is a really quick and dirty conversion of an exercise in the DM4. It’s not particularly elegant, but it works.

[code]Writing it on is an action applying to one topic and one thing. Understand “write [text] on [something] with [third]” as writing it on.

A stylus is a kind of thing. Check writing it on: if the third noun is not a stylus, say “You can’t write with [a third noun].” instead.[/code]

Note that you can have some Understand lines with a [third] token, and some without, on the same action. If you do this, you should add this line also:

After reading a command: now the third noun is nothing.

So now “the third noun” will be nothing if the player didn’t specify one.

(I really need to add that behavior by default…“after reading a command” isn’t really the right place for it. Adding that to the to-do list!)

It’s been a couple of years, but my Notepad extension should still be available somewhere. Even if it’s not compatible with the latest Inform 7, I’m sure you could scoop out a bunch of the code and use it.

I used Notepad for my Ectocomp last year! It worked beautifully.

Glad to hear it. As a musician, I’m especially proud of the Beethoven example.