polserver/testsuite/pol/testpkgs/item/control_echo.src
turleypol 830daf726e
Fix crash when event queue is full (#521)
* each SpeechEvent needs to contain a copy of the speechtokens

* added core changes

* prevent memoryleak

* add basic pol test

* Remove extraneous prints in test

* Address review comments
- Refactor token encoding into a method

---------

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
2023-05-12 20:45:40 +02:00

18 lines
465 B
Text

use os;
use uo;
const SYSEVENT_SPEECH := 0x00000001;
program main(item)
RegisterForSpeechEvents( item, 12 );
while (1)
var ev := os::wait_for_event(30);
case(ev.type)
SYSEVENT_SPEECH:
var tokens := ev.tokens;
tokens.sort();
// This needs to match what's tested in test_client's say_something_with_tokens
PrintTextAbove(item, $"source=[item] text=[{ev.text}] tokens=[{tokens}]");
endcase
endwhile
endprogram