NvcValueExists

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search


A command for NVC.

(status:int) nvcValueExists ContainerID key:string location:string key:string_var 
                            location:string_var

Note: All parameters should be on the same line.

Checks if a value exists. If the return value is greater than 0, the value exists. However, because multiple values of different types may exist at the same key and location, you must use the OBSE's LogicalAnd function to determine what type(s) the value exists as.

  • If the value exists as an int, the first bit of the returned value will be set.
  • If it exists as a float, the second bit is set.
  • If it exists as a ref, the third bit is set.

Example[edit | edit source]

To check if the value "SomeValue" exists at the location "first\second\third", you would use something similar to the following code:

int result
int container

...

set result to nvcValueExists container "SomeValue" "first\second\third"

if (result > 0)
  ; value exists

  if (LogicalAnd result 1)
    ; exists as int
  endif

  if (LogicalAnd result 2)
    ; exists as float
  endif

  if (LogicalAnd result 4)
    ; exists as ref
  endif
endif