Difference between revisions of "Category:NVC"
Jump to navigation
Jump to search
updated
imported>Speedo m |
imported>Speedo (updated) |
||
Line 2: | Line 2: | ||
{{OBSE Plugin | {{OBSE Plugin | ||
|Version = Beta | |Version = Beta 4 | ||
|InternalVer = | |InternalVer = 4 | ||
|Name = Named Value Containers | |Name = Named Value Containers | ||
|Author = [http://www.bethsoft.com/bgsforums/index.php?showuser=233615 Speedo] | |Author = [http://www.bethsoft.com/bgsforums/index.php?showuser=233615 Speedo] | ||
Line 16: | Line 16: | ||
}} | }} | ||
== | ==Tutorial== | ||
See [[NVC Tutorial]] | See [[NVC Tutorial]] | ||
Line 32: | Line 32: | ||
The way NVC stores values can be thought of much like how your computer's hard drive stores files. Each value is identified by three characteristics: key (or name), location, and type (int/float/ref). | The way NVC stores values can be thought of much like how your computer's hard drive stores files. Each value is identified by three characteristics: key (or name), location, and type (int/float/ref). | ||
The container itself is essentially like the root of the drive (C:\). You may store values here if you wish, but you may also create child containers (like folders) within the container. One difference is that NVC seperates values within a container by type, so at any level it is perfectly valid to have values of different types which share the same key and location. | The container itself is essentially like the root of the drive (C:\). You may store values here if you wish, but you may also create child containers (which are like folders) within the container. One difference is that NVC seperates values within a container by type, so at any level it is perfectly valid to have values of different types which share the same key and location. | ||
*Like the folders on your computer, child containers should be seperated with a backslash (\). | |||
*There is no limit on the how many child containers or values may be created within a container (other than available memory), however for speed it is recommended to keep the number of child containers to a minimum. | |||
There is no limit on the how many child containers or values may be created within a container (other than available memory), however for speed it is recommended to keep the number of child containers to a minimum. | |||
===String Input=== | ===String Input=== | ||
In order to allow for more dynamic creation and access to NVC containers, all functions support the usage of OBSE string_vars for string input. | |||
For example, using the function [[nvcReadXXX|nvcReadInt]]: | |||
(int) nvcReadInt ContainerID key:string ''location:string key:string_var location:string_var'' | |||
If you wish to use the function with '''string literals''' -actual text that you type into the editor before you save a script- you can simply ignore the string_var parameters: | |||
set myintvar to nvcReadInt mycontainer "a value" "location 1\location 2" | |||
If you wish to use the function with string_vars, will do the opposite, ignoring the first string parameters in favor of the string_var parameters (Note: The CS requires you to put in something for the string parameters, but it doesn't matter what - it will be ignored): | |||
string_var key | |||
string_var location | |||
1 | ... | ||
set key to sv_Construct "a value" | |||
set location to sv_Construct "location 1\location 2" | |||
set myintvar to nvcReadInt mycontainer 0 0 key location | |||
*If a function has two parameters with the same name but different types (one string, the other string_var), the parameter with of the string type has priority so long as the string_var parameter is 0 or not supplied. | |||
*If a function (such as the [[nvcReadXXX]] functions) takes multiple strings as input, it is possible to mix strings and string_vars. For example, | |||
string_var key | |||
... | |||
set | set key to sv_Construct "a value" | ||
set myintvar to nvcReadInt mycontainer 0 "location 1\location 2" key | |||
:is perfect valid syntax. The name of the value to read will be taken from the "key" string_var, while the location of the value uses a string literal. | |||
==Miscellaneous== | ==Miscellaneous== | ||
*Active NVC data is saved in the .obse save file. | *Active NVC data is saved in the .obse save file. | ||
*Container information will persist in the save (and be loaded into the game) until either that container is deleted, or the owning esp is unloaded. | *Container information will persist in the save (and be loaded into the game) until either that container is deleted, or the owning esp is unloaded. | ||
*While the speed of NVC containers has not been fully tested, they generally should not be used in loops or other situtations where they will be heavily accessed (instead, prefer Pluggy arrays). | *While the speed of NVC containers has not been fully tested, they generally should not be used in loops or other situtations where they will be heavily accessed (instead, prefer [[:Category:Pluggy|Pluggy]] arrays). | ||
[[Category: Functions|Z]] | [[Category: Functions|Z]] | ||
[[Category: Functions (OBSE)]] | [[Category: Functions (OBSE)]] |