Not sure what an MWE would be for this question. Basically I have a script written in XeLaTeX, one that includes dialogue, stage directions, and a lot of additional information. What I would like is some way to produce just a dialogue output for each of the main characters (there are 4). I am open to any method, either within XeLaTeX or in post-processing after a PDF is produced.
I have tried doing this with the ifthenelse package, but the logic gets convoluted very quickly. I have searched for a way to just send selected text to separate files, but I haven't located anything that will do that.