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.
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]
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.
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.
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…