intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Dec 17, 2018 3:42 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Mar 12, 2018 10:39 pm 
Offline

Joined: Wed Jan 04, 2017 12:47 am
Posts: 181
I have the following code, and I'm not sure why it doesn't work:

Code:

A cloak is a wearable thing.  The description of the cloak is "[The player] USE this cloak to sneak around at night undetected."  The cloak is on Levalia's bed.
[the bed is an enterable scenery supporter that has nothing to do with this particular piece of code]

A person can be visible or invisible.   
last carry out using the cloak:
   now the player is invisible.
[using is a new action I created; that can be disregarded as well]


Book - some scratch testing


A guard is a kind of targetable person. Understand "guard" as a guard.  The printed name of a guard is usually "GUARD".  A guard is privately-named.  The indefinite article of a guard is "a".
[targetable is also a new property, as created by this extension called Basic Combat by B David Paulsen]

G1 is a guard in Wkitch.

Check going to EKitch:
   if the guard is not dead and the player is visible:
      say "[The g1] stands in your way.";
      the rule fails;
   else:
      continue the action.


The issue I have is that even if I'm wearing the cloak (making me invisible), the guard still stands in my way. If I replace "the player is visible" with "the player is not wearing the cloak", it works fine. I just would like to understand why using visible/invisible properties won't work.

The second issue I have is one that I've had for a long time, and I think it's time I finally get it tackled. When printing the paragraph about the guard, the parser says "You can see GUARD here". Obviously, I want it to say "You can see *a* GUARD here." (there's no issue if there's two guards in the room). I'm 100% sure I have some misconception about how to properly use "The indefinite article of... is...", or if it's even appropriate in this regard.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 12:56 am 
Offline

Joined: Fri May 31, 2013 3:54 pm
Posts: 110
liquidrain84 wrote:
The issue I have is that even if I'm wearing the cloak (making me invisible), the guard still stands in my way. If I replace "the player is visible" with "the player is not wearing the cloak", it works fine. I just would like to understand why using visible/invisible properties won't work.
I believe this is because "visible" already means something different to Inform (see §6.13 in the documentation). It works if you use "cloaked or uncloaked" instead of "visible or invisible".

