Need Help With Game
Need Help With Game
Need Help With Game
Need Help With Game
Need Help With Game
Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game
Need Help With Game Need Help With Game
Need Help With Game
Go Back  Xtreme Visual Basic Talk > > > Need Help With Game


Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2005, 10:34 PM
War5master War5master is offline
Newcomer
 
Join Date: Jun 2004
Posts: 21
Default Need Help With Game


Im making an Rpg Game and im making the maze at the moment but i have come across a problem

Everytime i run the game to see if the maze is working correctly it says that their is something out of range.

here is the files and if some1 can help me i would greatly appreciate it thanks again
Attached Files
File Type: zip New Folder.zip (4.8 KB, 4 views)
Reply With Quote
  #2  
Old 07-17-2005, 11:06 PM
zelg37Need Help With Game zelg37 is offline
Contributor

* Expert *
 
Join Date: Dec 2004
Location: Oregon, USA
Posts: 606
Default Debugging 101

Quote:
Originally Posted by War5master
Im making an Rpg Game and im making the maze at the moment but i have come across a problem
Everytime i run the game to see if the maze is working correctly it says that their is something out of range.
The actual error message is:
Quote:
Runtime Error 9
Subscript out of range
The subscript out of range is "CurYSqr%".
It ends up at -1
Since Room(x,y) goes from Room (0,0) to Room (10,10) this is an illegal value.

If you set your break point on this line:
Code:
Sub CreateMaze() Dim CheckExit%(4) CurXSquare% = 5 CurYSquare% = 9 NoOfSqrVisited = 0 Do Until NoOfSqrVisited = 100 [COLOR=Red]<<<<<<<< Breakpoint here[/COLOR] Room(CurXSqr%, CurYSqr%).Visited = True '<<<<< Error occurs here
Then press F5, starting a new game, and it will stop at this line.
Press F8 and walk thru the code.
You will see that this line:
Code:
CurYSqr% = CurYSqr% - 1
...further down in the Do loop of the Create Maze sub is setting the
CurYSqr% value to -1

Last edited by zelg37; 07-17-2005 at 11:15 PM.
Reply With Quote
  #3  
Old 07-17-2005, 11:37 PM
War5master War5master is offline
Newcomer
 
Join Date: Jun 2004
Posts: 21
Default

Quote:
Originally Posted by zelg37
The actual error message is:

The subscript out of range is "CurYSqr%".
It ends up at -1
Since Room(x,y) goes from Room (0,0) to Room (10,10) this is an illegal value.

If you set your break point on this line:
Code:
Sub CreateMaze() Dim CheckExit%(4) CurXSquare% = 5 CurYSquare% = 9 NoOfSqrVisited = 0 Do Until NoOfSqrVisited = 100 [COLOR=Red]<<<<<<<< Breakpoint here[/COLOR] Room(CurXSqr%, CurYSqr%).Visited = True '<<<<< Error occurs here
Then press F5, starting a new game, and it will stop at this line.
Press F8 and walk thru the code.
You will see that this line:
Code:
CurYSqr% = CurYSqr% - 1
...further down in the Do loop of the Create Maze sub is setting the
CurYSqr% value to -1

well i understood what you said so i changed some of the numbers and integers around and it doesn't say the debug error now...

now when i click new game it doesnt even start the game... it does nothing

here is the updated file

i fixed everything wit the numbers and all but i think now it has something to do with the new game procedure
Attached Files
File Type: zip New Folder.zip (4.9 KB, 4 views)

Last edited by War5master; 07-18-2005 at 12:02 AM.
Reply With Quote
  #4  
Old 07-18-2005, 12:27 AM
TeraBlight's Avatar
TeraBlightNeed Help With Game TeraBlight is offline
Captain Convoluted

* Expert *
 
Join Date: Jun 2005
Posts: 1,918
Default

__________________
"To learn without thinking is to labour in vain" - Confucius
Reply With Quote
  #5  
Old 07-18-2005, 12:54 AM
War5master War5master is offline
Newcomer
 
Join Date: Jun 2004
Posts: 21
Default

well after doing alot of debugging thanks to that debugging 102 i managed to find the problem and fix it... thx to both of ya for all the help
Reply With Quote
  #6  
Old 07-18-2005, 01:21 AM
TeraBlight's Avatar
TeraBlightNeed Help With Game TeraBlight is offline
Captain Convoluted

* Expert *
 
Join Date: Jun 2005
Posts: 1,918
Default

Well done!
I figured giving you the tools to work it out for yourself would be the best course here, because debugging techniques are something that you can't pick up early enough in learning how to program
__________________
"To learn without thinking is to labour in vain" - Confucius
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Need Help With Game
Need Help With Game
Need Help With Game Need Help With Game
Need Help With Game
Need Help With Game
Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game Need Help With Game
Need Help With Game
Need Help With Game
 
Need Help With Game
Need Help With Game
 
-->