Difference between revisions of "NVC Tutorial"

Jump to navigation Jump to search
658 bytes added ,  11:22, 15 November 2008
updated
imported>Speedo
(Created)
 
imported>Speedo
(updated)
*Save some basic info about each item: FormID and count of that item in the inventory
*Save some basic stats for the item in a child container "<name>\Stats": OBSE item type, gold value and weight
*Once all data has been assembled, output the container as both text and XML.
 
==The Script==
 
int con
string_var tempStr
int key
int loc
 
int tempInt
if (IsContainer || IsActor)
set con to nvcNew
set keytempStr to CreateStringsv_Construct -1 0 1 1"%e"
set loc to CreateString -1 0 1 1
set index to 0
set tempRef to GetInventoryObject index
StringGetNamesv_Set "%n" tempRef loctempStr
if (nvcChildExists con 0 1 loctempStr == 0)
SetStringnvcSetRef keytempRef con "FormID" 0 0 tempStr
nvcSetRef tempRef con 0 0 1 key loc
set tempInt to GetItemCount tempRef
SetStringnvcSetInt keytempInt con "Count" 0 0 tempStr
nvcSetInt tempInt con 0 0 1 key loc
SetString keysv_Set "%z\Stats" tempStr tempStr
StringCat loc key
set tempInt to GetObjectType tempRef
SetStringnvcSetInt keytempInt con "Type" 0 0 tempStr
nvcSetInt tempInt con 0 0 1 key loc
set tempFloat to GetWeight tempRef
SetStringnvcSetFloat keytempFloat con "Weight" 0 0 tempStr
nvcSetFloat tempFloat con 0 0 1 key loc
set tempInt to GetFullGoldValue tempRef
SetStringnvcSetInt keytempInt con "Value" 0 0 tempStr
nvcSetInt tempInt con 0 0 1 key loc
endif
set tempRef to GetSelf
StringGetNamesv_Set "%n Inventory.txt" tempRef keytempStr
nvcPrintToFile con 0 -1 tempStr
SetString loc " Inventory.txt"
StringCat key loc
sv_Replace ".txt|.xml" tempStr
nvcPrintToFile con 0 -1 1 key
nvcSaveToXml con 0 tempStr
nvcDel con
set tempStr to sv_Destruct
DestroyString key
DestroyString loc
else
 
==Sample Output==
Output from a Legion SoldierGoblin:
 
===Text File Output===
<pre>
Container 65
Owner 0201
Protected
Item Count = 134 <int>
Base FormID = 000700C600084B29 <ref>
FormID = 000700F3FF00080F <ref>
Iron Arrow\
Flax Tunic\
Count = 15 <int>
FormID = 0002C0FA00017829 <ref>
Stats\
Type = 2234 <int>
Value = 1 <int>
Weight = 10.00000001000000 <float>
Iron Bow\
Gold\
Count = 3 <int>
FormID = 0000000F <ref>
Stats\
Type = 27 <int>
Value = 1 <int>
Weight = 0.0000000 <float>
Laced Leather Pants\
Count = 1 <int>
FormID = 000229AB00025231 <ref>
Stats\
Type = 2233 <int>
Value = 111 <int>
Weight = 18.0000000 <float>
Lockpick\
Legion Boots\
Count = 1 <int>
FormID = 00028ADE0000000A <ref>
Stats\
Type = 2027 <int>
Value = 503 <int>
Weight = 100.50000000000000 <float>
Rusty Iron Mace\
Legion Cuirass\
Count = 1 <int>
FormID = 00028ADF00090614 <ref>
Stats\
Type = 20 <int>
Value = 180 <int>
Weight = 35.0000000 <float>
Legion Gauntlets\
Count = 1 <int>
FormID = 00028AE0 <ref>
Stats\
Type = 20 <int>
Value = 50 <int>
Weight = 7.0000000 <float>
Legion Greaves\
Count = 1 <int>
FormID = 00028AE1 <ref>
Stats\
Type = 20 <int>
Value = 95 <int>
Weight = 21.0000000 <float>
Legion Helmet\
Count = 1 <int>
FormID = 00028AE2 <ref>
Stats\
Type = 20 <int>
Value = 50 <int>
Weight = 7.0000000 <float>
Legion Shield\
Count = 1 <int>
FormID = 000352D3 <ref>
Stats\
Type = 20 <int>
Value = 95 <int>
Weight = 14.0000000 <float>
Mutton\
Count = 4 <int>
FormID = 00033686 <ref>
Stats\
Type = 25 <int>
Value = 2 <int>
Weight = 2.0000000 <float>
Sack Cloth Sandals\
Count = 1 <int>
FormID = 0002731A <ref>
Stats\
Type = 22 <int>
Value = 1 <int>
Weight = 2.0000000 <float>
Silver Longsword\
Count = 1 <int>
FormID = 0002521F <ref>
Stats\
Type = 33 <int>
Value = 1256 <int>
Weight = 2815.0000000 <float>
</pre>
Torch\
 
Count = 1 <int>
 
FormID = 0002CF9F <ref>
===XML File Output===
Stats\
<pre>
Type = 26 <int>
<?xml version="1.0" ?>
Value = 0 <int>
<container version="1" />
Weight = 0.0000000 <float>
<int>
<value name="Item Count" data="4" />
</int>
<ref>
<value name="Base FormID" data="00084B29" esp="Oblivion.esm" />
<value name="FormID" data="00000000" esp="&lt;none&gt;" />
</ref>
<child name="Iron Arrow">
<int>
<value name="Count" data="5" />
</int>
<ref>
<value name="FormID" data="00017829" esp="Oblivion.esm" />
</ref>
<child name="Stats">
<int>
<value name="Type" data="34" />
<value name="Value" data="1" />
</int>
<float>
<value name="Weight" data="0.100000" />
</float>
</child>
</child>
<child name="Iron Bow">
<int>
<value name="Count" data="1" />
</int>
<ref>
<value name="FormID" data="00025231" esp="Oblivion.esm" />
</ref>
<child name="Stats">
<int>
<value name="Type" data="33" />
<value name="Value" data="11" />
</int>
<float>
<value name="Weight" data="8.000000" />
</float>
</child>
</child>
<child name="Lockpick">
<int>
<value name="Count" data="1" />
</int>
<ref>
<value name="FormID" data="0000000A" esp="Oblivion.esm" />
</ref>
<child name="Stats">
<int>
<value name="Type" data="27" />
<value name="Value" data="3" />
</int>
<float>
<value name="Weight" data="0.000000" />
</float>
</child>
</child>
<child name="Rusty Iron Mace">
<int>
<value name="Count" data="1" />
</int>
<ref>
<value name="FormID" data="00090614" esp="Oblivion.esm" />
</ref>
<child name="Stats">
<int>
<value name="Type" data="33" />
<value name="Value" data="6" />
</int>
<float>
<value name="Weight" data="15.000000" />
</float>
</child>
</child>
</pre>
 
Anonymous user

Navigation menu