|
|
Invalid array?
#114921
03/03/07 20:59
03/03/07 20:59
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Hi, I'm getting an error when running. it says invalid array in all my init functions Here are some of those init functions Code:
DEFINE ocPoor,1; DEFINE ocAverage,2; DEFINE ocGood,3; //DEFINE ocMaximum,3; //tornades?
//where I added the prefic "oc" for observation condition. But this is just a matter of personal taste. Furthermore you shoud define an array, where you can store the observation quality. The array should have one element for each map. E.g. if you have four maps something like:
var ObservationConditions[3]; //4
//Finally you can store random numbers in the array representing your areas the following way:
function getRandomObservationCondition() { return(int(random(ocGood) + 1)); }
DEFINE olBewcity,0; DEFINE olWestpoint,1; DEFINE olMesocity,2; DEFINE olStormchester,3;
function init_conditions() { ObservationConditions[olBewcity] = getRandomObservationCondition(); ObservationConditions[olWestpoint] = getRandomObservationCondition(); ObservationConditions[olMesocity] = getRandomObservationCondition(); ObservationConditions[olStormchester] = getRandomObservationCondition(); }
Code:
function init_capes() { //BewCity if (ObservationConditions[olBewcity] == ocPoor) { CAPE[olBewCity] = (random(200)); } if (ObservationConditions[olBewcity] == ocAverage) { CAPE[olBewCity] = (random(1000) + 200); } if (ObservationConditions[olBewcity] == ocGood) { CAPE[olBewCity] = (random(3000) + 1000); } //Westpoint if (ObservationConditions[olWestpoint] == ocPoor) { CAPE[olWestpoint] = (random(200)); } if (ObservationConditions[olWestpoint] == ocAverage) { CAPE[olWestpoint] = (random(1000) + 200); } if (ObservationConditions[olWestpoint] == ocGood) { CAPE[olWestpoint] = (random(3000) + 1000); } //Mesocity if (ObservationConditions[olMesocity] == ocPoor) { CAPE[olMesocity] = (random(200)); } if (ObservationConditions[olMesocity] == ocAverage) { CAPE[olMesocity] = (random(1000) + 200); } if (ObservationConditions[olMesocity] == ocGood) { CAPE[olMesocity] = (random(3000) + 1000); } //Stormchester if (ObservationConditions[olStormchester] == ocPoor) { CAPE[olStormchester] = (random(200)); } if (ObservationConditions[olStormchester] == ocAverage) { CAPE[olStormchester] = (random(1000) + 200); } if (ObservationConditions[olStormchester] == ocGood) { CAPE[olStormchester] = (random(3000) + 1000); } } As you can see, the code choose a random observation condition, poor, average, or good, in the 3 cities. If its good, the values of some variables will be high and vice versa. Any ideas? What means invalid array in ... ? The code was working before updating to 6.50... thanks!
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Invalid array?
[Re: demiGod]
#114925
03/03/07 21:47
03/03/07 21:47
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
it works, thanks! I posted about a way to show the var results on the screen, you helped me and it looks like this: Code:
panel showVars { digits 10,10,"CAPE: %.1f",arial_font,1,CAPE; digits 10,60,"LI: %.1f",arial_font,1,LI; digits 10,110,"SI: %.1f",arial_font,1,SI; digits 10,160,"RH: %.1f",arial_font,1,RH; digits 10,210,"AVORT: %.1f",arial_font,1,AVORT; //flags = visible; }
When I make the panel visible, it shows everything, but all the values are "0.0" whats wrong? txs again dude!
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Invalid array?
[Re: Scorpion]
#114927
03/05/07 04:59
03/05/07 04:59
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
can you explain more please? I'm kind of messed up with your question... sorry :S
Last edited by Marky Mark; 03/05/07 05:03.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Invalid array?
[Re: Marky Mark]
#114928
03/05/07 15:26
03/05/07 15:26
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
OK i understand. No, i'm not using local variables. all my vars are outside my functions..
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|