Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 An array of a record within a double array of a record
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Devv




PostPosted: Wed Dec 06, 2006 5:54 pm   Post subject: An array of a record within a double array of a record

I have a program, which is pretty simplistic, but involves a bunch of arrays and records all within one another. And now I've come across a bug which I can't explain. I've fought with it a couple of days, and now I'm wondering if anyone on here was willing to give me any suggestions or even speculate as to what it might be. I'll post the code in case anyone has a burning desire to sift through all the code and discover the source of the error.

The error is, while running into monsters, at most points the game runs as expected. But at other points, upon running into the monster I get a syntax error reading "Array subscript is out of range." It pertains to line 367.

For clarity's sake, the game is a two player game in which you run around and kill stuff. Upon starting, you have to move the windows so you can see both screens and then select the "Player 1" window. Arrow keys move player 1, WASD moves player 2, and going back to town heals you. Death just teleports you back to town and subtracts experience.

Thanks in advance Smile



maplescape.zip
 Description:
.t file, .txt data file, graphics for Maplescape

Download
 Filename:  maplescape.zip
 Filesize:  302.59 KB
 Downloaded:  44 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
berrberr




PostPosted: Wed Dec 06, 2006 6:49 pm   Post subject: (No subject)

That error means that you are trying to access an element in the array that doesn't exist. Check what element of your array you are trying to call, and assign it a value.
Devv




PostPosted: Wed Dec 06, 2006 7:26 pm   Post subject: (No subject)

Yeah, I know what the error means. Sorry for not being more clear.

I know how to use records. I know how to use arrays. I know every concept that I used in this program. I have gone over this several times, and checked my logic. I know the error must have something to do with my code, specifically the monLocation variable, but I haven't been able to find the source. That's why I'm here.
ZeroPaladn




PostPosted: Thu Dec 07, 2006 1:17 pm   Post subject: (No subject)

could you post the chunk of code, so that we can see it, instead of dling your .zip file? (which is useless at shcool) I could help you out then.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: