Edit: For the bisquixe-shy, a new example is added in post 4.
I remember this issue came up in the past and I even found a workaround with the help of others, but I can’t find it right now, so I’m asking again.
Here’s an example of the problem:
"Test room" by Brian Rushton
lab is a room.
include basic screen effects by emily short.
include simple multimedia effects for v10 by mathbrush.
Release along with a "Bisquixe" interpreter.
To say link (t - a text):
hyperlink t as t;
extratext is always "heyo"
Instead of jumping:
let temp be "[link extratext]";
say "[temp]";
say line break;
let megatemp be "[temp]";
say "[megatemp]";
So, I’m putting a hyperlink on the text. I create a variable that has just the plain text that is going to be hyperlinked, and I called it ‘extratext’.
I then hyperlinked it by creating a new text called temp. Printing this prints the hyperlink just fine.
I then put temp into megatemp, which does nothing but quote temp. The hyperlink formatting disappears.
I remember this happened in the past, where some kind of special text formatting disappeared when you quote it too many times. It’s not exclusive to hyperlinks. Does anyone know or recall why this occurs?
This is the output, showing how the link breaks the second time:
"Test room" by Brian Rushton
lab is a room.
include basic screen effects by emily short.
include simple multimedia effects for v10 by mathbrush.
Release along with a "Bisquixe" interpreter.
Perm is some text that varies.
Megaperm is some text that varies.
Instead of jumping:
now perm is "[link extratext]";
say "[perm]";
say line break;
now megaperm is "[perm]";
say "[megaperm]";
[ let temp be "[link extratext]";
say "[temp]";
say line break;
let megatemp be "[temp]";
say "[megatemp]";]
extratext is always "heyo"
To say link (t - a text):
hyperlink t as t;
The original context is copying one table to another (as seen here) so I’ll see how well this solution translates to that case. I appreciate the help! If anyone can think of any other workarounds that might be useful in case this doesn’t carry over, but I’m happy to play with this for now!
Also, I remembered where this came up before! It happens with bold text too. So it’s not a Bisquixe thing, just an Inform thing. Check this out:
"Test room" by Brian Rushton
lab is a room.
include basic screen effects by emily short.
include simple multimedia effects for v10 by mathbrush.
Release along with a "Bisquixe" interpreter.
extratext is always "[bold type]heyo[roman type]"
Instead of jumping:
let temp be "[extratext]";
say "[temp]";
say line break;
let megatemp be "[temp]";
say "[megatemp]";
Can someone explain again why this happens? I got around it in Never Gives Up Her Dead by hard-coding stuff (like this for bolding a dynamically generated direction):
Summary
A direction has some text called boldedtext.
The boldedtext of north is "[boldnorth]".
The boldedtext of east is "[boldeast]".
The boldedtext of south is "[boldsouth]".
The boldedtext of west is "[boldwest]".
The boldedtext of northeast is "[boldnortheast]".
The boldedtext of southeast is "[boldsoutheast]".
The boldedtext of southwest is "[boldsouthwest]".
The boldedtext of southeast is "[boldsoutheast]".
The boldedtext of up is "[boldup]".
To say vortexit:
say "You can go ";
let ccplace be the room ccdir from the location;
let cplace be the room cdir from the location;
let uptrue be false;
let cctext be "";
let ctext be "";
let intext be "";
let uptext be "";
let craptext be "";
repeat with way running through directions:
if way is inside:
next;
if way is outside:
next;
if way is down:
next;
if way is ccdir:
next;
if way is cdir:
next;
let place be the room way from the location;
if place is ccplace:
let placename be "[place]";
if place is a room:
now cctext is the substituted form of "[way]";
otherwise if place is cplace:
let placename be "[place]";
if place is a room:
now ctext is the substituted form of "[way]";
otherwise if place is central-ship:
let placename be "[place]";
if place is a room:
now intext is the substituted form of "[way]";
otherwise if way is up:
now uptrue is true;
let placename be "[place]";
if place is a room:
now uptext is the substituted form of "[way]";
if uptext is not "":
say "[bold type][uptext][roman type] to the [london-room], ";
let ccname be "[ccplace]";
let cname be "[cplace]";
let inname be "[central-ship]";
say "[bold type][cctext][roman type] (or [bold type]counterclockwise[roman type]) to the [ccname in lower case], ";
say "[bold type][ctext][roman type] (or [bold type]clockwise[roman type]) to the [cname in lower case], ";
say "and [bold type][intext][roman type] (or [bold type]inside[roman type]) to the [inname in lower case]";
Remember how Inform used to have “text” and “indexed text”? It still kinda has that under the hood. Anything in quotes is normally “text”, meaning it’s a routine that prints all its contents, potentially with special formatting, checking the values of variables, and so on.
But if you ask for “the substituted form of” something, it turns it into an “indexed text”: an array of characters, no formatting, no variables, just letters and numbers on the metaphorical page. And crucially, Inform will sometimes do this conversion itself: specifically, if a text refers to a local (but not global) variable, and that local variable is about to disappear. It looks like it also does that if text references are nested too deep.
We could propose embedding something like Formatting Capture into Inform so that it was handled smoothly and seamlessly. But so few people have really needed it that maybe it should remain an extension.
Yeah, Formatting Capture is a useful tool, but if it were standard, people would instead be wondering “hey why does formatting work but [one of] and [my variable] not?”