Frictional Games Forum (read-only)
[Solved] Does Amnesia support Arrays? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [Solved] Does Amnesia support Arrays? (/thread-24332.html)



[Solved] Does Amnesia support Arrays? - Romulator - 01-10-2014

I know in vb.net, I can declare a bunch of random numbers in memory by doing this:

Code:
dim randnumb(10) as integer
dim i as integer

generate()
Do Until i = 10
randnumb(i) = int(rnd() * 99 + 1)
i += 1
Loop

Can I do such a thing in Amnesia, or call randomly generated numbers otherwise?


RE: Does Amnesia support Arrays? - daortir - 01-10-2014

int i = RandFloat(1, 10);

will make i a number between 1 and 10 without decimals.


float f = RandFloat(0.5f,6.5f); will make f a number between .5 and 6.5, with decimals.

(Numbers are of course an example, from a random sound generating function in my mod : >)

Not sure if that's what you were wondering, but that's a way to generate random numbers !


RE: Does Amnesia support Arrays? - Romulator - 01-10-2014

Well it's more on how to store them in memory, if that is possible Smile

What that vb.net script would do is put the random numbers in memory and if I needed to call them, would do so like:

textbox.text = randnumb(6)

Which could be anything between 1 and 100. I'm wondering if I can like, store the numbers in memory and be able to call them later on if need be Smile


RE: Does Amnesia support Arrays? - daortir - 01-10-2014

I would do a SetLocalVarInt to the value of the randomly generated number, but that's a slow process : /. Don't know about your function, doe : <.


RE: Does Amnesia support Arrays? - ClayPigeon - 01-10-2014

I think I've got where you're going:
Code:
int randArray[10];
for(int i = 0; i < 10; i++) randArray[i] = RandInt(0,99);
To access:
Code:
int someVar = randArray[3];



RE: Does Amnesia support Arrays? - Romulator - 01-10-2014

I'll give it a test Smile Cheers!

Edit: Seems to work. Will need to do more testing, as good ol' RNG's can be sometimes misleading. Marking as solved for now though Smile +rep to both Big Grin