Variables declared withing a function like that are only accesable from within the function. Ass the error message implies, such variables aren created on the stack area when the function is called and lost when the function returns. It sounds like wehat you really want are global variables. To do this you need to add a couple lines in the global script and script header files as follows:
Script Header
#define SIZE 3000
import int Health[SIZE]; // Check manual for exact syntax of the import statement
Global Script
int Health[SIZE]; // Placed outside the bounds of any function, usually at top of script
Room Script
function room_a() {
int i;
// Example initializes members of Health array to 100
i = 0;
while (i<SIZE) {
Health = 100;
i++;
}
}
KhrisMUC replied while I was typing
. so there is some redundancy.
Script Header
#define SIZE 3000
import int Health[SIZE]; // Check manual for exact syntax of the import statement
Global Script
int Health[SIZE]; // Placed outside the bounds of any function, usually at top of script
Room Script
function room_a() {
int i;
// Example initializes members of Health array to 100
i = 0;
while (i<SIZE) {
Health = 100;
i++;
}
}
KhrisMUC replied while I was typing
