DiagnosticMessage$ ( index )
Parameters
| index - record to read, from 1 (oldest) through CountDiagnostics() |
Description
|
Returns the human-readable message of a diagnostic record. The message is the record's actual story, written to be shown as-is: what happened and, where the engine knows, what to do about it. Combined with the other getters you can build a full line for a log or an in-game console - level, category, source, then message - or just print the message on its own for a quick missing-assets screen. Messages are single-line (any line breaks in the original text are flattened to spaces). An index below 1 or above CountDiagnostics() stops the program with a runtime error. If you only need the records on screen during development rather than in your own variables, DrawDiagnostics prints the newest ones in one call. Requires Extended mode. See also: CountDiagnostics, DiagnosticLevel, DiagnosticRepeats, DrawDiagnostics. |
Example
; DiagnosticMessage 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() ; DiagnosticMessage is the actionable text of the record Text 0,40,"DiagnosticMessage("+index+"):" Text 0,60,DiagnosticMessage(index) Flip Wend End
Index