Skip to content

[MOD] Smooth Selling v1.3

AdulAdul Member Posts: 2,002
edited September 2018 in UI Modding
Current version: 1.3

This mod aims to make it easier and less time-consuming to perform common tasks in stores and item bags, such as selling or moving whole stacks of items.

Features:
  • [Store UI] Single-clicking a stack of items in the Sell pane selects the whole stack (this includes selling items from bags)
  • [Item Bag UI] Single-clicking a stack of items (in either pane) selects the whole stack
  • [Choose Amount UI] The default split stack item amount is set to 1 consistently
  • [Choose Amount UI] Pressing Enter closes the window and selects the specified amount
  • [Choose Amount UI] Closing the window with Escape or Cancel deselects the item

You can add these changes by making the following edits to the UI.menu file (which you can export from NearInfinity):

1. Find this code segment:
		action
		"
			local cnt = tonumber(itemRequestAmt)
			Infinity_PopMenu()
			if(cnt and cnt > 0 and cnt <= requester.requesterMax) then
				requester.requesterFunc(cnt)
			end
		"
Insert before the above code segment:
		on return

2. Find this code segment:
		action
		"
			if store.storeItems[storeItemsVar].clickable == 1 then
				if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
					local highlight = true
					if(store.storeItems[storeItemsVar].highlight == 1) then highlight = false end
					storeScreen:SelectStoreItem( storeItemsVar - 1,  highlight)
				end
			end
		"
		actionalt
		"
			showItemDescription(store.storeItems[storeItemsVar].item, 1)
		"
		actionDbl
		"
			if store.storeItems[storeItemsVar].clickable == 1 then
				if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
					local maxCount = store.storeItems[storeItemsVar].maxCount
					if(maxCount > 1) then
						popupRequester(maxCount, storeSplitStack, false)
					end
				end
			end
		"
Replace the above code segment with:
		action
		"
			if store.storeItems[storeItemsVar].clickable == 1 then
				if not storeScreen:IsContainer() then
					if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
						local highlight = true
						if(store.storeItems[storeItemsVar].highlight == 1) then highlight = false end
						storeScreen:SelectStoreItem(storeItemsVar - 1,  highlight)
					end
				elseif (store.storeItems[storeItemsVar].highlight == 1) then
					storeScreen:SelectStoreItem(storeItemsVar - 1,  false)
				else
					storeScreen:SelectStoreItem(storeItemsVar - 1,  true)
					local count = store.storeItems[storeItemsVar].item.count
					local stock = store.storeItems[storeItemsVar].numInStock
					if (count > 1) then
						storeScreen:SetStoreItemCount(storeItemsVar - 1, count)
					elseif (stock > 1) then
						storeScreen:SetStoreItemCount(storeItemsVar - 1, stock)
					end	
				end
			end
		"
		actionalt
		"
			showItemDescription(store.storeItems[storeItemsVar].item, 1)
		"
		actionDbl
		"
			if store.storeItems[storeItemsVar].clickable == 1 then
				if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
					local maxCount = store.storeItems[storeItemsVar].maxCount
					if(maxCount > 1) then
						popupRequester(maxCount, storeSplitStack, false)
						storeScreen:SelectStoreItem(storeItemsVar - 1, false)
					end
				end
			end
		"

3. Find this code segment:
		action
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				local selected = true
				if(store.groupItems[storeGroupItemsVar].highlight == 1) then selected = false end
				storeScreen:SelectGroupItem( storeGroupItemsVar - 1,  selected)
			end
		"
		actionalt
		"
			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
		"
		actionDbl
		"
		if(store.groupItems[storeGroupItemsVar].item.isBag == 1) then
			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
			itemDescLeftButtonAction()
		else
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				local count = store.groupItems[storeGroupItemsVar].item.count
				local stock = store.groupItems[storeGroupItemsVar].numInStock
				if(count > 1) then
					popupRequester(count, groupSplitStack, true)
				elseif stock > 1 then
					popupRequester(stock, groupSplitStack, true)
				end	
			end
		end
		"
