Why isn't this code working!?

You must understand the Game Editor concepts, before post here.

Why isn't this code working!?

Postby geo12 » Wed Sep 12, 2007 12:22 am

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!
geo12
 
Posts: 2
Joined: Mon Jul 02, 2007 9:35 pm
Score: 0 Give a positive score

Re: Why isn't this code working!?

Postby makslane » Wed Sep 12, 2007 12:32 am

Make sure the block_value array can hold at least 11 elements.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Why isn't this code working!?

Postby geo12 » Wed Sep 12, 2007 1:22 am

Thanks makslane. For some reason I though it only needed 10.
geo12
 
Posts: 2
Joined: Mon Jul 02, 2007 9:35 pm
Score: 0 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest