Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

For swapping two items, it's a bit complicated. I'm thinking it'd be easiest to duplicate inventory_lose_item into a new script called inventory_swap_item(itemID1, itemID2) and modify it so that it loops through the inventory twice, once for each item; once you have the two inventory slots, you just swap the ID/QTY data of those two slots using a temp variable.

Easy so far, but the tricky bit is GETTING the two item IDs you want to swap. If you want the Pokémon-style "press select" approach, I'm thinking you'd have some code in the script_step of the inventory menu (spawned by mev_pause_items / mev_battle_item) which checks for the 'select' button, and if so, memorizes the currently selected item (see mev_pause_items_select for an idea how to do that) spawns a new identical inventory menu (i.e. like in mev_pause_items / mev_battle_item) but uses NONE for its menu event script (the argument to msh_spawn_inventory) and another step script, which, if Select is pressed, memorizes the newly selected item, and if it's different from the first selected item, swaps the two items. In either case, it destroys itself, leaving you with the original inventory menu - but it should be updated to match the new sorting order, so you need to rebuild it. mev_pause_items_use_actually_use has a code snippet that rebuilds the item menu after the inventory potentially has changed, so apply that to the original inventory menu (easiest if you set the "daddy" variable of the "find the second item" inventory copy to the original inventory menu's id - just remember you'd loop over daddy instead of daddy's daddy when copying the code)

And of course, you might want a custom draw script for the "find the second item" menu that draws the inventory AND an extra marker for the first item, to notify the player that they're in a "rearrange the menu" state.


Side note: for multiple sorting options (e.g. A-Z, latest, etc) I'm thinking the easiest way would be modifying the msh_spawn_inventory_fill_list_category script, which builds a ds_list of all items of that "page" (items are actually stored in one big list internally instead of being divided into separate pages) - you could change that to a priority queue instead and have priorities based on the currently active sort mode.

mev_pause_items_use_actually_use has a code snippet that rebuilds the item menu after the inventory potentially has changed; copy that and use it to rebuild the menu whenever the player presses the "change sort mode" button. You could put this button check in the script_step of the affected menus, and note that you would apply the changes to the menu itself, not it's daddy's daddy, so remove the outer with loop.

(+1)

Thats actually really helpful and points me into the right direction. Many thanks for the detailed answer.