Blitz3D+ Command Reference

DiagnosticRepeats ( index )

Parameters

index - record to read, from 1 (oldest) through CountDiagnostics()

Description

Returns how many identical events were folded into one diagnostic record.

When the same thing goes wrong every frame - a texture that fails to reload each time you save it, a decal limit hit sixty times a second - the store does not fill up with copies. An event that exactly matches an existing record (same level, category, source and message) just increments that record's repeat count. DiagnosticRepeats reads the count: 1 means it happened once, 500 means the same event has fired 500 times.

That number is diagnostic gold in itself. A repeat count still climbing tells you the problem is live right now; a big but frozen count says it happened in a burst and stopped. DrawDiagnostics shows the same information as an "(xN)" suffix.

An index below 1 or above CountDiagnostics() stops the program with a runtime error.

Requires Extended mode.

See also: CountDiagnostics, DiagnosticMessage, ClearDiagnostics, DrawDiagnostics.

Example

; DiagnosticRepeats 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

; One failed asset load seeds the store; repeats of it will coalesce
enemy=LoadMesh("enemy_model.glb")

While Not KeyDown(1)

    ; Space repeats the SAME failing load - no new record is added
    If KeyHit(57) Then enemy=LoadMesh("enemy_model.glb")

    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,"Space: repeat the same failure   Arrows: camera   Esc: exit"
    Text 0,20,"CountDiagnostics() stays at "+CountDiagnostics()
    ; DiagnosticRepeats counts how many identical events merged into record 1
    Text 0,40,"DiagnosticRepeats(1) = "+DiagnosticRepeats(1)

    Flip

Wend

End

Index