Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Aino on April 11, 2011, 10:58:23 PM

Title: Strategy Game Help...
Post by: Aino 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
Title: Re: Strategy Game Help...
Post by: annikk.exe 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".
Title: Re: Strategy Game Help...
Post by: Aino 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
Title: Re: Strategy Game Help...
Post by: annikk.exe 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.
Title: Re: Strategy Game Help...
Post by: Aino 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
Title: Re: Strategy Game Help...
Post by: dragoonreas 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 (http://www.lua.org/pil/index.html) sections 8.3 - Errors (http://www.lua.org/pil/8.3.html), 8.4 - Error Handling and Exceptions (http://www.lua.org/pil/8.4.html), and 8.5 - Error Messages and Tracebacks (http://www.lua.org/pil/8.5.html).
Lua 5.1 Reference Manual (http://www.lua.org/manual/5.1/) sections 2.7 - Error Handling (http://www.lua.org/manual/5.1/manual.html#2.7), 5.1 - Basic Functions: assert (http://www.lua.org/manual/5.1/manual.html#pdf-assert) & pcall (http://www.lua.org/manual/5.1/manual.html#pdf-pcall) and possibly even 5.9 - The Debug Library (http://www.lua.org/manual/5.1/manual.html#5.9).
Title: Re: Strategy Game Help...
Post by: Aino 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...