# script_consume_food
# Input: arg1: order of the food to be consumed
# Output: none
("consume_food",
[(store_script_param, ":selected_food", 1),
(troop_get_inventory_capacity, ":capacity", "trp_player"),
(try_for_range, ":cur_slot", 0, ":capacity"),
(troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
(is_between, ":cur_item", food_begin, food_end),
(troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
(neq, ":item_modifier", imod_rotten),
(item_slot_eq, ":cur_item", slot_item_is_checked, 0),
(item_set_slot, ":cur_item", slot_item_is_checked, 1),
(val_sub, ":selected_food", 1),
(lt, ":selected_food", 0),
(assign, ":capacity", 0),
(troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"),
(val_sub, ":cur_amount", 1),
(troop_inventory_slot_set_item_amount, "trp_player", ":cur_slot", ":cur_amount"),
(try_end),
]),