PDA

View Full Version : [1121] Indexing arrays with other arrays



pkmnfrk
01-11-2010, 03:24 PM
Uhm...


int GlobalArray[10];

ffc script Test {
void run() {
eweapon ew = Screen->CreateEWeapon(EW_FIREBALL);
//the other properties are not important.
ew->Misc[1] = 1;

GlobalArray[ew->Misc[1]] = Rand(10);
Trace(ew->Misc[1]); //1.0000
Trace(GlobalArray[ew->Misc[1]]); //0.0000
int i = ew->Misc[1];
Trace(GlobalArray[i]); //1.0000
}
}

Basically, in a script I'm writing, I put the index of a global array into an eweapon's Misc array. Then, later, I reference that global array by directly indexing the global array with the Misc array (as I do in the above script). However, it doesn't work. Lifting it into a separate variable does work, however.

Note: I haven't tested this exact test case. However, if it doesn't work, I'll drop in the actual script which suffers from this bug.

Gleeok
02-07-2010, 08:44 AM
Can this wait till 2.6? (..It looks hard to fix)

Joe123
02-07-2010, 07:43 PM
I thought this issue had been addressed once before?

Gleeok
02-07-2010, 11:49 PM
Umm.. it cased some bugs...then I ended up causing another bug when I undid that fix, which pkmnfrk fixed, which makes me not want to go anywhere near that again since this isn't really too much of a problem and not worth the hassle. You're gonna have to fix this on your own this time, sorry. Be sure you test it first though!

jman2050
02-08-2010, 12:17 PM
I implemented arrays, so it's likely going to be me that fixes whatever problems come about from arrays.

Of course, other bugs will be addressed first since this isn't particularly serious, just inconvenient.

Gleeok
02-10-2010, 01:54 AM
I think Joe123 is hard at work in his secret underground zc testing and bugfixing center right now working on a cure for the array epidemic. Let's see what happens. :D

Joe123
02-10-2010, 03:36 AM
Lolwut?
I have no idea how to fix this, the most complicated thing I can do with the parser is to add new functions and variables.
When I was messing around with different storage implementations I managed to reverse the order that array memory's deallocated in, I was quite chuffed.
Anyway, I lost all the work I did on that so it's fairly irrelevant.

EDIT:
Ohhh I just read your email.
I'll have a look at doing what I was before and make sure it works this time. It's not in the slightest related to this though.

How do you expect me to help when all you did was email me viruses =(

Gleeok
02-10-2010, 03:51 AM
Lol.
Oooh... I think I completely misread your post about this being related (Which it's not apparently). Sorry! My bad.


And don't worry, I've got a plan B: Pester jman untill he fixes it. :p