AvernumScript/Appendix/Item, Special Item and Gold Calls

void change_coins(short coin_amount)

 * Changes the number of coins the party has by coin_amount (which can be negative). If the number is negative, then coins are taken away. If the party doesn't have enough coins, no coins are taken.

void change_spec_item(short which_item,short how_many)

 * Changes the amount of special item which_item the party has by how_many. If how_many is negative, the number of special item which_item will be reduced by how_many. If you try to take away more of the item than the party has, the party is left with 0 of the item.

void char_give_item(short which_char_or_group,short which_item)

 * Tries to give to which_char_or_group an item of type which_item. If you call char_give_item for a group, gives one of the item to each group member. The item will not automatically be identified. If the character doesn’t have enough space to take the item, nothing happens and the game gives a “can’t take the item” message.

Note: This call was added for Scenario Format Version 2, only use it with Mac version 1.1 or later or Windows version 1.0 or later.

short char_has_item(short which_char,short which_item)
Returns:

short char_has_item_of_class_equip(char char_num,short which_class,short take_item)
Returns:

Values for take item are:

Note: This call was added for Scenario Format Version 2, only use it with Mac version 1.1 or later or Windows version 1.0 or later.

void char_take_item(short which_char_or_group,short which_item)

 * Tries to take from which_char_or_group one item of type which_item. (If the item has charges, it will take 1 charge instead).

short coins_amount

 * Returns the number of coins the party has.

short has_item(short which_item)
Returns:

short has_item_of_class(short which_class,short take_item)
Returns:

Values for take item are:

short has_num_of_item(short which_item)

 * Returns how many of item which_item the party has. If the party doesn't have any items of type which_item, returns 0. If the items in question have charges, this call returns the total number of charges.

short has_special_item(short which_item)

 * Returns the number of the special item which_item the party has, 0 if they don’t have any.

short item_of_class_on_spot(short loc_x,short loc_y,short what_class)
Returns:

Note: If what_class is -1, returns 1 if any item is on the space, 0 otherwise.

void move_item_on_spot(short loc_x,short loc_y,short dest_x,short dest_y)

 * Takes all items sitting on town spot {loc_x,loc_y} and moves them to {dest_x,'dest_y}.

Note: If dest_x is a negative value, the items on the space are simply destroyed.

short pay_coins(short coin_amount)

 * Tries to take coin_amount coins from the party.

Returns:

void put_item_on_spot(short loc_x,short loc_y,short what_item)

 * Places an item of type what_item on town space {loc_x,loc_y}. If that spot is a container, the item won’t be contained inside it.

short reward_give(short which_item)

 * Tries to give item of number which_item to party. If the party can’t hold it, tries to place the item at their feet. (Placing the item at their feet will only work indoors.)

Returns:

short take_all_of_item(short which_item)

 * Takes all of item which_item from party, and returns the number of items taken. If the item given has charges, returns the total number of charges taken.

short take_all_of_item_class(short which_class,short gold_to_pay)

 * Takes from the party all items of special class which_class and, for each item taken, gives the party gold_to_pay gold.

Returns:

Note: If the item taken has charges, gives the amount of gold for each charge taken.

void take_item(short which_item)

 * Searches through the party’s inventory until it finds an item of type which_item and takes it. (If the item has charges, it will take one charge instead.)

short take_item_of_class_on_spot(short loc_x,short loc_y,short what_class)

 * Returns 1 if there is an item of special class what_class on town space {loc_x,loc_y}, 0 otherwise.


 * If there was an item of that type on the spot, destroys one of it. (If the item has charges, it will take one charge instead.)
 * If what_class is -1, destroys all items on town space {loc_x,loc_y} and returns TRUE if an is item destroyed.

void take_num_of_item(short which_item,short num_to_take)

 * Takes num_to_take items of type which_type from the party.

void take_special_item(short which_item)

 * Takes 1 of special item which_item from party. If the party has none of that special item, the call does nothing.