Difference between revisions of "User:Candlemaster/Item Sorter"
imported>Candlemaster |
imported>Candlemaster |
||
Line 56: | Line 56: | ||
endif | endif | ||
End</pre> | End</pre> | ||
This is my first rendition of an OBSE-using ingredient sorter. | This is my first rendition of an OBSE-using ingredient sorter. | ||
After testing this script, nothing happens when "Sort Ingredients" is chosen, but "Open Container" works fine. | After testing this script, nothing happens when "Sort Ingredients" is chosen, but "Open Container" works fine. | ||
It appears that the problem may have been "GetObjectType". Instead, I'll try using OBSE's "IsIngredient" function. List of such functions: | It appears that the problem may have been "GetObjectType". Instead, I'll try using OBSE's "IsIngredient" function. List of such functions: | ||
*[IsAlchemyItem] | *[[IsAlchemyItem]] | ||
*[IsAmmo] | *[[IsAmmo]] | ||
*[IsApparatus] | *[[IsApparatus]] | ||
*[IsArmor] | *[[IsArmor]] | ||
*[IsBook] | *[[IsBook]] | ||
*[IsClonedForm] | *[[IsClonedForm]] | ||
*[IsClothing] | *[[IsClothing]] | ||
*[IsContainer] | *[[IsContainer]] | ||
*[IsFood] | *[[IsFood]] | ||
*[IsIngredient] | *[[IsIngredient]] | ||
*[IsKey] | *[[IsKey]] | ||
*[IsLight] | *[[IsLight]] | ||
*[IsLightCarriable] | *[[IsLightCarriable]] | ||
*[IsPlayable] | *[[IsPlayable]] | ||
*[IsPoison] | *[[IsPoison]] | ||
*[IsQuestItem] (important) | *[[IsQuestItem]] (important) | ||
*[IsScripted] | *[[IsScripted]] | ||
*[IsSigilStone] | *[[IsSigilStone]] | ||
*[IsSoulGem] | *[[IsSoulGem]] | ||
*[IsWeapon] | *[[IsWeapon]] |
Revision as of 02:30, 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 short Button short CheckOnce ref pInvObj ref pCont Begin OnActivate MessageBox "What would you like to do?" "Sort Ingredients" "Open Container" "Nevermind" set CheckOnce to 0 End Begin GameMode set Button to GetButtonPressed if ( Button == -1 ) Return elseif ( Button == 0 ) ;Sort Ingredients if ( HVHGTOBSE.HasObse == 1 ) if ( CheckOnce == 0 ) ;Only go through the player's inventory once 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 set CheckOnce to 1 endif endif elseif ( Button == 1 ) ;Open Container Activate elseif ( Button == 2 ) ;Nevermind return endif End
This is my first rendition of an OBSE-using ingredient sorter.
After testing this script, nothing happens when "Sort Ingredients" is chosen, but "Open Container" works fine.
It appears that the problem may have been "GetObjectType". Instead, I'll try using OBSE's "IsIngredient" function. List of such functions: