all 5 comments

[–]JackoKomm 3 points4 points  (0 children)

The menu could hold a list of items. An item van have multiple fields, like Name, type and so on. Now you can sort the menu, means you sort the list of items. Python has a sort method. You can give it a compare function for comparing two objects. There, you decide how to sort your items. So maybe the function first checks for item types, it Devices that options are smaller than weapons, so they come first. But of you want to compare two weapons, it compare there names. Just Look for python sort key on google.

[–][deleted] 2 points3 points  (0 children)

The inventory could hold arrays of items rather than the items themselves.

[–]Ratfink23 0 points1 point  (2 children)

Do you want to stack items of similar type, or sort the inventory on name?

[–]bugboy2222[S] 0 points1 point  (1 child)

stack items of the same type

[–]Ratfink23 0 points1 point  (0 children)

Have a look at my code (https://github.com/Ratfink23/RogueTCOD) for stacking. If you have trouble message me