I'm working on a daily inventory cleanup script for my basement dives and for after defeating her Naughtiness. The script has two functional parts. The first processes a map of instructions, and that part was not difficult, but I am having difficulty with the second part, which (hopefully) adds to the map. The map is of type instructionRecord [item], where instructionRecord is defined like this:
The script processes each record by doing action1 to amouint1 of the items in inventory, and action2 to the rest. For example, the record for "obsidian dagger" would read "keep", 2, "display", which would keep 2 in inventory and stuff the rest in my display case, or "tiny plastic anime smiley" might read "display", 1, "send", which would stick 1 into my display case, and send the rest to my wife, who collects the things.
What I need to finish the second part are two things. First, a way to load my current inventory into a map, and I think I remember seeing that somewhere among the tthreads. The first part can be made to function without this by parsing through an exhaustive list, but 'tis inelegant, I think. The second thing I need is a way to get input in mid-stream, something along the lines of:
Of course, this can be made to work in other ways, but I'd rather not build my map by stuffing everything recognizable into my closet and then manually adding records for what's left in inventory.
Code:
record instructionRecord {
string action1;
int amount1;
string action2;
};
The script processes each record by doing action1 to amouint1 of the items in inventory, and action2 to the rest. For example, the record for "obsidian dagger" would read "keep", 2, "display", which would keep 2 in inventory and stuff the rest in my display case, or "tiny plastic anime smiley" might read "display", 1, "send", which would stick 1 into my display case, and send the rest to my wife, who collects the things.
What I need to finish the second part are two things. First, a way to load my current inventory into a map, and I think I remember seeing that somewhere among the tthreads. The first part can be made to function without this by parsing through an exhaustive list, but 'tis inelegant, I think. The second thing I need is a way to get input in mid-stream, something along the lines of:
Code:
foreach Thing in iinvList {
if(invList[Thing].action == "") {
[Pop up input dialogs to collect the pieces of the record]
} else {
[Normal record processing]
}
}
Of course, this can be made to work in other ways, but I'd rather not build my map by stuffing everything recognizable into my closet and then manually adding records for what's left in inventory.