Beginner help
Particleman
25 Feb 2016, 15:05Hello, all.
So, I'm a bit new to Quest. I've gone through the tutorials, I've played around a little, and I've come up against some hindrances that I can't find documentation for. It probably exists, but the information given for commands isn't exactly... informative. I've read through some of the forums, and the Script Template 2 has some of the same questions I did, but I'm looking at it from a different way.
Now, I don't know javascript, but I know programming basics (And, oddly, enough, I know programming Basic; though it has been a long time since I've used it), so I'm not afraid of scripting, and I'm willing to learn how things work so that I can improve my skills.
That said, on to my situation:
I'm trying to list an objects children in the room description. I don't use the auto-list option, because I want it to feel more natural, and I don't think it would be too difficult to do. Essentially, the setup works like this:
You are in a room. There is nothing here but a table. On the table is a ball and a flower. The smell of lilac hangs in the air.
So, what I want to do is something like this, I just don't know the language behind it:
You are in a room. There is nothing here but a table. {If table has children, then: On the table is {list children}.}{If room has children with tag Item, then: Lying on the floor is {list children with tag Item}.}
I appreciate the help in advance. I may have other issues in the future, and this will sort of be my go to spot for help, so if you can't help with this issue, maybe you can help with a future one. Thanks again.
So, I'm a bit new to Quest. I've gone through the tutorials, I've played around a little, and I've come up against some hindrances that I can't find documentation for. It probably exists, but the information given for commands isn't exactly... informative. I've read through some of the forums, and the Script Template 2 has some of the same questions I did, but I'm looking at it from a different way.
Now, I don't know javascript, but I know programming basics (And, oddly, enough, I know programming Basic; though it has been a long time since I've used it), so I'm not afraid of scripting, and I'm willing to learn how things work so that I can improve my skills.
That said, on to my situation:
I'm trying to list an objects children in the room description. I don't use the auto-list option, because I want it to feel more natural, and I don't think it would be too difficult to do. Essentially, the setup works like this:
You are in a room. There is nothing here but a table. On the table is a ball and a flower. The smell of lilac hangs in the air.
So, what I want to do is something like this, I just don't know the language behind it:
You are in a room. There is nothing here but a table. {If table has children, then: On the table is {list children}.}{If room has children with tag Item, then: Lying on the floor is {list children with tag Item}.}
I appreciate the help in advance. I may have other issues in the future, and this will sort of be my go to spot for help, so if you can't help with this issue, maybe you can help with a future one. Thanks again.
The Pixie
25 Feb 2016, 15:40There are different ways to do this.
The non-scripting way is to have the table be a container, and set it up as a surface, and put the things on the table inside it.
If you turn on "in-room descriptions" on the features tab of the game object, you can then add a description to each object on its setup, and that will get used in the room descriptions. The disadvantage is it is the same for all rooms.
The way I would do it is as described in this post in the thread you found:
viewtopic.php?f=10&t=5909&start=15#p41061
It overrides the built-in ShowRoomDescription function, (so can only be done in the off-line editor, and as written is not compatible with the light/dark system).
What it does is makes a list of objects, and if the room has an attribute "lookwith" and there are objects present, it uses that. The disadvantage of that is all objects are lumped together.
The non-scripting way is to have the table be a container, and set it up as a surface, and put the things on the table inside it.
If you turn on "in-room descriptions" on the features tab of the game object, you can then add a description to each object on its setup, and that will get used in the room descriptions. The disadvantage is it is the same for all rooms.
The way I would do it is as described in this post in the thread you found:
viewtopic.php?f=10&t=5909&start=15#p41061
It overrides the built-in ShowRoomDescription function, (so can only be done in the off-line editor, and as written is not compatible with the light/dark system).
if (HasScript(game.pov.parent, "description")) {
do (game.pov.parent, "description")
}
else {
objects = FormatObjectList("", GetNonTransparentParent(game.pov.parent), "and", "")
if (not objects = "" and HasString(game.pov.parent, "lookwith")) {
fulldesc = Replace(game.pov.parent.lookwith, "%", objects)
}
else {
fulldesc = game.pov.parent.description
if (not objects = "") {
fulldesc = fulldesc + " You can see " + objects + " here."
}
}
if (LengthOf(fulldesc) > 0) {
msg (fulldesc)
}
}
What it does is makes a list of objects, and if the room has an attribute "lookwith" and there are objects present, it uses that. The disadvantage of that is all objects are lumped together.
Particleman
25 Feb 2016, 20:05If you turn on "in-room descriptions" on the features tab of the game object, you can then add a description to each object on its setup, and that will get used in the room descriptions. The disadvantage is it is the same for all rooms.
The other disadvantage, I think, is that it won't list an item's children, will it? It would just list that there was a table, not what was sitting on the table.
I'll have to take a closer look at the code later; I'm out of time right now. I'm a little concerned that it doesn't work with light and dark, but I can jimmy-rig that with tags if I need to.

XanMag
25 Feb 2016, 20:32Particleman wrote:
The other disadvantage, I think, is that it won't list an item's children, will it? It would just list that there was a table, not what was sitting on the table.
So, you want the children to be listed with the parent when the room is described? If I understand correctly, all you need to do is not tick the tab to 'hide the children until object is looked at'. Right?