Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Does Amnesia support Arrays?
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#1
[Solved] Does Amnesia support Arrays?

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

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?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 01-10-2014, 12:55 PM by Romulator.)
01-10-2014, 11:56 AM
Find
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#2
RE: Does Amnesia support Arrays?

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 !

01-10-2014, 12:04 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Does Amnesia support Arrays?

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
01-10-2014, 12:07 PM
Find
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#4
RE: Does Amnesia support Arrays?

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 : <.

(This post was last modified: 01-10-2014, 12:27 PM by daortir.)
01-10-2014, 12:26 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#5
RE: Does Amnesia support Arrays?

I think I've got where you're going:
int randArray[10];
for(int i = 0; i < 10; i++) randArray[i] = RandInt(0,99);
To access:
int someVar = randArray[3];
01-10-2014, 12:39 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: Does Amnesia support Arrays?

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 01-10-2014, 12:55 PM by Romulator.)
01-10-2014, 12:41 PM
Find




Users browsing this thread: 2 Guest(s)