ADDITEM
Script ADDITEM.BIN of Kamidori Alchemy Meister: id 0x5d, 74 instructions, fingerprint 0a8ccc36d950.
Gives or takes an item: it adds its caller's count to the item's inventory count, keeps the count at 0 or more and sells what passes 999, then sets the flags of the item and of the skills it grants.
Source: docs/kamidori-data-tables.md (Giving and taking, under Items)
Its caller sets these globals before the call:
| Global | What it holds |
|---|---|
current_item_id | the item |
current_item_count_change | the count to add, negative to take; 0 only sets the flags |
Calls
Called by $1$SC2630, $2$SC2700, $3$SC2900, $3$SC2910, $3$SC2920, $3$SC2930, $3$SC2940, $3$SC2950, $3$SC2960, ALCHEMY, CHECKIMPROVE, DEBUGADV, DEBUGAM, DEBUGMAP, DEBUGMAP2, FIELD, GAMESTART, INVITECH, RECEIPT, REWARD, SC0000, SC0050, SC0170, SC0320, SC0470, SC0500, SC0510, SC0560, SC0580, SC0700, SC0710, SC0740, SC0750, SC0760, SC0800, SC0830, SC0900, SC1020, SC1060, SC1090, SC1100, SC1150, SC1160, SC1170, SC1190, SC1250, SC1270, SC1280, SC1290, SC1300, SC1390, SC1500, SC1510, SC1520, SC1600, SC1730, SC1800, SC2020, SC3550, SC4520, SC6150, SETSTUDIO, SHOP, STAGECLEAR, UNITECH.
It calls no script by a constant id.
Globals
The named globals its instructions read, write or index (take as an array’s base), with how many operands do each. Cells no global names yet take 0 reads, 0 writes and 7 indexes more.
| Global | Reads | Writes | Indexes |
|---|---|---|---|
current_item_id | 22 | 0 | 0 |
item_inventory_counts | 0 | 0 | 7 |
shared_loop_index | 5 | 2 | 0 |
item_granted_skill_id | 0 | 0 | 6 |
player_money | 3 | 3 | 0 |
skill_bundled_skill_ids | 0 | 0 | 3 |
item_category | 0 | 0 | 2 |
item_prices | 0 | 0 | 2 |
shared_scratch_value | 1 | 1 | 0 |
current_item_count_change | 1 | 0 | 0 |
story_event_flags | 0 | 0 | 1 |