(It would be nice if Inform threw an error at your redefinition of "invisible", but apparently it doesn't. Standard Rules defines it as a definition, whereas you define it as a property, so it's not technically conflicting - it's just confusing since you can check a definition or a property using the same syntax.)
liquidrain84 wrote:
The second issue I have is one that I've had for a long time, and I think it's time I finally get it tackled. When printing the paragraph about the guard, the parser says "You can see GUARD here". Obviously, I want it to say "You can see *a* GUARD here." (there's no issue if there's two guards in the room). I'm 100% sure I have some misconception about how to properly use "The indefinite article of... is...", or if it's even appropriate in this regard.
This is tricky behavior. The property you're looking for is "improper-named", but you can't do the obvious and just say
Code:
A guard is improper-named.
because Inform is overriding this at the object level, when you define G1. The definition of G1 has no article ("G1 is a guard..."), so Inform assumes you mean it to be proper-named.

You could do:
Code:
The G1 is a guard in Wkitch.
Or:
Code:
G1 is a guard in Wkitch. It is improper-named.
Or:
Code:
A guard is always improper-named.
...which is a useful bit of syntax for dealing with kinds (see §4.3 in the documentation).


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 1:21 am 
Offline

Joined: Wed Jan 04, 2017 12:47 am
Posts: 181
prevtenet wrote:
I believe this is because "visible" already means something different to Inform (see §6.13 in the documentation). It works if you use "cloaked or uncloaked" instead of "visible or invisible".

Oh man, I'm such an idiot. I didn't even think of the fact that "visible" already exists. Thanks, prevtenet! That was a nice, easy fix.

I seem to be needing some further understanding with proper-named vs improper-named, singular and plural, etc. In actual English grammar, I understand what all those things mean, but they seem to mean something slightly different in Inform... or at least, I get different results than what I expect when trying to use them. When I say something is proper-named, I'd expect it to merely capitalize the noun (as if it was a proper noun). The documentation (3.18) gives a little clarity on singular-named vs plural-named, but I still can't seem to be able to apply it properly in my actual programming.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 7:03 am 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 384
The proper-/improper-named property has no effect on capitalization. It just determines whether an article is printed before the object's name.

The singular-/plural-named property determines what the indefinite article is --- a(n) or some --- unless this has been set manually. It also ensures the correct conjugation of verbs, such as is/are. (Also, it affects what pronouns the player can use to refer to the object.)

Inform makes various decisions for itself about objects when they are first defined in your code --- about capitalization, improper-/proper-named, singular-/plural-named, and the indefinite article. It assumes that your usage there expresses your intentions. Usually you can get the effect you want by phrasing the initial definition of the object correctly; but you can always override Inform's guesses, and sometimes you have to.


Code:
Great Expectations is a thing.

This creates a proper-named thing with a capitalized name.

Code:
There is a thing called literature.                      [or just "literature is a thing."]

Creates a proper-named but uncapitalized thing.

Code:
The Victorian novel is a thing.

This creates an improper-named thing. The indefinite article is not changed from the default "" (which prints as "a" or "an" as appropriate). The word "Victorian" in the name is capitalized.

Code:
There is a thing called the Victorian novel.

Similar to the above, but this more emphatic form of the definition persuades Inform to set the indefinite article to "the".

Code:
Some books are a thing.          [or "is a thing" or "are things"]

The word "some" causes Inform to make this plural-named. The indefinite article isn't changed from the default "", but this prints as "some" for plural-named objects.


(Inform won't act on hints any more delicate than these. "Some semolina is a thing;" creates a plural-named thing, and not --- as you might hope --- a singular-named thing with indefinite article "some". And "There are things called the cardinal virtues;" creates a singular-, not a plural-named thing.)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 8:38 am 
Offline
User avatar

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2806
Location: US - Central
One other side note - when you're using a token substitution to call the name of an object, Inform looks whether you've included an article in the token and thusly will use it or not.

say "Boris draws his [weapon] and swings it mightily" - should produce "Boris draws his sword and swings it mightily."
say "You pick up [the weapon] and stash it in your inventory - should produce "You pick up the sword and stash it in your inventory."
say "You select [a weapon] for use later" - "You pick up a halberd for use later"

(providing, of course, Inform knows what weapon you're talking about; you can also say [noun] [the noun] [a noun] etc...to use the object in the player's command)

Inform will observe whether something is proper or not and should say the article appropriately so long as you've defined the object properly as jrb details above.

"You pick up [the captive]." should appropriately say "You pick up Rumplestiltskin" vs "You pick up the gnome."

You can also capitalize as appropriate.

"[The captive] glares at you" - "The gnome glares at you." "Rumplestiltskin glares at you."

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io/


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 10:52 am 
Offline

Joined: Wed Jan 04, 2017 12:47 am
Posts: 181
Okay, so if I wrote something like
Code:
Keys are a thing. [creating a proper-named thing... then wrote:]  Keys is improper-named.


The last line, "Keys is improper-named" will override the original setting I created and print singular articles (a, the) before it. If I say that Keys is plural-named, then it would print "some" before it instead.

Regarding tokens, I *kind of* already knew that if I include "a" or "the" in the token, it would print the article along with the noun, but I had originally thought it would just print the article no matter, since I included it. As I understand it now, if I created something like:

Code:
Excalibur is a weapon. [proper-named] 
A club is a weapon. [improper-named]

Carry out taking a weapon:
say "You pick up [the weapon] and stash it in your inventory


Then, even though there is "the" in the token, if I pick up Excalibur, it will say "You pick up Excalibur...", but if I pick up the mace, it will say "You pick up the mace..." Alternatively, if I had written "You pick up [weapon]...", then Excalibur would print fine, but the mace would print "You pick up mace..."

Is that right?

One last thing... How does "The indefinite article of..." work?

I take it back. One other last thing... If you'll notice, I made the guards a privately-named thing. This was imitated from something else I saw in the recipe book somewhere, and I'm not really sure what it means. I looked in the documentation and found a bit of explanation under 17.17, but it says that if something is privately-named, the player can never refer to it. So why then, can the player refer to the guard? Or rather, does it mean the player would never be able to refer to the guards as G1, G2, etc?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 11:01 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5839
Quote:
if something is privately-named, the player can never refer to it


No. It just means that the source-code name is not added to the synonym list.

If you don't know what privately-named means, stop using it. If you use it by habit or because you copied an example, stop using it. If you can't point to a specific bug in your game which is fixed by privately-named, stop using it.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 11:14 am 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2669
Location: The Midwest
liquidrain84 wrote:
Or rather, does it mean the player would never be able to refer to the guards as G1, G2, etc?

Exactly. Privately-named isn't a real property, in that you can't use it during play. It just tells the Inform compiler that the name used in the source code shouldn't be understood by the parser.

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 11:26 am 
Offline

Joined: Wed Jan 04, 2017 12:47 am
Posts: 181
Thanks, Draconis. Sorry for my incompetence, Zarf. I tend to use things I don't understand because it helps me accomplish what I'm trying to accomplish, as well as starts to give me more understanding of how something works or, at the very least, makes me curious about it. If I don't use something I don't understand, I'll never learn about it and consequently never improve.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 13, 2018 12:05 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5839
I am not ragging on you in particular. I am trying to increase the chance that people in the future see and remember this advice.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group