ClearDiagnostics
Parameters
| None. |
Description
|
Removes every diagnostic record and resets the store's overflow state. ClearDiagnostics wipes the slate. After the call CountDiagnostics returns 0, repeat counts start again from scratch, and the store can once more report an overflow if it later fills past its 256-record capacity. Two moments call for it. First, after you have handled the records - you have shown the load errors, written the log - so old news does not sit in front of whatever happens next. Second, right before an operation you want a clean reading on: clear, load the level, and every record now in the store belongs to that load. Remember that repeat-count folding compares against existing records, so clearing also means a recurring problem will file a fresh record (with a fresh count) the next time it fires. That is usually what you want when watching whether a fix worked. Requires Extended mode. See also: CountDiagnostics, DiagnosticMessage, DiagnosticRepeats, DrawDiagnostics. |
Example
; ClearDiagnostics Example ; ------------------------ ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-6 light=CreateLight() RotateEntity light,45,45,0 ; A spawn pad - pressing Space tries to load a model that does not exist, ; which the engine records as a structured diagnostic instead of crashing pad=CreateCylinder() ScaleEntity pad,1.5,0.1,1.5 EntityColor pad,80,200,255 While Not KeyDown(1) ; Space generates a diagnostic, C wipes the whole store If KeyHit(57) Then spawns=spawns+1 enemy=LoadMesh("enemy_model_"+(spawns Mod 5)+".glb") EndIf If KeyHit(46) Then ClearDiagnostics TurnEntity pad,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld ; DrawDiagnostics shows the records that ClearDiagnostics will remove DrawDiagnostics 8,70,6 Text 0,0,"Space: fail a spawn C: ClearDiagnostics Arrows: camera Esc: exit" Text 0,20,"CountDiagnostics() = "+CountDiagnostics() Flip Wend End
Index