And voilà, Inform 6 implementation. No noticeable delay any more!
The escape detection rules are a number based rulebook.
Escape detection for 105: say italic type.
Escape detection for 114: say roman type.
To say captured text safely: (- PrintCaptureSafe(); -).
Include (-
[ PrintCaptureSafe len i;
len = captured_text-->0;
i = 1;
@push say__pc;
say__pc = PARA_NORULEBOOKBREAKS;
while(i <= len){
if(captured_text-->i == 167){
i++;
FollowRulebook((+ escape detection rules +), captured_text-->i);
}else{
glk_put_char_uni(captured_text-->i);
}
i++;
}
@pull say__pc;
];
-).
And to test it:
First before doing anything except looking:
start capturing text;
First every turn:
stop capturing text;
say captured text safely;
say captured text safely.
I think the extra paragraph breaks come because I invoked a rulebook, but I set PARA_NORULEBOOKBREAKS, so…dunno. I’ll tinker and see if I can fix that.