NifGetNumBlocks

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

This is a command from NifSE.

Syntax

(short:numBlocks) NifGetNumBlocks short:nifID

Returns the total number of blocks in the specified NIF file. Every block is a NiObject-derived class that can be indicated by using the blockID argument in various NifSE functions; the blockIDs starts with 0 and sequentially numbers each block until all of the blocks are numbered.

Example[edit | edit source]

This script will go through all of the blocks in the NIF, and print the type of each.

short nifID
short numBlocks
short blockID
...
let nifID := NifOpen "some file path"
let numBlocks := NifGetNumBlocks nifID
let blockID := 0
while ( blockID < numBlocks )
  Print "Block #"+$blockID+" is type %q"+(NiObjectGetTypeName nifID blockID)+"%q."
  let blockID += 1
loop