Actions that apply to non-visible things?

Hello again!

I need some more help, and you were all very informative last time! This is the last problem I’m having with this game so hopefully it should all be hunky dory after this.

I’m trying to make an action that applies to something that isn’t visible! The player has a marker and I want them to be able to draw anything they want (everything will get the same response, though). This is the coding I have so far:

Drawing is an action applying to one thing.
Understand “draw [something]” as Drawing.

Of course, when I try to do this in game with a command like “draw sausage” it will tell me it can’t see one anywhere. A sausage that is.

I even tried this hack to get around it:

Before Drawing anything: end the game saying “GAME TEXT HERE”; stop the action.

But even then it gives me the same result! Apparently Inform7 checks whether the player can see something before it does anything else.

So, any suggestions?

UPDATE: Actually, rereading your post, it looks like you don’t actually want what I posted. The code I give below, which I’ve now hidden under the rant tag, applies whenever you want to let the player draw any object that you’ve defined in the game, whether or not it’s in their location. But it sounds as though you want them to be able to draw anything – “DRAW SAUSAGE,” “DRAW MONA LISA,” “DRAW A FETCHING GRAPH OF THE IS-LM CURVE” – in which case you want a [text] token, which allows for entering free-form text:

Drawing is an action applying to one topic. Understand "draw [text]" as drawing.

When you are using a text token, you have to declare the action as applying to a topic rather than a thing. If you want to recover the text the player entered, you use “the topic understood,” thus:

Carry out drawing: Say "You skillfully draw a picture of [the topic understood]."

which probably won’t handle articles gracefully, but oh well. [END UPDATE]

[rant]This is paradoxical; to have an action apply to non-visible things, you need to declare it as applying to visible things!

Drawing is an action applying to one visible thing. Understand "draw [any thing]" as drawing.

And then of course whatever instead/carry out/etc. rules you want to apply to drawing.

Note “visible” and “any thing.” “Visible” is actually anything the player can refer to, as opposed to “touchable.” (See 12.17 of the documentation.) The “[any thing]” token lets the player refer to any thing, not just things that are in scope. (See section 16.7 of the documentation.) Put these two things together, and now the player can type “Draw foo” to refer to foo no matter where it is – whether the player can see it or not!

The use of “visible” here is super confusing and unfortunate, but the thing to keep in mind is that “visible” is actually much more permissive than the default; “visible” is anything the player can talk about, and in combination with “[any thing]” or “[any person]” often means things that aren’t, well, visible.

[see here for a little more; I just mostly copy-pasted my old comment, because this is a very confusing issue that comes up pretty often.)[/rant]

Ah, perfect! I did experiment with [text] but didn’t pick up on the “topic” thing. Thanks!

You might want to look at my Notepad extension. You should be able to add “draw” to the code for “write” pretty easily. This extension has a couple of things you might find useful, such as the ability to erase what has been drawn/written and the optional requirement that the player be holding a pen-type object.

I have tried to use the notepad extension, but had problems… I get this on compile:

[code]This is the report produced by Inform 7 (build 6G60) on its most recent run through:

In Section 4 - Adding It To in the extension Notepad by Jim Aikin:

Problem. In the sentence ‘now carrying-pen is true’ , I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘carrying-pen is true’.

I was trying to match this phrase:

now (carrying-pen is true - a condition)

This was what I found out:

carrying-pen is true = something unrecognised


Problem. In the sentence ‘if carrying-pen is false begin’ , I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘carrying-pen is false’.

I was trying to match this phrase:

if (carrying-pen is false - a condition):

This was what I found out:

carrying-pen is false = something unrecognised


In Section 5 - Copying It To in the extension Notepad by Jim Aikin:

Problem. In the sentence ‘now carrying-pen is true’ , I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘carrying-pen is true’.

I was trying to match this phrase:

now (carrying-pen is true - a condition)

This was what I found out:

carrying-pen is true = something unrecognised


Problem. In the sentence ‘if carrying-pen is false begin’ , I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘carrying-pen is false’.

I was trying to match this phrase:

if (carrying-pen is false - a condition):

This was what I found out:

carrying-pen is false = something unrecognised

[/code]

As it wasn’t really critical for this project, I just removed the include for the extension… but always thought it would be nice to use. An idea how to correct these errors?

Edit to add: I get these errors even when using the examples that come with the extension, not just with my own convoluted project. :wink:

Thanks for letting me know about this. Inform is now stricter than before about the scope of temporary variables. In Sections 4 and 5, in the Check rules, the phrase “let carrying-pen be a truth state” has to be moved up to the head of the rule and deleted from its current position lower down in the code. If you do this, it should compile. I’ll resubmit it.

Yeah, that seemed to fix it. I wrote on the foggy mirror. :smiley:

Well, and on the slate and in the notebook. But the mirror made me laugh. :wink:

Don’t ask… But thanks… I see good uses for this now that I know I can use it.

(I always feel weird quoting myself)

But one thing I would like to suggest… since write is the obvious command… I wish it would not overwrite what was written before. The ability to “add” to the notebook contents with “write” is more intuitive than saying “add” to notebook. I can see a lot of inadvertent overwrites…