Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Array Problem

Author
Message
Mind Storm 101
22
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Excaping the Gates of Heaven
Posted: 1st Feb 2003 03:06
Im working with arrays to make random statistics for 100 planets, for some reason the array planetdata(x,1) gets equal to planetdata(x,2), its like #1 didnt exist, its wierd, cause slot x,1 is randomized 1-4 and slot x,2 is 1-10 and when i call up x,1 it gives me numbers like thats more than 4. Did i explain that righ? Well heres my code:

DIM planetdata(100,6)

for x=100 to 200
make object sphere x,10
position object x,rnd(1000),0,rnd(1000)
texture object x,16+rnd(2) : yrotate object x,rnd(360)

`gov dem,mon,rep,dic
planetdata(x-100,1)= rnd(3)+1
`stats famine,drout,war,blockade,plauge
planetdata(x-100,2)= rnd(3)+1
`tech unoc,low,med,modern,high
planetdata(x-100,3)=rnd(20)+1
`pop #
planetdata(x-100,4)=rnd(10000000)
`robs none,low,med,lots
planetdata(x-100,5)=rnd(3)+1
`cops none,low,med,lots
planetdata(x-100,6)=rnd(3)+1

next x

Its proply turn out to be something very simple and stupid but im currently stumped.

Thanks in Advance
-MindStorm
Mind Storm 101
22
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Excaping the Gates of Heaven
Posted: 1st Feb 2003 03:09
Correction:

DIM planetdata(100,6)

for x=100 to 200
make object sphere x,10
position object x,rnd(1000),0,rnd(1000)
texture object x,16+rnd(2) : yrotate object x,rnd(360)

`gov dem,mon,rep,dic
planetdata(x-100,1)= rnd(3)+1
`stats famine,drout,war,blockade,plauge
planetdata(x-100,2)= rnd(9)+1
`tech unoc,low,med,modern,high
planetdata(x-100,3)=rnd(3)+1
`pop #
planetdata(x-100,4)=rnd(10000000)
`robs none,low,med,lots
planetdata(x-100,5)=rnd(3)+1
`cops none,low,med,lots
planetdata(x-100,6)=rnd(3)+1

next x

I was trying 2 fix it and i accedently posted the wrong code

Login to post a reply

Server time is: 2025-05-14 06:34:39
Your offset time is: 2025-05-14 06:34:39