Jump to content

Multi-Dimensional Arrays?


Recommended Posts

Posted

I'm working on a mod that requires the use of a multi-dimensional array, but I can't seem to write one that works.

Basically, I have about 100 string arrays containing 16 entries each, and I need to store these 100 arrays in some form of list so I can reference/set/change them dynamically later on.

 

I need help making such a list that works. I was originally going to use a formlist but I figured out that formlists can't store pure string arrays, so no dice on that.
Does anyone here have a comprehensive description of how to make a multi-dimensional array?

 

I've already tried making the one suggested over at the creation kit wiki https://www.creationkit.com/index.php?title=Arrays_(Papyrus) and I can't quite figure that one out.

 

I can probably handle usage of the array myself if only I can get one working to begin with.

Posted

Create a Quest.

Create a Script with this definition:

 

	Scriptname mySubArray Extends Reference Alias
	 
	string[] Property subArrayVals Auto
	

 

Then in the quest create a reference alias and attach the script to it.

Duplicate the RefAlias 99 times (to have 100 alias in total)

 

 

Then you can reference the arrays as

 

(myRefAlias[row] as mySubArray).subArrayVals[col]

 

 

If you feel more adventorous, you can add some controlling function in a script you will attach to the quest, for example to directly get/set the value from a function by passing just the row and col as int parameters.

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...