Difference between revisions of "User:Candlemaster/Item Sorter"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Candlemaster
(New page: =Item Sorter= This is a wanted script, I have not yet begun working on it. The goal of this script is to search the player's inventory for certain items, and place them into a special co...)
 
imported>Candlemaster
Line 1: Line 1:
=Item Sorter=
=Item Sorter=
This is a wanted script, I have not yet begun working on it.


The goal of this script is to search the player's inventory for certain items, and place them into a special container.  This has been accomplished in a number of oblivion mods (see COBL's alchemy sorter), so it should not be too difficult to find reference scripts.
The goal of this script is to search the player's inventory for certain items, and place them into a special container.  This has been accomplished in a number of oblivion mods (see COBL's alchemy sorter), so it should not be too difficult to find reference scripts.
Line 10: Line 8:


All that I want to do with this script has been done in COBL's alchemy sorter script, so most likely I'll copy the backbone of said script.  If you have any advice or tips for this endeavor, please post them here.
All that I want to do with this script has been done in COBL's alchemy sorter script, so most likely I'll copy the backbone of said script.  If you have any advice or tips for this endeavor, please post them here.
==First Attempt==
<pre>scn HVHGTSorterScriptIngredients
long InvPos
long Quantity
ref pInvObj
ref pCont
Begin OnActivate
if ( HVHGTOBSE.HasObse == 1 )
set pCont to PlayerRef
set InvPos to 0
Label
set pInvObj to (pCont.GetInventoryObject InvPos)
if pInvObj
if ( pInvObj.GetObjectType == 25 ) ;if the item is an ingredient
if ( pInvObj.IsQuestItem == 0 ) ;don't do anything to a quest item
set Quantity to pCont.GetItemCount pInvObj
pCont.RemoveItemNS pInvObj Quantity
AddItemNS pInvObj Quantity
endif
endif
set InvPos to (InvPos + 1)
Goto
endif
endif
End</pre>
This is my first rendition of an OBSE-using ingredient sorter.  Notice "GetObjectType == 25" which checks if the object is, in fact, an ingredient.  For more codes like this, see [GetObjectType].  Useful codes (For this purpose) seem to be:
<pre>19  Apparatus
20  Armor
21  Book
22  Clothing
25  Ingredient
26  Light ;Including Torches?
27  Misc
33  Weapon
34  Ammo
38  Soul Gem
39  Key
40  Alchemy Item ;I'm pretty sure this means Potion
42  Sigil Stone</pre>

Revision as of 01:09, 12 May 2010

Item Sorter

The goal of this script is to search the player's inventory for certain items, and place them into a special container. This has been accomplished in a number of oblivion mods (see COBL's alchemy sorter), so it should not be too difficult to find reference scripts.

I wish to make separate scripts for each item type; One for ingredients, one for potions, one for books (possible to interact with the book sorter?), one for scrolls, one for Blade weapons, one for Blunt weapons, one for Marksman weapons, one for Light armor, one for Heavy armor, one for Keys, one for Soul Gems, and one for Misc. items (Ores, gems, hides, etc.)

Without using OBSE, I suspect that I'll need to add checks for every item in the game. This method will be easy to make exceptions, and make it impossible to sort quest items. I'd like to add optional OBSE functionality which will sort mod-added items, and add buttons for the ingredient, potion, and magic scroll sorters which will allow you to withdraw items by effect.

All that I want to do with this script has been done in COBL's alchemy sorter script, so most likely I'll copy the backbone of said script. If you have any advice or tips for this endeavor, please post them here.

First Attempt

scn HVHGTSorterScriptIngredients

long InvPos
long Quantity
ref pInvObj
ref pCont


Begin OnActivate
	if ( HVHGTOBSE.HasObse == 1 )
		set pCont to PlayerRef
		set InvPos to 0
		Label
		set pInvObj to (pCont.GetInventoryObject InvPos)
		if pInvObj
			if ( pInvObj.GetObjectType == 25 ) ;if the item is an ingredient
				if ( pInvObj.IsQuestItem == 0 ) ;don't do anything to a quest item
					set Quantity to pCont.GetItemCount pInvObj
					pCont.RemoveItemNS pInvObj Quantity
					AddItemNS pInvObj Quantity
				endif
			endif
			set InvPos to (InvPos + 1)
			Goto
		endif
	endif
End

This is my first rendition of an OBSE-using ingredient sorter. Notice "GetObjectType == 25" which checks if the object is, in fact, an ingredient. For more codes like this, see [GetObjectType]. Useful codes (For this purpose) seem to be:

19   Apparatus
20   Armor
21   Book
22   Clothing
25   Ingredient
26   Light ;Including Torches?
27   Misc
33   Weapon
34   Ammo
38   Soul Gem
39   Key
40   Alchemy Item ;I'm pretty sure this means Potion
42   Sigil Stone