Author Topic: Strategy Game Help...  (Read 5861 times)

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Strategy Game Help...
« on: April 11, 2011, 10:58:23 PM »
This can be the help zone for me I guess... I need help with my strategy game..

Quote
Current Problem:
Code: [Select]
It crashes and I am tired of trying to find the problem, you guys seem to be good at that


Just download the file and search for errors, you can also just play if you want :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Strategy Game Help...
« Reply #1 on: April 12, 2011, 12:26:17 AM »
Had a quick look.

Line 16:

Code: [Select]
if Gameinit == true then
Did you initialise Gameinit?
It won't work if you try to compare Gameinit (which, if undeclared, will be equal to nil) with a boolean such as "true" or "false".

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Strategy Game Help...
« Reply #2 on: April 12, 2011, 12:34:52 AM »
Annikk, it works :) When you have a bool, I beliv it checks three things: true/false and nil... Cause it works... It's jsut that it crashes in the middle of the game, and that has nothing to do with like 16 :P

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Strategy Game Help...
« Reply #3 on: April 12, 2011, 12:40:19 AM »
In that case, I would comment out a large section of your code... then uncomment things like by line until you start getting the crash again.  That's the best way to pinpoint the source of the problem, if you really have no idea where to look.


I'd also recommend sleep.  If it's late at night and you've been working on the problem for hours, a good night's sleep can sometimes make all the difference.  When you come back to it in the morning, refreshed and thinking keenly again, the problem won't seem so enormous.

66.6666666666% recurring of all annikk.exe breakthroughs occured within the first hour of the day's coding session.  Trufax.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Strategy Game Help...
« Reply #4 on: April 12, 2011, 12:47:02 AM »
I live, if I am correct and you live where I guess, 1 hour infront of you... In Norway... So it's not nighty time just yet :P And  I Comment parts of the code the crash won't occour because the crash is from a looped effect I belive... And if you comment line 311 the crash won't occour... Arghh, this error annoys the crap out of me :/ I'm waiting for a file named errorreport.txt or something so I can see what is wrong when it crashes x.x

dragoonreas

  • Seedling
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
  • Eufloria: Yes
Re: Strategy Game Help...
« Reply #5 on: April 12, 2011, 05:02:23 AM »
It's well past "nighty time" for me, but I just thought I'd suggest trying to make your own errorreport.txt file using the I/O library (which you already know how to use from what I recall) to output your own errors when you catch them.

Some reading material that may (or may not?) help:
Programming in Lua sections 8.3 - Errors, 8.4 - Error Handling and Exceptions, and 8.5 - Error Messages and Tracebacks.
Lua 5.1 Reference Manual sections 2.7 - Error Handling, 5.1 - Basic Functions: assert & pcall and possibly even 5.9 - The Debug Library.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Strategy Game Help...
« Reply #6 on: April 12, 2011, 05:26:55 AM »
Well, I don't want to be more sidetracked anymore... I ended up making the textfunction because of the CC... And I have experimented with I/O, it hates me :)

So, I won't make my own error report, I'd rather wait till someone or A&R makes it...