Replace the above code segment with:
		action
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				if (store.groupItems[storeGroupItemsVar].highlight == 1) then
					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  false)
				else
					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  true)
					local count = store.groupItems[storeGroupItemsVar].item.count
					local stock = store.groupItems[storeGroupItemsVar].numInStock
					if (count > 1) then
						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, count)
					elseif (stock > 1) then
						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, stock)
					end
				end
			end
		"
		actionalt
		"
			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
		"
		actionDbl
		"
			if(store.groupItems[storeGroupItemsVar].item.isBag == 1) then
				showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
				itemDescLeftButtonAction()
			else
				if store.groupItems[storeGroupItemsVar].valid ~= 0 then
					local count = store.groupItems[storeGroupItemsVar].item.count
					local stock = store.groupItems[storeGroupItemsVar].numInStock
					if(count > 1) then
						popupRequester(count, groupSplitStack, false)
					elseif stock > 1 then
						popupRequester(stock, groupSplitStack, false)
					end
					storeScreen:SelectGroupItem(storeGroupItemsVar - 1, false)
				end
			end
		"

4. Find this code segment:
		action
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				local selected = true
				if(store.groupItems[storeGroupItemsVar].highlight == 1) then selected = false end
				storeScreen:SelectGroupItem( storeGroupItemsVar - 1,  selected)
			end
		"
		actionalt
		"
			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
		"
		actionDbl
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				local count = store.groupItems[storeGroupItemsVar].item.count
				local stock = store.groupItems[storeGroupItemsVar].numInStock
				if(count > 1) then
					popupRequester(count, groupSplitStack, true)
				elseif stock > 1 then
					popupRequester(stock, groupSplitStack, true)
				end	
			end
		"
Replace the above code segment with:
		action
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				if (store.groupItems[storeGroupItemsVar].highlight == 1) then
					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  false)
				else
					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  true)
					local count = store.groupItems[storeGroupItemsVar].item.count
					local stock = store.groupItems[storeGroupItemsVar].numInStock
					if (count > 1) then
						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, count)
					elseif (stock > 1) then
						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, stock)
					end
				end
			end
		"
		actionalt
		"
			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
		"
		actionDbl
		"
			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
				local count = store.groupItems[storeGroupItemsVar].item.count
				local stock = store.groupItems[storeGroupItemsVar].numInStock
				if(count > 1) then
					popupRequester(count, groupSplitStack, false)
				elseif stock > 1 then
					popupRequester(stock, groupSplitStack, false)
				end
				storeScreen:SelectGroupItem(storeGroupItemsVar - 1, false)
			end
		"

And... you're done. Enjoy!
Post edited by Adul on

