I think I’ve done enough of .rpt parsing (while monitoring DayZ server we had) to last me a life time, so this time let’s go pro. Wanna see who joins server in real time? Watch kill feed as it happens? Get alerted when something starts going wrong? Introducing KK’s one and only Debug Console!
This debug console could be used for both debugging and monitoring. It will initialise at the first call to the extension and will attach itself to the ArmA process. It will exist until you close it. If you close console while it is attached to ArmA, ArmA will also close. To close console independently you need to sent “X” command to it:
In order to make monitoring more effective, you can make lines output in different colours. To do this you need to end the string with hash and 4 digits code. The line ending format is <#RGBT>
- R => Red, 1 (on) or o (off)
- G => Green, 1 (on) or o (off)
- B => Blue, 1 (on) or o (off)
- T => Timestamp, 1 (on) or o (off)
Mixing primary colours will give you more colours. Red + Green = Yellow, Red + Blue = Purple, Green + Blue = Cyan. Default output is Grey without timestamp, as if you were using #0000.
If it happens that you need to be alerted of an event, you can send “A” command to the extension and console will beep while nothing will be printed to it. To print empty line, send empty string.
Debug console return value is the output buffer size currently allocated for the use by extensions.
Since the return from the extension bears no significance, consider using spawn command to initiate callExtension. Why? Because it will create parallel process to the current thread and will return immediately, whereas if you call the extension directly from the current thread, the engine will wait for the extension to finish executing even if you instruct it to return the value straight away.
In terms of performance we are talking about 0.1 seconds delay on 10000 iterations if you spawn the call to extension and 2 seconds delay if you call it directly. Having said this, spawning 10000 parallel threads takes about 2 minutes for them to complete because each spawn has artificial delay on its start. But this is absolutely fine for our purpose. So to make it simpler we will use preprocessor to define a macro.
To test performance yourself you can use the following code (will not work if copy/pasted to ArmA 3 debug console due to the use of preprocessor).
- Download zip end extract debug_console.dll
- Drop it into your @YourAddOn folder or into ArmA root directory
- Or copy the whole @console folder to ArmA root directory and then add -mod=@console to start up string
Ah, almost forgot, this console will also hold 5000 lines before it starts erasing old ones.
And now V2.0 is available
And now V3.0 is available