$ErrorActionPreference = 'Continue'

$repo = Join-Path $env:USERPROFILE 'TibiaPilotNG'
$env:TIBIAPILOT_OUTPUT_IDX = '0'
$env:TIBIAPILOT_SCREEN_X = '0'
$env:TIBIAPILOT_SCREEN_Y = '0'

$output = & (Join-Path $repo '.venv\Scripts\python.exe') 'tools\Runtime-Diagnostic.py' 2>&1
$exitCode = $LASTEXITCODE
$output | Set-Content (Join-Path $repo '.runtime-diagnostic.log') -Encoding utf8
exit $exitCode
