Page 1 of 1

Why isn't this code working!?

PostPosted: Wed Sep 12, 2007 12:22 am
by geo12
The script should add each of the values of the "block_value[]" array, one by one and see if it equals the "totaldie." If it does, it makes "roll_true" equal to 1.
Code: Select all
for (f = 1 ; f <= 10 ; f ++) {
    for (h = 1 ; h <= 10 ; h ++) {
        if (block_value[f] + block_value[h] == totaldie) roll_true = 1;
    }
}

When I try to run it, it tells me there is an error on line 3: "READ attempted beyond allowed access area." I'm not sure what that means. Could someone tell me what I'm doing wrong! Thanks!

Re: Why isn't this code working!?

PostPosted: Wed Sep 12, 2007 12:32 am
by makslane
Make sure the block_value array can hold at least 11 elements.

Re: Why isn't this code working!?

PostPosted: Wed Sep 12, 2007 1:22 am
by geo12
Thanks makslane. For some reason I though it only needed 10.