Open main menu
Home
Random
Log in
Settings
About the CreationKit Wiki
Disclaimers
the CreationKit Wiki
Search
Editing
Array Reference
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Large Arrays without SKSE === If an array larger than 128 elements is required, a work-around is to use multiple arrays to form one large array. Below is an example of how this can be accomplished for an array that can hold 512 floats: <syntaxhighlight lang="papyrus"> float[] Array1 float[] Array2 float[] Array3 float[] Array4 function CreateArray() { Use to create the array. } Array1 = new float[128] Array2 = new float[128] Array3 = new float[128] Array4 = new float[128] endFunction float function GetArrayElement(int index) { Use to get the value of the array element at the given index (between 0 and 511). } if (index < 128) return Array1[index] elseIf (index < 256) return Array2[index - 128] elseIf (index < 384) return Array3[index - 256] elseIf (index < 512) return Array4[index - 384] else Debug.Trace("Error: Array index " + index + " exceeds the maximum of 511.", 2) ; Error. endIf endFunction function SetArrayElement(int index, float value) { Use to set the value of the array element at the given index (between 0 and 511). } if (index < 128) Array1[index] = value elseIf (index < 256) Array2[index - 128] = value elseIf (index < 384) Array3[index - 256] = value elseIf (index < 512) Array4[index - 384] = value else Debug.Trace("Error: Array index " + index + " exceeds the maximum of 511.", 2) ; Error. endIf endFunction </syntaxhighlight> <br> [[Category:Scripting]] [[Category:Papyrus]] [[Category:Papyrus Language Reference]]
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)