Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[MOD] Smooth Selling v1.3

AdulAdul Member Posts: 1,691
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
mf2112lefreutIllustairGrammarsaladPeccamodestvolta

Comments

  • AdulAdul Member Posts: 1,691
    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: 1,691
    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: 1,691
    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: 1,691
    Update 1.3
    • Updated the mod for BG:EE v2.5.17 and BG2:EE v2.5.16

Sign In or Register to comment.