DiagnosticSource$ ( index )
Parameters
| index - record to read, from 1 (oldest) through CountDiagnostics() |
Description
|
Returns what a diagnostic record is about - typically a file name, shader or subsystem. Where DiagnosticCategory says which part of the engine spoke up, DiagnosticSource says what it was talking about: the path of the mesh that failed to load, the file of the texture that reloaded, the shader parameter that was rejected, the image file a capture was writing. It is the detail that turns "a model failed to load" into "media/crate.b3d failed to load". Some records have no meaningful subject and return an empty string. An index below 1 or above CountDiagnostics() stops the program with a runtime error. Requires Extended mode. See also: CountDiagnostics, DiagnosticCategory, DiagnosticMessage, DiagnosticLevel. |
Example
; DiagnosticSource 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 pad=CreateCylinder() ScaleEntity pad,1.5,0.1,1.5 EntityColor pad,80,200,255 ; Two failed asset loads seed the diagnostic store with records to browse enemy=LoadMesh("enemy_model.glb") powerup=LoadMesh("powerup_model.glb") index=1 While Not KeyDown(1) ; Space adds another failure, [ and ] browse the records If KeyHit(57) Then crate=LoadMesh("crate_model.glb") If KeyHit(26) And index>1 Then index=index-1 If KeyHit(27) And index<CountDiagnostics() Then index=index+1 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 Text 0,0,"[ / ] : browse records Space: add failure Arrows: camera Esc: exit" Text 0,20,"Record "+index+" of "+CountDiagnostics() ; DiagnosticSource names the file, entity, shader or subsystem involved Text 0,40,"DiagnosticSource("+index+") = "+DiagnosticSource(index) Flip Wend End
Index