(store_script_param, ":item", 1),
(store_script_param, ":imod", 2),
(assign, ":t_end", towns_end),
(assign, ":encountered", "$g_encountered_party"),
(try_for_range, "$g_encountered_party", towns_begin, ":t_end"),
(assign, ":s_end", slot_town_elder),
(try_for_range, ":slot_no", slot_town_weaponsmith, ":s_end"),
(party_get_slot, ":merchant", "$g_encountered_party", ":slot_no"),
(gt, ":merchant", 0),
(troop_get_inventory_capacity, ":cap", ":merchant"),
(try_for_range, ":i_slot", 10, ":cap"),
(troop_get_inventory_slot, ":i_item", ":merchant", ":i_slot"),
(eq, ":i_item", ":item"),
(troop_get_inventory_slot_modifier, ":i_imod", ":merchant", ":i_slot"),
(eq, ":i_imod", ":imod"),
#get value of item
(store_item_value, ":value", ":item"),
(call_script, "script_game_get_item_buy_price_factor", ":item"),
(val_mul, ":value", reg0),
#do same thing with imod
#do whatever - add to inventory, deduct gold, or display as a string
#break loop
(assign, ":cap", 10),
(assign, ":s_end", slot_town_weaponsmith),
(assign, ":t_end", towns_begin),
(try_end),
(try_end),
(try_end),
#return original value
(assign, "$g_encountered_party", ":encountered_party"),