P
Pelican
Guest
I'm getting some very strange things happening with an array right now, and was wondering if anyone would know what is going on.
I have an array (global variable) called targetChara, pertaining to target character information. The array has been set up as shown, in a function called checkTargetSpace(y,x):
However, for some reason when I reference this in a later piece of code:
The code shows me this error:
Which I don't understand, since there's definitely more than 31 array slots...
Additionally, when testing the array as follows:
The result comes out at [0,1],[0,2][0,3] rather than the usual way, then once it gets to [0,43] jumps to [30,0],[30,1],[30,2],[30,3],[30,4], then stops...
Any idea what might be causing it? I'm pretty stumped...
I have an array (global variable) called targetChara, pertaining to target character information. The array has been set up as shown, in a function called checkTargetSpace(y,x):
Code:
targetChara[0]=self.name;
targetChara[1]=self.level;
targetChara[2]=self.class;
targetChara[3]=self.xPos;
targetChara[4]=self.yPos;
...
Code:
targetChara[0]=self.name;
targetChara[1]=self.level;
targetChara[2]=self.class;
targetChara[3]=self.xPos;
targetChara[4]=self.yPos;
targetChara[5]="-";
targetChara[6]="-";
targetChara[7]=self.living;
targetChara[8]=self.mobile;
targetChara[9]=self.moved;
targetChara[10]=self.able;
targetChara[11]=self.acted;
targetChara[12]=self.currentHP;
targetChara[13]=self.maxHP;
targetChara[14]=self.currentSP;
targetChara[15]=self.maxSP;
targetChara[16]=self.atk;
targetChara[17]=self.def;
targetChara[18]=self.mag;
targetChara[19]=self.res;
targetChara[20]=self.spd;
targetChara[21]=self.eva;
targetChara[22]=self.lck;
targetChara[23]=self.walk;
targetChara[24]=self.jump;
targetChara[25]=self.weapon;
targetChara[26]=self.armour;
targetChara[27]=self.head;
targetChara[28]=self.access1;
targetChara[29]=self.access2;
targetChara[30,0]=self.items[0];
targetChara[30,1]=self.items[1];
targetChara[30,2]=self.items[2];
targetChara[30,3]=self.items[3];
targetChara[30,4]=self.items[4];
targetChara[31]=self.ability1;
targetChara[32]=self.ability2;
targetChara[33]=self.skills;
targetChara[34]=self.experience;
targetChara[35]=self.experienceNeeded;
targetChara[36]=self.description;
targetChara[37]=self.alignment;
targetChara[38]=self.ability1Level;
targetChara[39]=self.ability2Level;
targetChara[40]="";
targetChara[41]=self.hadTurn;
for(i=0;i<array_length_1d(self.status);i++){
selectedChara[42,i]=self.status[i];
}
targetChara[43]=self.facing;
Code:
if(targetChara[42,2]==1){
Do things...
}
Code:
Push :: Execution Error - Variable Index [42,3] out of range [31,-1] - -5.targetChara(100021,1344003)
Additionally, when testing the array as follows:
Code:
for(i=0;i<array_height_2d(targetChara);i++){
for(j=0;j<array_length_2d(targetChara,i);j++){
show_message("targetChara["+string(i)+","+string(j)+"]: "+string(targetChara[i,j]));
}
}
Any idea what might be causing it? I'm pretty stumped...