$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot Set-Location $root $config = Get-Content 'config.json' -Raw | ConvertFrom-Json $uri = [string]$config.avatar.apiUrl $actions = @('idleLookLeft', 'idleLookRight', 'idlePosture', 'idleHands', 'greet') Write-Host 'Prueba de nodos de movimiento VNyan' -ForegroundColor Cyan Write-Host 'El HTTP OK no garantiza que haya una animacion asociada al nodo.' foreach ($name in $actions) { $action = [string]$config.avatar.actions.$name if (-not $action) { Write-Host ('Falta accion en config.json: ' + $name); continue } Write-Host ('Enviando: ' + $action) $body = @{ action=$action; payload=@{ user='PruebaLocal' } } | ConvertTo-Json -Depth 5 try { Invoke-RestMethod -Method Post -Uri $uri -Body $body -ContentType 'application/json' -TimeoutSec 3 | Out-Null Write-Host 'Solicitud enviada. Observa el avatar.' -ForegroundColor Green } catch { Write-Host ('Error de conexion: ' + $_.Exception.Message) -ForegroundColor Red } Start-Sleep -Seconds 4 }