Anomymous Hero's post reminded me of that.
Inventory shuffling is just an awful and indefensible thing. The only argument I've heard in favor of it is that it is neat to have your junk sorted. But you don't have to shuffle the inventory (meaning player->upkeep->inven array) for that. It could be done in the UI (item menu) and presented like that:
That is, the items are sorted, but the menu tags are not. So if your book is in 'f' slot, it will be there no matter what you pick up or drop.
Then it will be much easier to implement better macros ui - the macros will be tied to inventory slots, rather then to the items. E.g., you press F1 and that uses slot 'm' (or whatever slot you set F1 to select), and uses the item there, similar to DO_CMD_USE (a bit of additional logic will be needed for spells). The macro menu could become a part of context menu - say, you open inventory (with 'i') and select slot 'm'; if there is an item there, "Add macro" will be added to item's context menu; like so:
If there is no item, it will display a menu with only "Macro" entry.
There are some corner cases, for example, if F1 selects 't' slot, and the item in 't' gets destroyed and you later pick up an item and it goes into 't', that will change the meaning of F1 macro. If that's a problem, macros could be invalidated when you lose an item in that slot. For example, your only Magic for Beginners is in 't' and it got burned; then F1 macro is invalidated and will have to be recreated.
There could also be a method to swap items. E.g., you have Magic for Beginners in 't' and Word of Recall in 'a', and you want it to be the other way around. So you select slot 'a'; the context menu displays (among other things) "Swap item"; if you choose that, it asks which slot to swap with. Say, you answered 't'; now Word of Recall is in 't' and Magic for Beginners is in 'a'. So you can manually sort inventory that way, if you want.
Takkaria (I think) mentioned another way to implement better macros, using tval/sval, but there are some problems with that. For example, should 'w' (wield) command be supported? If yes (and I think that's reasonable), then tval and sval alone are not good enough for that, and it's necessary to track the exact item.
In any case, macros tied to inventory slots would be easier to implement, easier for player (especially new ones!) to understand, and as a bonus, it will require to get rid of inventory shuffling, which is an entirely good and desirable thing.
Thoughts?
Inventory shuffling is just an awful and indefensible thing. The only argument I've heard in favor of it is that it is neat to have your junk sorted. But you don't have to shuffle the inventory (meaning player->upkeep->inven array) for that. It could be done in the UI (item menu) and presented like that:
Code:
f) a Book of Magic Spells [Magic for Beginners] e) 5 Flasks of Oil n) a Potion of Berserk Strength c) 3 Scrolls of Phase Door a) a Scroll of Word of Recall
Then it will be much easier to implement better macros ui - the macros will be tied to inventory slots, rather then to the items. E.g., you press F1 and that uses slot 'm' (or whatever slot you set F1 to select), and uses the item there, similar to DO_CMD_USE (a bit of additional logic will be needed for spells). The macro menu could become a part of context menu - say, you open inventory (with 'i') and select slot 'm'; if there is an item there, "Add macro" will be added to item's context menu; like so:
Code:
a) Study b) Browse c) Drop d) Throw e) Macro f) Ignore
There are some corner cases, for example, if F1 selects 't' slot, and the item in 't' gets destroyed and you later pick up an item and it goes into 't', that will change the meaning of F1 macro. If that's a problem, macros could be invalidated when you lose an item in that slot. For example, your only Magic for Beginners is in 't' and it got burned; then F1 macro is invalidated and will have to be recreated.
There could also be a method to swap items. E.g., you have Magic for Beginners in 't' and Word of Recall in 'a', and you want it to be the other way around. So you select slot 'a'; the context menu displays (among other things) "Swap item"; if you choose that, it asks which slot to swap with. Say, you answered 't'; now Word of Recall is in 't' and Magic for Beginners is in 'a'. So you can manually sort inventory that way, if you want.
Takkaria (I think) mentioned another way to implement better macros, using tval/sval, but there are some problems with that. For example, should 'w' (wield) command be supported? If yes (and I think that's reasonable), then tval and sval alone are not good enough for that, and it's necessary to track the exact item.
In any case, macros tied to inventory slots would be easier to implement, easier for player (especially new ones!) to understand, and as a bonus, it will require to get rid of inventory shuffling, which is an entirely good and desirable thing.
Thoughts?
Comment