First, here's the code:
let summons := ar_Construct StringMaplet k := 4ForEach each <- (actor.GetActiveEffectCodes) let index := each["value"] if (MagicEffectUsesCreatureC index) let effectKey := each["key"] let arrayNPC[i][k] := actor.GetNthActiveEffectSummonRef effectKey let xRef1 := arrayNPC[i][0] set sKey to sv_Construct "%i" xRef1 let xRef2 := arrayNPC[i][k] set sValue to sv_Construct "%i" xRef2 scribe "Key: %z, Value: %z" sKey sValue 0 let summons[sKey] := sValue let k := k + 1 endifLoop
This is only a snippet of the code. This whole thing is inside another loop. I'm using Conscribe to list the values for sKey and sValue and they are what I want - they are being created properly. So when populating a StringMap, can't I simply add an element with "let summons[sKey] := sValue"? Or is it a problem with scope? In other words, the contents of the summons array don't persist outside of the ForEach loop?
Here is what the scribe command lists:
Key: FF012336, Value: 00000000
Key: FF012336, Value: FF012344
Key: FF012336, Value: FF012340
Key: FF012336, Value: FF012344
Key: FF012336, Value: FF012340
which is correct. So I want the StringMap to look like:
summons[FF012336] = FF012344
summons[FF012336] = FF012340
etc.
Thanks in advance...