intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Feb 22, 2019 10:33 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Jan 16, 2019 7:06 am 
Offline

Joined: Fri Oct 06, 2017 8:19 am
Posts: 35
I don't know if this is possible in Inform 7?

A usual trick in Quest is to swap one object for another e.g. broken radio for fixed radio, but for the player they are both called 'radio' - there is the object name that the code uses, and the name that the player sees which can be different. This is particularly useful for NPCs who are in different states e.g. asleep, awake, unhappy, happy etc.

I can get around this by putting conditionals on just one object, but it can get messy if there is a lot going on.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 7:38 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5568
Location: Burlington, VT
The name that the player sees is the printed name property:

Code:
The broken radio is a thing. The printed name of the broken radio is "radio".
The fixed radio is a thing. The printed name of the fixed radio is "radio".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 7:52 am 
Offline

Joined: Fri Oct 06, 2017 8:19 am
Posts: 35
Thanks, that's perfect.

Along the same lines, how do I deal with name conflicts between rooms and people/objects.

E.g. I want to put Elves inside The Elves Workshop. Inform doesn't like it!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 8:55 am 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 419
I believe you can do the same with rooms--call the room Workshop in your code, then say

Code:
The printed name of Workshop is "The Elves' Workshop".


or, if that is the actual name of a container(for the sake of example), do the same, but also make sure that the player can refer to it with the same words by saying

Code:
Understand "The" and "Elves" and "Workshop" as the workshop.


Also, in the case where it is a container, you'll want to clarify, in your code, which one the player means when the player wants to do something with the elves--most likely the player will mean the actual elves (rather than the workshop, if this is a container)--you can include a line saying

Code:
Does the player mean doing anything with the elves:  it is very likely.


just to make sure.

That's the way I understand it, but I'll defer to the experts (I'm not really one).


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 9:53 am 
Offline

Joined: Fri Oct 06, 2017 8:19 am
Posts: 35
That solves my problem. Thank you!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 10:53 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5921
If you're going to swap objects like this, consider this bit of polish:

Code:
The broken radio is a thing. The printed name of the broken radio is "radio".
The fixed radio is a thing. The printed name of the fixed radio is "radio".

The fixed radio is in the Kitchen.

Check attacking the fixed radio:
   now the fixed radio is off-stage;
   now the broken radio is in the location;
   set pronouns from the broken radio;
   instead say "You smash the radio. Now it doesn't work."


The line "set pronouns from..." resets "it" to refer to the given object. This allows the player to type

Quote:
> HIT RADIO
You smash the radio. Now it doesn't work.

> EXAMINE IT
...description of the broken radio...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 11:44 am 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 428
I'm surprised you can't put Elves into the Elves' Workshop; this should be possible. You could try declaring them in a different order in your code (sometimes this helps).

If that fails, there is a way of declaring rooms/objects which is slightly clunky, but which makes sure the names are unambiguous:
Code:
There is a room called the Elves' Workshop.
There is a thing called some Elves.
The Elves are in the Workshop.

(It's preferable not to mess around with printed names if you don't have to, I think.)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 2:49 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5921
Personal coding style. I set printed names on practically every Inform object I create.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jan 16, 2019 9:22 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5568
Location: Burlington, VT
If you do go the printed name route, you don't need to have "the" or "workshop" understood as the workshop--"workshop" is understood automatically because of the internal object name, and "the" is automatically understood as any noun (that's not exactly how it works internally, I don't think, but anyway it doesn't need an explicit Understand).


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jan 20, 2019 10:02 am 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 168
If I may add a generalised version of the above, using relations:

Code:
The Shack is a room.

Degrading relates one thing to one thing. The verb to degrade to means the degrading relation.

The glass bottle is in the Shack.

The broken glass is nowhere. The indefinite article is "some".

The glass bottle degrades to the broken glass.

Instead of attacking something which degrades to something (called wreckage):
   say "You let your anger loose on [the noun]. It gets smashed, leaving behind [a wreckage].";
   now the noun is nowhere;
   now the wreckage is in the location;
   set pronouns from the wreckage.


(Thanks, Zarf, for the "set the pronouns part!" I didn't know that one!)

All this gives us:

Quote:
Shack
You can see a glass bottle here.

>wreck bottle
You let your anger loose on the glass bottle. It gets smashed, leaving behind some broken glass.

>x it
You see nothing special about the broken glass.

>


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

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