Self Description / Clothing

Hello!
Just starting out with Quest making a TA game. This program is awesome.

I'm trying to generate a custom description for my character without using a complex series of nested if statement.

I have put 2 wearable object on my character for testing.
In layer 2, I have a prison jumpsuit. Slot clothes
In layer 1, I have tighty whities. Slot underwear.
I believe I can accomplish my description using the GetOuter function but I can't figure out how to use it properly.

If the player types 'look at me' I want it want it to display the outer most layer of clothing. The highest wear layer only. (ie. "you are wearing a prison jumpsuit") unless the player has removed the item, I want it to say something like, "you're in your underwear"
Also, I so not want the bottom layer of clothing displayed in the inventory pane.

And while were on the subject, how do I prevent a player from putting on layer 1 items if layer 2 items are already on (and the reverse)?

Thanks in advanced!

I'll go back to making rooms in my spaceship for now. :]


I am pretty sure GetOuter refers to the outer most numbers in a list or string, like FOIL, but I could be wrong. The Pixie may correct me.


The ListClothes function will give you a list of all clothes, so not quite what you want.

You should use ListVisibleFor to get a list of visible clothing, then FormatList to put it into a string.

    return (FormatList(ListVisibleFor(game.pov), ",", "and", "nothing"))

I think that will show each item with "(worn)" after it, so it might look better if you do this:

    l = NewStringList()
    foreach (obj, ListWornFor(game.pov)) {
      list add (l, GetDisplayGarment(obj))
    }
    return (FormatList(l, ",", "and", "nothing"))

And while were on the subject, how do I prevent a player from putting on layer 1 items if layer 2 items are already on (and the reverse)?

That should be built in.


And while were on the subject, how do I prevent a player from putting on layer 1 items if layer 2 items are already on (and the reverse)?

You put them in the same slot.

A wearable item's "slot" tells Quest which items cover each other up. So making underwear a separate slot tells Quest that it will only be covered up by other underwear, and you can see it even if the player is wearing clothes as well.

You need to change the slot on both items to "clothes".

Then, you won't be able to take your underwear off without removing the jumpsuit first. And GetOuterFor (player, "clothes") will return the outermost object in that slot.

Also, I so not want the bottom layer of clothing displayed in the inventory pane.

You could have a turnscript to do something like:

outerclothes = NewStringList()
underclothes = FilterByAttribute (ScopeInventory(), "worn", true)
foreach (garment, ListVisibleFor(player)) {
  garment.scenery = false
  list add (outerclothes, GetDisplayGarment(garment))
  list remove (underclothes, garment)
}
foreach (garment, underclothes) {
  garment.scenery = true
}
player.visibleclothes = FormatList (outerclothes, ", ", ", and", "nothing")

This makes your underwear into scenery (I think the latest version of quest makes the scenery flag work for the inventory. If not, you'd have to change it to garment.visible, and there might be a little extra code needed)

It also sets up a string attribute, so in your description you can just say "You are wearing {player.visibleclothes}."

If you're going to have other clothes you can find later, it probably makes more sense to come up with a set of slots representing parts of the body. So the slot for the underwear would be "legs", and the slot for the jumpsuit would be both "legs" and "chest".


Thanks everyone. I've gotten pixies half to work basically exactly as posted. (Have not worked on angels half yet)

I'm trying to apply the same thing to NPC but it keeps saying there are wearing nothing.

I have an NPC named Captain

I think the problem is I don't know how to pass the Captain object to the function.

I tried to just change game.pov to Captain, this, this.Captain, ect
(The script is on the NPC, "Captain")

What is it suppose to be?


So I found the function GetObject and changed game.pov to GetObject(Captain) which I thought would work but it says:
Error running script: Error Compiling expression.
ListWornFor(GetObject(Captain)) : FunctionCallElement: Could not find function GetObject(Element)

I know this is something really simple but it's eluding me.
Help!


GetObject turns a string containing an object (like "Captain") into an object (Captain). You don't need to use it because your captain is already an object.

My script should just work if you change game.pov to Captain.

If it says he is wearing nothing, have you checked that he's actually wearing the items? Are the clothes inside the captain, and do they all have their worn attribute set to true?


I knew it was something simple.
It was the worn attribute.
Thanks!


Log in to post a reply.

Support

Forums