What types of errors must be taken into account?
Community Forums/General Help/What types of errors must be taken into account?| 
 | ||
| I think after a while I managed to create a simple debug.txt that verifies that everything goes well, loading textures, meshes, sounds, however, that such errors more should I know when something happens to inespererado, show me something significant. At this point I found a command called GraphicsLost (), which is not documented and is this type of error. ; Debug.txt ====================================================== ===============>>DEPURADOR PAWN<<===================== ====================================================== | HORA : 13:50:54 | FECHA : 20 Oct 2014 | RAM : 1013| ====================================================== 13:50:54 : Cargando Libs\Lib.0.dll... OK! 13:50:54 : Cargando Libs\Lib.1.dll... OK! 13:50:54 : Cargando Libs\Lib.2.dll... Fail! 13:50:54 : Cargando Libs\Lib.3.dll... OK! 13:50:54 : Cargando Data\Data.0.cab... OK! 13:50:54 : Cargando Data\Data.1.cab... OK! 13:50:54 : Cargando Data\Data.2.cab... OK! 13:50:54 : Cargando Data\Data.3.cab... OK! 13:50:54 : Cargando Data\Data.4.cab... OK! 13:50:54 : Cargando [ Data.1.cab ]blitz_20b.png... Ok! 13:50:54 : Cargando [ Data.3.cab ]Devil.png... Ok! 13:50:54 : Cargando [ Data.0.cab ]Mosaico.png... Fail! | 
| 
 | ||
| Personally if the executable is on my computer i use debuglog()/print() to display infos on the screen, and if the executable is not on my computer i write debuglines to a debugfile. I display/write infos to know how the program behaves and to know about the values of some variables or of some pointers/references. Once a part of the program is stable i put the debuglog/print as comments so it is easier to read. About writing lines to a file, i have read on the forum that it is better to not keep a file open and to write in it, but rather to open it, to write in it, to close it, and i am curious to understand if it is true or not and why. I suppose that if you don't close the file, it stays in memory and is not saved on the hard disk ? | 
| 
 | ||
| That's right.  In blitz, if your program crashes before the file is closed then it won't be written to disk. | 
| 
 | ||
| Matty>>Thanks for the confirmation. :) | 
| 
 | ||
| What I do is open the file every time you load a file, and after charging it, closes and performs the deed, if blocked quedaria the last file, but do not actually have it constantly open. 
Function ZIPLoadAnimMesh( nameZip$, fileMalla$, padre% = 0 )
	
	
	
	Local malla%
	
	Select depurador%
			
			
		Case True 
			
			InitZIP%(nameZip$)
			
			malla% = LoadAnimMesh(fileCab%( fileMalla$ ), padre)
			DeleteCab%()
		Case False 
			
			malla% = LoadAnimMesh( RutaZip_OFF$( nameZip$ )+fileMalla$, padre)
			
	End Select 
	
	
	VerificandoCarga%(malla%,fileMalla$, nameZip$) ; Debug Here.
	
	Return malla%
	
	
	
	
End Function 
Function VerificandoCarga%(file%,fileName$, nameZip$)
	
	
	
	Local fileDebug% 
	Local mensaje$ = CurrentTime()
	
	If file% = 0 Then 
		
		
		DebugLog mensaje$ + " : Cargando "+"[ "+ nameZip$ + " ]" + fileName$+"...  Fail!"
		
	Else 
		
		DebugLog mensaje$ + " : Cargando "+"[ "+ nameZip$ + " ]" + fileName$+"...  Ok!"
		
		
	End If 
	
	
	
	fileDebug% = OpenFile("Debug.txt")
	
	
	While Not Eof(fileDebug%)
		
		ReadLine(fileDebug%)
		
	Wend 
	
	If file% = 0 
		WriteLine (fileDebug%, mensaje$ + " : Cargando "+"[ "+ nameZip$ + " ]" + fileName$+"...  Fail!")
	Else
		WriteLine (fileDebug%, mensaje$ + " : Cargando "+"[ "+ nameZip$ + " ]" + fileName$+"...  Ok!")
		
	End If 
		
	CloseFile (fileDebug%)
	
	
	If file% = 0 Then 
		
		RuntimeError ("Error : No se tiene acceso a al archivo  "+ fileName+ Chr(10) + "=================================")+Chr(10) + "[[ Nro Error: 0003 | Nombre Fichero :" + fileName$+" ]]"
	End If 
	
	
	
	
	
	
End Function 
 |