Stratics - The Massively Multiplayer Network
Stratics Network   Stratics Community   Stratics Central     
 
 
NWScript Array API (Application Programming Interface) v.1.1

Written and created by Evan Machusak
#nwnscript, irc.stratics.com (nick: emach)

Portions of this information are taken directly from the Array API readme so please refer to that for more detailed information on installing and using the Array API.

NWScript Array API (Application Programming Interface)v.1.1 is a set of functions intended to allow the NWScript programmer to simulate array functionality in NWScript, which lacks native C style array support.

An array is a data structure which holds many pieces of similar data in a sequences of "cells" such that each cell can be referenced by a number (called an index). Essentially, an array gives the programmer the ability to create lists of the common NWScript data types easily and efficiently, without having to manually manage a mess of many different variables.

For example, imagine keeping track of all of the places an NPC has been. When you command your NPC to go to a series of waypoints, and you want to be able to tell if he's been to a specific waypoint. In standard NWScript, you'd have to create and manage a local variable representing each waypoint and manually set and get each one.

With arrays, you can create a list of those waypoints and refer to all of them with a single name. Want to add the waypoint he's just visited? No problem. Want to check to see if he's been to a specific waypoint? One line of code. Want to reset his waypoint list and start again? Simple.

The array API will hopefully make such tasks in NWScript as easy and seemless as they should be.

Features

  • Array support for all of the possible local data types available in NWScript, including int, string, float, object, and location.
  • Built in error trapping in the form of log prints, which will allow you to quickly and effectively debug your code.
  • A full list of methods, including nearly all functionality of a C++ STL container class.
  • Easy to install and use.
  • Open source.

Downloads & Resources

View the API Readme - The complete readme for the Array API with installation and usage instructions.

Download Array API v1.1

View the Function Prototypes list - a reference for function names and parameters.

Arrays in NWScript - An article that covers the lack of arrays in NWScript and some of your options for working around that issue.



[an error occurred while processing this directive]