Frictional Games Forum (read-only)

Full Version: [Solved] Does Amnesia support Arrays?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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 !
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
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 : <.
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];
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