Item Types added to PaperDoll

Welcome Adventurer… Forums Development Development News Item Types added to PaperDoll

This topic contains 1 reply, has 1 voice, and was last updated by  hosted 7 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1859

    hosted
    Keymaster

    Items defined in PaperDoll now have an item type definition – the &define_item function has been redefined as follows:

    &define_item(‘item name’,’equip location’,’usage reference’,”,”,”,@type_list)

    an example would be:

    &define_item(‘Long Sword’,’Combat Hand’,’Sword’,”,”,”,’Weapon’,’Sword’,’Bladed’);

    The type list is indefinite, you can define as many types as you like for an item. The empty parameters are for forthcoming item definition uses.

    To test whether an item is a type of something use the new &item_is_type function like so:

    <if condition=”&item_is_type(‘Sword’,’Weapon’)”>Sword is a weapon</if><else>Sword is not a weapon</else>

    This may not appear too useful but in conjunction with other functions can be of use – for example to test what type of item is in a heroes hand we could say:

    <if condition=”&item_is_type(&get_item_name(&item_existing_at_location(‘combat hand’)),’sword’);”>If the weapon you are wielding is a sword turn to 123</if><else>Otherwise turn to 456</else>

    This is cumbersome granted, though with a more complete set of user interface features for PaperDoll (or its descendant library) it will hopefully be more generally useful.

    #1860

    hosted
    Keymaster

    Have added function &items_of_types:

    &items_of_types(@types)

    e.g.

    &lose_items(&items_of_types(‘weapon’));

    Will lose all weapons from a heroes inventory – the $items array – (or at least all items defined as being of type ‘weapon’)

    &lose_items(&items_of_types(‘weapon’,’food’));

    Will lose all items of either weapon or food.

    etc.

    …specifically the function returns a list of all item_ID’s that match anything in the @types parameter list.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Straight outta Blacksand

Skip to toolbar