ListWorn
wooterslw
02 Jul 2019, 07:41Can someone give me an example of using ListWorn? I've tried everything and nothing seems to work and that function is not explained in the wearables section. What I want to be able to do is list an object on a specific layer.

Richard Headkid
02 Jul 2019, 23:35Hello, there!
Does this help?
http://docs.textadventures.co.uk/quest/wearables.html#what-is-the-player-wearing
wooterslw
03 Jul 2019, 06:41Not really. I saw that. What I want to be able to do is list what is worn in a particular location. So if a player entered "Look at Jack's chest". I can list all the items worn on that location. We have GetOuter but I don't see a command for listing all items in a particular location.
Also, when I use GetOuter the output is putting "Object:" in front of the item. Is there a way for it not to do that?

Richard Headkid
03 Jul 2019, 18:32Hrmm...
I can't get to Quest right now, but it sounds like GetOuter()
is returning an object. Try something like:
o = GetOuter(INSERT_YOUR_SLOT_HERE)
msg (o.alias)
Also, while perusing the code on GitHub, I found this code in CoreWearable.aslx:
<!--
Returns all the garments visible for the given char.
Note that garments that are not assigned to slot will NOT be included.
This is unit tested.
-->
<function name="ListVisibleFor" parameters="char" type="objectlist">
ol = newObjectList()
foreach (s, Slots()) {
o = GetOuterFor(char, s)
if (not o = null and not ListContains(ol, o)) {
list add (ol, o)
}
}
return (ol)
</function>
Hopefully you can lift some code from that.
Also, to Pixie:
This page is all messed up: http://docs.textadventures.co.uk/quest/functions/getouter.html
Sorry. I'm not big on wearables.
...but perhaps my bumbling will inspire someone more knowledgeable to chime in.
mrangel
03 Jul 2019, 21:33listing all items in a particular location
The function you want is _GetList (character, slot)
.
For example:
msg ("Jack is wearing " + FormatList (_GetList (jack, "chest"), ", ", "and", "nothing") + " on his chest.")
(Note that I've used FormatList
to turn an object list into text output, because it's easier than doing it manually)
wooterslw
05 Jul 2019, 09:51That was a perfect solution. Thank you everyone for the help.