Comments

  • AdulAdul Member Posts: 2,002
    edited March 2017
    Update 1.1
    • Extended the single-click-selects-entire-stack behavior to all bag interactions
    • Changed the default split stack amounts to the max number of items (in all situations, except in the store Buy pane, where the default amount is 1)
    Now single click stack selection is consistent across all item management interactions, except for buying items from stores (where it isn't practical to select all items in stock).
    Post edited by Adul on
  • AdulAdul Member Posts: 2,002
    edited March 2017
    Update 1.2
    • New feature: [Choose Amount UI] The default split stack item amount is set to 1 consistently
    • Fixed a patch incompatibility error that caused the Choose Amount window to open twice when trying to split item stacks in the most recent EE version (v2.3)
    • Name changed to "Smooth Selling" (original name: "Improved Store Usability")
    Choose Amount behavior is now improved. Now when you double-click an item stack in the store window or item bag window, the item stack is immediately deselected and the Choose Amount window opens. If you accept the selected amount, the window closes and the item stack is reselected with the specified amount. But if you cancel out of the window, the item stack will remain not selected.

    I also restructured the code in some places, and as a result the install process had become a little simpler (only 4 steps instead of the prior 6).
    Post edited by Adul on
  • AdulAdul Member Posts: 2,002
    edited September 2018
    This post is reserved for previous mod versions.

    Old mod version 1.2 instructions:
    1. Find this code segment:
    		action
    		"
    			local cnt = tonumber(itemRequestAmt)
    			Infinity_PopMenu()
    			if(cnt and cnt > 0 and cnt <= requester.requesterMax) then
    				requester.requesterFunc(cnt)
    			end
    		"
    Insert before the above code segment:
    		on return

    2. Find this code segment:
    		action
    		"
    			if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
    				local highlight = true
    				if(store.storeItems[storeItemsVar].highlight == 1) then highlight = false end
    				storeScreen:SelectStoreItem( storeItemsVar - 1,  highlight)
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.storeItems[storeItemsVar].item, 1)
    		"
    		actionDbl
    		"
    			if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
    				local maxCount = store.storeItems[storeItemsVar].maxCount
    				if(maxCount > 1) then
    					popupRequester(maxCount, storeSplitStack, false)
    				end
    			end
    		"
    Replace the above code segment with:
    		action
    		"
    			if not storeScreen:IsContainer() then
    				if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
    					local highlight = true
    					if(store.storeItems[storeItemsVar].highlight == 1) then highlight = false end
    					storeScreen:SelectStoreItem(storeItemsVar - 1,  highlight)
    				end
    			elseif (store.storeItems[storeItemsVar].highlight == 1) then
    				storeScreen:SelectStoreItem(storeItemsVar - 1,  false)
    			else
    				storeScreen:SelectStoreItem(storeItemsVar - 1,  true)
    				local count = store.storeItems[storeItemsVar].item.count
    				local stock = store.storeItems[storeItemsVar].numInStock
    				if (count > 1) then
    					storeScreen:SetStoreItemCount(storeItemsVar - 1, count)
    				elseif (stock > 1) then
    					storeScreen:SetStoreItemCount(storeItemsVar - 1, stock)
    				end	
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.storeItems[storeItemsVar].item, 1)
    		"
    		actionDbl
    		"
    			if not storeScreen:IsCloseBagButtonClickable() or store.storeItems[storeItemsVar].valid == 1 then
    				local maxCount = store.storeItems[storeItemsVar].maxCount
    				if(maxCount > 1) then
    					popupRequester(maxCount, storeSplitStack, false)
    					storeScreen:SelectStoreItem(storeItemsVar - 1, false)
    				end
    			end
    		"

    3. Find this code segment:
    		action
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				local selected = true
    				if(store.groupItems[storeGroupItemsVar].highlight == 1) then selected = false end
    				storeScreen:SelectGroupItem( storeGroupItemsVar - 1,  selected)
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    		"
    		actionDbl
    		"
    		if(store.groupItems[storeGroupItemsVar].item.isBag == 1) then
    			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    			itemDescLeftButtonAction()
    		else
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				local count = store.groupItems[storeGroupItemsVar].item.count
    				local stock = store.groupItems[storeGroupItemsVar].numInStock
    				if(count > 1) then
    					popupRequester(count, groupSplitStack, true)
    				elseif stock > 1 then
    					popupRequester(stock, groupSplitStack, true)
    				end	
    			end
    		end
    		"
    Replace the above code segment with:
    		action
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				if (store.groupItems[storeGroupItemsVar].highlight == 1) then
    					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  false)
    				else
    					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  true)
    					local count = store.groupItems[storeGroupItemsVar].item.count
    					local stock = store.groupItems[storeGroupItemsVar].numInStock
    					if (count > 1) then
    						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, count)
    					elseif (stock > 1) then
    						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, stock)
    					end
    				end
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    		"
    		actionDbl
    		"
    			if(store.groupItems[storeGroupItemsVar].item.isBag == 1) then
    				showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    				itemDescLeftButtonAction()
    			else
    				if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    					local count = store.groupItems[storeGroupItemsVar].item.count
    					local stock = store.groupItems[storeGroupItemsVar].numInStock
    					if(count > 1) then
    						popupRequester(count, groupSplitStack, false)
    					elseif stock > 1 then
    						popupRequester(stock, groupSplitStack, false)
    					end
    					storeScreen:SelectGroupItem(storeGroupItemsVar - 1, false)
    				end
    			end
    		"

    4. Find this code segment:
    		action
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				local selected = true
    				if(store.groupItems[storeGroupItemsVar].highlight == 1) then selected = false end
    				storeScreen:SelectGroupItem( storeGroupItemsVar - 1,  selected)
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    		"
    		actionDbl
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				local count = store.groupItems[storeGroupItemsVar].item.count
    				local stock = store.groupItems[storeGroupItemsVar].numInStock
    				if(count > 1) then
    					popupRequester(count, groupSplitStack, true)
    				elseif stock > 1 then
    					popupRequester(stock, groupSplitStack, true)
    				end	
    			end
    		"
    Replace the above code segment with:
    		action
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				if (store.groupItems[storeGroupItemsVar].highlight == 1) then
    					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  false)
    				else
    					storeScreen:SelectGroupItem(storeGroupItemsVar - 1,  true)
    					local count = store.groupItems[storeGroupItemsVar].item.count
    					local stock = store.groupItems[storeGroupItemsVar].numInStock
    					if (count > 1) then
    						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, count)
    					elseif (stock > 1) then
    						storeScreen:SetGroupItemCount(storeGroupItemsVar - 1, stock)
    					end
    				end
    			end
    		"
    		actionalt
    		"
    			showItemDescription(store.groupItems[storeGroupItemsVar].item, 1)
    		"
    		actionDbl
    		"
    			if store.groupItems[storeGroupItemsVar].valid ~= 0 then
    				local count = store.groupItems[storeGroupItemsVar].item.count
    				local stock = store.groupItems[storeGroupItemsVar].numInStock
    				if(count > 1) then
    					popupRequester(count, groupSplitStack, false)
    				elseif stock > 1 then
    					popupRequester(stock, groupSplitStack, false)
    				end
    				storeScreen:SelectGroupItem(storeGroupItemsVar - 1, false)
    			end
    		"

    And... you're done. Enjoy!
  • AdulAdul Member Posts: 2,002
    Update 1.3
    • Updated the mod for BG:EE v2.5.17 and BG2:EE v2.5.16
  • AlonsoAlonso Member Posts: 806
    I'm trying to install your mod as a part of the EE UI Tweaks, but I'm receiving an error message. Your mod is the only one that had problems, all the others installed fine. The install program suggested I get help from @AncientCowboy, but he hasn't been online in almost two monts. Can you help with this?
  • AdulAdul Member Posts: 2,002
    @Alonso It's possible that the mod is incompatible with one of the other ones, so depending on what other UI mods you'd install before it the install might not work. Or at least, that would be my first hunch.

    Does it also give you an error if you try to install the mod by itself on a clean (UI-mod-free) install?
  • AlonsoAlonso Member Posts: 806
    No, no errors in a clean install, so it looks like your hunch was right. Any idea of how to find out where the incompability is?
  • AdulAdul Member Posts: 2,002
    @Alonso If you know what other UI mods you had installed before it when it failed to install, I'd just try those one by one. It's likely that the incompatible mod also modifies either the store UI or the choose item amount UI, so perhaps that narrows it down somewhat.
  • AlonsoAlonso Member Posts: 806
    I tried what you suggested and I cannot make a lot of sense of the results. I tried installing EE UI Tweaks on a vanilla installation with the same components I use in my fully modded installation, and it installed just fine, including your mod. So it looks like there's no conflict with any of the other UI components.

    The other mods I have in my modded installation are not UI related: Ascension, Tweaks Anthology, SCS, Portraits everywhere, Lighting pack and Jimfix. Could there be a conflict with any of these?
  • AdulAdul Member Posts: 2,002
    @Alonso Interesting. I don't think so, my mod, as well as EE UI Tweaks, only modify the UI.menu file. If one of those other mods also modifies it, it's possible that there's a conflict, but I don't see why any of them would. Granted, I'm not familiar with all of them, so maybe one of them does.
  • AlonsoAlonso Member Posts: 806
    Just realized I hadn't answered here. I didn't manage to pinpoint the conflict, but eventually it disappeared when I changed a bit my installation, so problem gone. Thanks for your help.
Sign In or Register to comment.