logo logo

Hashset Module Documentation

Documentation and program are © by Ingmar Stieger (Papillon). Version 1.0 of 18.12.2003.

Table of Contents:

I. What does this module do?
II. Using the module

I. What does this module do?

This modules implements an advanced data structure, combining a hashmap and a set. This means you can set up associations between key - value pairs (hashmap), and also cycle through all stored data (set). You can even use this like an array, although it has much more to offer than just that. Even if it's the first release of this module, it has been in production on Avlis for quite some now and proofed to be very reliable.

Licence
This module is distributed unter the terms of the GNU GENERAL PUBLIC LICENSE included in licence.txt.

II. Using the module

A. Importing the erf

  1. Place the file "hashset_nwnx.erf" into the C:\Neverwinternights\NWN\erf directory.
  2. In the toolset, open up the module into which you wish to install the scripts.
  3. Under the File Menu, click Import. A window will pop up.
  4. Make sure the contents of the C:\Neverwinternights\NWN\erf directory are showing in the window
  5. Select "hashset_nwnx.erf" from the list.
The following script should now be imported: hashset_nwnx

B. Using the HashSet functions

The functions below are implemented. Have a look at the script modload in the module "hashset_nwnx.mod" to see how these functions are used.

int HashSetCreate(object oObject, string sHashSetName, int iSize = 500)

create a new HashSet on oObject with name sHashSetName
iSize is optional

void HashSetDestroy(object oObject, string sHashSetName)

Clear and delete sHashSetName on oObject

int HashSetValid(object oObject, string sHashSetName)

return true if hashset sHashSet is valid

int HashSetKeyExists(object oObject, string sHashSetName, string sKey)

return true if hashset sHashSet contains key sKey

int HashSetSetLocalString(object oObject, string sHashSetName, string sKey, string sValue)

Set key sKey of sHashset to string sValue

string HashSetGetLocalString(object oObject, string sHashSetName, string sKey)

Retrieve string value of sKey in sHashset

int HashSetSetLocalInt(object oObject, string sHashSetName, string sKey, int iValue)

Set key sKey of sHashset to integer iValue

int HashSetGetLocalInt(object oObject, string sHashSetName, string sKey)

Retrieve integer value of sKey in sHashset

int HashSetDeleteVariable(object oObject, string sHashSetName, string sKey)

Delete sKey in sHashset

string HashSetGetNthKey(object oObject, string sHashSetName, int i)

Return the n-th key in sHashset
note: this returns the KEY, not the value of the key

string HashSetGetFirstKey(object oObject, string sHashSetName)

Return the first key in sHashset
note: this returns the KEY, not the value of the key;

string HashSetGetNextKey(object oObject, string sHashSetName)

Return the next key in sHashset
note: this returns the KEY, not the value of the key;

string HashSetGetCurrentKey(object oObject, string sHashSetName)

Return the current key in sHashset
note: this returns the KEY, not the value of the key;

int HashSetGetSize(object oObject, string sHashSetName)

Return the number of elements in sHashset

int HashSetHasNext(object oObject, string sHashSetName)

Return TRUE if the current key is not the last one, FALSE otherwise