Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (Martin_HH, steyr, alibaba), 509 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Invalid array? #114921
03/03/07 20:59
03/03/07 20:59
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline 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: Marky Mark] #114922
03/03/07 21:17
03/03/07 21:17
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Invalid array in... what? index?

Re: Invalid array? [Re: demiGod] #114923
03/03/07 21:31
03/03/07 21:31
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline OP
User

Joined: Jul 2002
Posts: 857
Québec
Sorry. Here's a screenshot of an error. (it repeats the same error with the others Init (CAPE, LI, SI, RH, AVORT) and with the 3 cities inside of those vars.




Yeah! IE sucks, use Mozilla...
Marc Rémillard.
Re: Invalid array? [Re: Marky Mark] #114924
03/03/07 21:39
03/03/07 21:39
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
An invalid array index usually occours when you are using a higher value elements than the array can carry or you are dealing with negative values.

Try to increase the array[3] to 4 or 5 and then test it.

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 Offline OP
User
Marky Mark  Offline 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: Marky Mark] #114926
03/04/07 11:16
03/04/07 11:16
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
maybe you use local-variables?
and try to change the lenght of the displayed number

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 Offline OP
User
Marky Mark  Offline 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 Offline OP
User
Marky Mark  Offline 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.
Re: Invalid array? [Re: Marky Mark] #114929
03/05/07 16:16
03/05/07 16:16
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline OP
User

Joined: Jul 2002
Posts: 857
Québec
Works now! thanks


Yeah! IE sucks, use Mozilla...
Marc Rémillard.
Re: Invalid array? [Re: Marky Mark] #114930
03/05/07 16:19
03/05/07 16:19
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Btw, which was the problem?

Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1