Initial Descriptions and Background Object

sfq
08 Nov 2012, 12:18
This is my second attempt at Questing and this attempt seems to be going a lot smoother than before (I'm using the 5.3 latest nightly build). A few days in and I have succesfully solved my first batch of problems namely:
Take and drop all not having a reply if there are no items to take or drop.
Darkness issues (see my 'Darkness' previous post).
Spurious blank lines if a room had no takeable items.

All minor issues for sure but as a non-programmer minor issues in a foreign lanquage can seem quite major, and being able to resolve these issues has given me the boost needed to continue.

Onto my questions:

1. Can a takeable object have an initial description, that is how it is displayed before it is taken for the first time only, for example:


Cave
A dark and damp cave

On the floor lies a discarded shovel

You can see a pile of dirt

Exits are east and out

>take shovel
Taken

>look

Cave
A dark and damp cave

You can see a pile of dirt

Exits are east and out

>drop shovel

Cave
A dark and damp cave

You can see a pile of dirt and a shovel

Exits are east and out

2.Objects that are in multiple locations: Looking through the forums the only mention of this seems to have resulted in the environment library. This isn't something I want to use at the moment so I was wondering if there is a built in solution. Currently I move the object into the required locations on entry.

jaynabonne
08 Nov 2012, 12:49
For 1), off the top I'd say set the alias initially to "discarded shovel" and then when you pick it up, set it to "shovel".

For 2), can you specify what sort of object it is? I'm trying to understand the situation. I had toyed with the idea of using a base type for an object to hold all the common attributes, and then have "proxy" or "instance" objects in each room where the object shows up. That way, you can put all the details (description, etc) in the type and then basically just have a simple derived object to occupy each room. Can I assume this is scenery?

sfq
08 Nov 2012, 13:47
Thanks for your reply.

For 1. I don't think the alias will work as I require the text 'On the floor lies a discarded shovel' to be displayed with shovel hyperlinked and the shovel not displayed in the You can see.. section.

For 2. Yes, mainly this would be for scenery/background type objects (sky, road, river etc).

jaynabonne
08 Nov 2012, 14:06
So in the shovel case, do you already have it hyperlinked, and not showing up in the "You can see" section? If not, that's a separate problem. If you do already have it that way, then basically it would be parallel - wherever you're getting the text from for "discarded shovel", just change it to "shovel".

sfq
08 Nov 2012, 14:25
In this case the shovel is named as such from the start, it never changes. What changes is what the player sees before he takes the shovel. Before taking the shovel the player sees the text (from an attribute???) 'On the floor lies a discarded' followed by the object name hyperlinked. The 'You can see...' section does not display any information about the shovel.

When the player takes the shovel this attribute is removed from the object so then when he drops the shovel it is displayed in the 'You can see...' section as normal.

This is the same behaviour as the 'initial appearance' property in Inform7 and the 'When dynamic object is listed in location, display this' property in ADRIFT5

jaynabonne
08 Nov 2012, 15:33
If you can post your game file here (.aslx), it might be easier to work out. At the moment, I'm not sure why the behavior would change pre- and post-taking.

sfq
08 Nov 2012, 15:55
Sorry, I seem to have not explained myself very well here.

The problem is that the behavior doesn't change pre and post taking. Everything acts as it should.

I'm wanting to make the behaviour change between pre and post taking. I don't think I can achieve the effect I want easily though without so major coding in the ShowRoomDescription function, and I don't think I quite up for that yet. I've added a feature request.

The Pixie
08 Nov 2012, 20:25
The way I would do it is to have the shovel as scenery (I guess it already is), and have scenery set to false when the shovel is picked up (it would make sense if that happened by default; I do not know if that is the case).

Then, for the room, have as a script instead of a description. In code it would be something like this:
<look type="script">
msg ("A dark and damp cave")
if (shovel.scenery) {
msg ("On the floor lies a discarded shovel")
}
</look>


For the other thing, I would use the environment library - that is exactly what it was created for. But then, I did write it...

Pertex
08 Nov 2012, 20:41
The Pixie wrote:The way I would do it is to have the shovel as scenery (I guess it already is)


Yes thats right. And you could use the inroom description of the object to display the initial description. And if you take the shovel remove the inroom description and the scenery flag

R2T1
08 Nov 2012, 22:18
No need to use scenery objects for point 1. All you need to do is uncheck the 'Use default prefix and suffix' box in the Setup tab and set the prefix to - an old discarded
Then in the inventory tab run 2 scripts for the Take command.
- Set variable shovel.prefix = expression "" (this removes the prefix so it reverts back to default)
- Set variable shovel.parent = expression player
I think this behaviour is what you described above.
Enjoy.

Pertex
09 Nov 2012, 10:53
R2T1 wrote: I think this behaviour is what you described above.


Not exactly. When you see an object the first time, it should display a text within the room description but not in the "You can see" list.

sfq
09 Nov 2012, 13:50
Thanks everyone for your input, I beginning to think that what I'm after is not as simple as I would like. Making the object scenery will work ... but ... it messes with take all, in that take all will not (correctly) take scenery objects. Also as scenery the object will not appear in the object pane until the scenery flag is removed.

Using a boolean attribute and a script for the location (thanks The Pixie) I can achieve part of what I want, the initial description part, with object link. All I need to do now is remove objects with the attribute set to true from the you can see list. I'm assuming I need to add something in this section of the showroomdescription function.

        if (i = game.autodescription_youcansee) {
objects = FormatObjectList(game.pov.parent.objectslistprefix, GetNonTransparentParent(game.pov.parent), Template("And"), ".", false)
desc = AddDescriptionLine(desc, objects)
if (game.autodescription_youcansee_newline and objects<>"") {
desc = desc + "<br/>"
}
}

sfq
09 Nov 2012, 19:02
Almost got it.

It seems that it is the FormatObjectList function I need to mess with.

I've changed the start of the function to remove from the list objects that have the initial_description attribute set to true. The only problem is that I need to do it for each object that may have an initial_description (thankfully there won't be many).

    list = RemoveSceneryObjects(GetDirectChildren(parent))
if (keys.initial_description = True) {
list remove (list, keys)
}
if (tasty food.initial_description = True) {
list remove (list, tasty food)
}


In the attached example first go in, the room description will display two items after the main room description, when either of these are taken their initial_description attribute is set to False. If they are dropped they are described in the you can see section.

The next challenge is to put all those list remove parts into one command that would then cover all objects automatically.