I’m working on a game with a fair bit of struck-through text. I know there are fancy ways of doing this (release it with a web-based interpreter like Quixe and do CSS stuff!) but that is way above my pay grade and obviously poses compatibility issues, so I’m taking the easy path which, per this thread, requires putting “[unicode 822]” in front of every character of the struck-through text (well, I guess it’s an easier path, not necessarily easy, and I know not all interpreters handle Unicode gracefully, though from quick testing Gargoyle and Lectrote seem fine).
Because I am not a complete dumbo, I realized that this programming language that’s very good at manipulating text could be used to manipulate text to solve this problem, and without too much difficulty I came up with this:
To strike through (A - a text):
Repeat with X running from 1 to number of characters in A:
Let Y be character number X in A;
Say "[unicode 822][Y]";
Say "[paragraph break]".
Lovely, works a treat, except for two small flies in the ointment (well, one small, one potentially medium-sized). An example illustrates the point. If I do something like this:
Instead of jumping:
Strike through “You float up in the air, clouds lapping at your feet. Below, the humble precincts of your home shrink, recede; then your town; then, the world.[paragraph break]The surly bonds of gravity catch at you, and you hiccup down, up, down up --[paragraph break]But no, they have no true claim on you. You rise, rise, rise, the stars your destination.”;
Say “No, none of that happens.”
This is the output that I get:
̶Y̶o̶u̶ ̶f̶l̶o̶a̶t̶ ̶u̶p̶ ̶i̶n̶ ̶t̶h̶e̶ ̶a̶i̶r̶,̶ ̶c̶l̶o̶u̶d̶s̶ ̶l̶a̶p̶p̶i̶n̶g̶ ̶a̶t̶ ̶y̶o̶u̶r̶ ̶f̶e̶e̶t̶.̶ ̶ ̶B̶e̶l̶o̶w̶,̶ ̶t̶h̶e̶ ̶h̶u̶m̶b̶l̶e̶ ̶p̶r̶e̶c̶i̶n̶c̶t̶s̶ ̶o̶f̶ ̶y̶o̶u̶r̶ ̶h̶o̶m̶e̶ ̶s̶h̶r̶i̶n̶k̶,̶ ̶r̶e̶c̶e̶d̶e̶;̶ ̶t̶h̶e̶n̶ ̶y̶o̶u̶r̶ ̶t̶o̶w̶n̶;̶ ̶t̶h̶e̶n̶,̶ ̶t̶h̶e̶ ̶w̶o̶r̶l̶d̶.̶
̶
̶T̶h̶e̶ ̶s̶u̶r̶l̶y̶ ̶b̶o̶n̶d̶s̶ ̶o̶f̶ ̶g̶r̶a̶v̶i̶t̶y̶ ̶c̶a̶t̶c̶h̶ ̶a̶t̶ ̶y̶o̶u̶,̶ ̶a̶n̶d̶ ̶y̶o̶u̶ ̶h̶i̶c̶c̶u̶p̶ ̶d̶o̶w̶n̶,̶ ̶u̶p̶,̶ ̶d̶o̶w̶n̶ ̶u̶p̶ ̶-̶-̶
̶
̶B̶u̶t̶ ̶n̶o̶,̶ ̶t̶h̶e̶y̶ ̶h̶a̶v̶e̶ ̶n̶o̶ ̶t̶r̶u̶e̶ ̶c̶l̶a̶i̶m̶ ̶o̶n̶ ̶y̶o̶u̶.̶ ̶ ̶Y̶o̶u̶ ̶r̶i̶s̶e̶,̶ ̶r̶i̶s̶e̶,̶ ̶r̶i̶s̶e̶,̶ ̶t̶h̶e̶ ̶s̶t̶a̶r̶s̶ ̶y̶o̶u̶r̶ ̶d̶e̶s̶t̶i̶n̶a̶t̶i̶o̶n̶.No, none of that happens.
Problem the first: the strike-through character is getting applied to the paragraph breaks, leading to those unsightly dashes in the empty lines. Ideally, I’d be able to include a conditional like "if Y is not “[paragraph break]”, say “[unicode 822][Y]; otherwise, say “[Y]”.” That compiles but doesn’t change the output, sadly, so either I’ve misdiagnosed the cause or misapplied the solution (or maybe I’ve messed things up in yet some third way!)
Obviously I could just make each paragraph of text its own invocation of the strike through phrase, but for obscure reasons of personal style I’d rather not do that, and besides now that I’ve run into the issue I’m curious how to resolve it the proper way.
Problem the second: even generating these relatively short couple of paragraphs leads to a noticeable lag in the IDE, a shorter one in Lectrote, and a still shorter but still noticeable hitch in Gargoyle. My laptop isn’t the fastest thing out there, but it’s not too bad, and given how prolix this post is you’ll perhaps be unsurprised to learn that the game involves much longer passages of struck-through text than this example – so I’m concerned about performance.
Is there anything to be done on this front? The answer could be “release it with a web-based interpreter like Quixe and do CSS stuff” but I’m really hoping it’s not. Alternately, I suppose I could write a separate I7 program that outputs the code which I can then paste into the main program, which would at least cut out the loops so might be a little faster – obviously that would make revisions much much harder, though. So would welcome any genius ideas here, though I suspect this might just be One Of Those Things.