Alternative clothing library

The Pixie
I have had a go at updating the wearables library. If you have an existing game, you should be able to just swap this library for the wearables library, as it uses exactly the same attributes on garments. What this gives extra:

1. It allows for swapping between different player point-of-views (this is something that got added to Quest after Chase wrote the original library).

2. The inventory verbs for each garment gets updated as items are put on and taken off.

3. If you use inventory limits, then items that are worn do not count towards the maximum number of items you can carry (but they do count to the maximum "volume", which is really a maximum weight).

4. Also accepts DON <object>, DOFF <object>, PUT <object> ON and TAKE <object> OFF (the last two do not handle multiple objects).

5. It includes four new functions:

int WornCount()

Returns the number of garments currently worn by the player.

object GetOuter(string)

Returns the outermost garment in the given slot. So if the player is wearing a shirt and a coat, and both have the chest slot, then GetOuter("chest") will return the coat, i.e., what is visible in that location.

WearGarment(object)

Sets the given object to be worn. Call this in the game start script, for example, to have the player start the game wearing the object (it sets all the attributes for you).

string ListClothes()

Returns a string that lists all the clothing being worn, neatly formatted (or "nothing" if naked).




Here is a quick demo that showcases some features. There is an inventory limit of two, but you can exceed that by wearing items. You will also find inventory verbs get set automatically. Go to the other room and Mary will react according to what you are wearing. Do X ME to gert a list of clothing.

<!--Saved by Quest 5.6.5783.24153-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="ClothingLib.aslx" />
<game name="garments">
<gameid>9422a96f-65be-4c0a-9267-fe9959294819</gameid>
<version>1.0</version>
<firstpublished>2016</firstpublished>
<feature_limitinventory />
<pov type="object">theplayer</pov>
<start type="script">
WearGarment (boxers)
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="theplayer">
<inherit name="editor_object" />
<inherit name="editor_player" />
<maxobjects type="int">2</maxobjects>
<attr name="pov_look" type="script">
msg ("You are wearing " + ListClothes() + ".")
</attr>
<object name="boxers">
<inherit name="editor_object" />
<inherit name="wearable" />
<inherit name="plural" />
<attr name="wear_layer" type="int">0</attr>
<wear_slots type="stringlist">
<value>groin</value>
</wear_slots>
<usedefaultprefix type="boolean">false</usedefaultprefix>
</object>
</object>
<object name="trousers">
<inherit name="editor_object" />
<inherit name="wearable" />
<inherit name="plural" />
<attr name="wear_layer" type="int">1</attr>
<wear_slots type="stringlist">
<value>groin</value>
<value>legs</value>
</wear_slots>
<usedefaultprefix type="boolean">false</usedefaultprefix>
</object>
<object name="briefs">
<inherit name="editor_object" />
<inherit name="wearable" />
<inherit name="plural" />
<attr name="wear_layer" type="int">0</attr>
<wear_slots type="stringlist">
<value>groin</value>
</wear_slots>
<usedefaultprefix type="boolean">false</usedefaultprefix>
</object>
<object name="ball">
<inherit name="editor_object" />
<take />
</object>
<object name="hat">
<inherit name="editor_object" />
<inherit name="wearable" />
<wear_slots type="stringlist">
<value>head</value>
</wear_slots>
</object>
<exit alias="west" to="secondroom">
<inherit name="westdirection" />
</exit>
</object>
<command name="test">
<pattern>test</pattern>
<script>
msg ("Outermost is " + GetOuter("groin"))
</script>
</command>
<object name="secondroom">
<inherit name="editor_room" />
<enter type="script">
garment = GetOuter("groin")
if (garment = null) {
msg ("'Put some pants on!' exclaims Mary in horror.")
}
else if (garment = boxers or garment = briefs) {
msg ("'Nice underwear!' says Mary.")
}
else {
msg ("'Hi!' says Mary.")
}
</enter>
<object name="mary">
<inherit name="editor_object" />
</object>
<exit alias="east" to="room">
<inherit name="eastdirection" />
</exit>
</object>
</asl>

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums