This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.

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

Jump to navigation Jump to search
imported>Candlemaster
imported>Candlemaster
Line 63: Line 63:


I've replaced GetObjectType with IsIngredient and nothing happens.  The problem must be elsewhere.
I've replaced GetObjectType with IsIngredient and nothing happens.  The problem must be elsewhere.
==Second Attempt==
<pre>scn HVHGTSorterScriptIngredients
long InvPos
long Quantity
short Button
short CheckOnce
ref pInvObj
Begin OnActivate
if ( GetActionRef == Player )
MessageBox "What would you like to do?" "Sort Ingredients" "Open Container" "Nevermind"
set CheckOnce to 0
else
Activate
endif
End
Begin GameMode
set Button to GetButtonPressed
if ( Button == -1 )
Return
elseif ( Button == 0 ) ;Sort Ingredients
if ( HVHGTOBSE.HasObse )
if ( CheckOnce == 0 ) ;Only go through the player's inventory once
PrintToConsole "Begun the search for ingredients"
array_var each
ForEach each <- player.GetItems 25 ; 25 = Ingredients
PrintToConsole "Found an Ingredient"
let pInvObj := each["Value"]
if eval !(IsQuestItem pInvObj)
let Quantity := player.GetItemCount pInvObj
player.RemoveItemNS pInvObj Quantity
AddItemNS pInvObj Quantity
PrintToConsole "Item Moved"
endif
Loop
PrintToConsole "LoopEnd"
endif
else
;Non-OBSE sorting script goes here
endif
set CheckOnce to 1
elseif ( Button == 1 ) ;Open Container
Activate
elseif ( Button == 2 ) ;Nevermind
return
endif
End</pre>
Uses code given by tejon on the official forums.  This script works flawlessly, sorting every ingredient in the player's inventory flawlessly.  Only amendment I can think of is to move the items in such a way that retains the item's variables, including health, charge, player enchantment, and stolen status.  Will look into using RemoveMe.  Needs to be tested on potions to see if it work with player-made potions.


==References==
==References==
Anonymous user

Navigation menu