array_var arrarray_var innershort value; construct a 4x2 arraylet arr := ar_construct arraylet arr[0] := ar_list 1 2let arr[1] := ar_list 3 4let arr[2] := ar_list 5 6let arr[3] := ar_list 7 8print $arr[2][1] ; prints '6'; or more compactlylet arr := ar_list (ar_list 1 2), (ar_list 3 4), (ar_list 5 6), (ar_list 7 8); you can refer to arrays inside your main array, e.g.let inner := arr[1]print $inner[0] ; prints '3'; so this:let value := arr[1][0]; is exactly equivalent to this:let inner := arr[1]let value := inner[0]
let arr := ar_list (ar_list 1 2 3 4 5 6), (ar_list 7); arr[0] is a 6-element array. arr[1] is a one-element array
scn FnCreateMark; function parametersstring nameref cellfloat xfloat yfloat z; local variablesarray_var markbegin Function { name, cell, x, y, z } ; fill out the info for this mark let mark := ar_construct StringMap let mark->name = name let mark->cell = cell let mark->x = x let mark->y = y ; send the new mark back to the calling script SetFunctionValue markend
scn MarkManagerScriptarray_var marks...if (you didn't initialize the array yet) let marks := ar_construct Stringmapendif...if (you want to create a new mark and you've gotten the player to enter a name for it) let marks[markName] := Call FnCreateMark markName, player.getParentCell, player.getPos x, player.GetPos y, player.getPos zendif
; assume the player has entered the name of the mark he wants to return to, or you've gotten it from elsewherearray_var markstring_var markNamelet mark := marks[markName]print "Do you want to travel to position (" + $mark->x + ", " + $mark->y + ", " + $mark->z + ") in " + getName mark->cell + "?"
arr["key"]
short index...let index := 0While index < ar_Size myArray let val := myArray[index] ... let index += 1Loop