I’m planning on reworking Bisquixe this summer to work with Parchment (which already incorporates a lot of Bisquixe features). This would help cut down Bisquixe’s technical debt.
Bisquixe doesn’t actually have that many features, so the more that Parchment or other extensions can do, the more that the actual elements of Bisquixe can get cut down. I’m going to list all of the features here with a description of how they’re implemented.
Bisquixe has two components: the Simple Multimedia Effects extension and the Bisquixe interpreter.
Simple Multimedia Effects
Hyperlinks
This is roughly 75% of the code, and essentially none of it is mine (I think I copied it from Angstmurf). Hyperlinks are already built in to glulx, they just have to be ‘turned on’. Turning them on makes an extra blank line appear when clicking on them, but you can turn that off by setting a variable called ‘echo off’. Doing that makes the player’s command not appear when typed in. Furthermore, you can’t switch that off and on during a single game.
So, almost all of the code in this section is completely replacing the Keyboard function specifically to echo the player’s command without the blank line.
I’ve reported this to Graham Nelson and other Inform maintainers but it’s really hard to describe if you haven’t tried making a hyperlink hybrid game, so I’m not sure I was able to describe the bug clearly enough for it to get fixed.
Future development and places for improvement
This is the only section that uses Glulx Entry Points, which has been a sticking point for a long time due to the multiple versions. I think @Zed has been working on his own hyperlink extension which, if it came to fruition, could either completely replace this section or be incorporated into Bisquixe.
Here’s the current implementation of how links are assigned during each turn (due to Angstsmurf):
The hyperlink list is a list of texts that vary..
To hyperlink (hyper-text - a text) as (hyper-command - a text):
let hyperlink index be a number;
if the hyper-command is listed in the hyperlink list:
repeat with count running from 1 to the number of entries in the hyperlink list:
if entry (count) of the hyperlink list is hyper-command:
let hyperlink index be count;
otherwise unless the hyper-command is "":
add hyper-command to hyperlink list;
let hyperlink index be the number of entries of hyperlink list;
say "[set link (hyperlink index)][hyper-text][terminate link]";
To say set link (N - a number):
(- if (glk_gestalt(gestalt_Hyperlinks, 0)) glk_set_hyperlink({N}); -)
To say terminate link:
(- if (glk_gestalt(gestalt_Hyperlinks, 0)) glk_set_hyperlink(0); -)
There have been some bugs found with this. Several them were unknown bugs hidden in Inform’s hyperlink code that wasn’t known because no one uses hyperlinks (for instance, the Windows Inform IDE had a bug, now fixed, that would mess up the 3rd hyperlink’s target every time). Another issue is with hyperlinks in tables.
Things that would be improvements:
-Moving hyperlink notation to base Inform
-Making a separate hyperlinks extension (or one to be included in Bisquixe, like Mitochondria)
-Adding new notation. The current notation I use is: hyperlink "bob" as "x bob". Zed had some ideas on this.
Adding audio and image files (game file-side)
Right now, without Bisquixe, to use audio and image files in Inform, you have to use external tools to edit the javascript to declare the files.
Bisquixe adds commands that give the interpreter instructions to add those images and files when gameplay starts. This can cause a slight flicker if an image is used on the first page.
The code is:
Inform 6:
[ glk_add_audio _vararg_count;
@glk 5381 _vararg_count 0;
return 0;
];
[ glk_add_image _vararg_count;
@glk 5382 _vararg_count 0;
return 0;
];
Inform 7:
To upload-audio (Temp - a text) with internal name (Temp1 - a sound name):
let tempid be the Glulx resource ID of Temp1;
let tempname be "[temp].mp3";
add-audio tempname with id tempid;
To add-audio (Temp - a text) with id (Temp1 - a number) :
(-
if(glk_gestalt(5376, 0)){
glk_add_audio(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}), {Temp1});
}
-)
To add-image (Temp - a text) with alttext (tempalt - a text) with id (Temp1 - a number) with width (Temp2 - a number) with height (Temp3 - a number) :
(-
if(glk_gestalt(5376, 0)){
glk_add_image({Temp1},Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}),Glulx_ChangeAnyToCString(TEXT_TY_Say, {TempAlt}), {Temp2},{Temp3});
}
-)
Future development and places for improvement
I haven’t really heard any complaints about this. It would be nice for the Inform IDE to automatically do this to the javascript during release.
CSS setting and google font importing (game file-side)
These sections take in inform commands and send them to the interpreter.
This is the inform 6 code:
[ glk_set_css_fast _vararg_count;
@glk 5377 _vararg_count 0;
return 0;
];
[ glk_set_css_slow _vararg_count;
@glk 5379 _vararg_count 0;
return 0;
];
[ glk_any_style _vararg_count;
@glk 5378 _vararg_count 0;
return 0;
];
[ glk_import_google_fonts
This is the Inform 7 code:
To css-set-fast (Temp - a text):
(-
if(glk_gestalt(5376, 0)){
glk_set_css_fast(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}));
}
-)
To css-set-slow (Temp - a text):
(-
if(glk_gestalt(5376, 0)){
glk_set_css_slow(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}));
}
-)
To import-google-fonts (Temp - a text):
(-
if(glk_gestalt(5376, 0)){
glk_import_google_fonts(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}));
}
-)
To upload-audio (Temp - a text) with internal name (Temp1 - a sound name):
let tempid be the Glulx resource ID of Temp1;
let tempname be "[temp].mp3";
add-audio tempname with id tempid;
To add-audio (Temp - a text) with id (Temp1 - a number) :
(-
if(glk_gestalt(5376, 0)){
glk_add_audio(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}), {Temp1});
}
-)
To add-image (Temp - a text) with alttext (tempalt - a text) with id (Temp1 - a number) with width (Temp2 - a number) with height (Temp3 - a number) :
(-
if(glk_gestalt(5376, 0)){
glk_add_image({Temp1},Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}),Glulx_ChangeAnyToCString(TEXT_TY_Say, {TempAlt}), {Temp2},{Temp3});
}
-)
Part 2 - Arbitrary styling
Section 1 - Class naming
To set-any-class (Temp - a text):
(-
if(glk_gestalt(5376, 0)){
glk_any_style(Glulx_ChangeAnyToCString(TEXT_TY_Say, {Temp}),style_counter);
style_counter++;
}
-)
Every turn (this is the style_counter reset rule):
reset-style;
To reset-style:
(- style_counter = 10; -)
Currently what happens on this end is that CSS-set-fast, cc-set-slow, and import-google-fonts take in a single text and send that to the interpreter. That’s entirely because I could figure out Inform 6 arrays, which would probably be more appropriate. I’ll discuss later how that might be improved.
The only even mildly complex piece of code above is the set-any-class. What that does is take in a string and send it to the interpreter, and it also sends a unique number to the interpreter that starts at 10 and goes up every time it’s called. This starts at 10 because there are 9 or so built-in glulx styles in Quixe, but I increased that cap to 100, and this uses that fact (more description given in the interpreter section).
Future development and places for improvement
Using Inform 6 arrays would give a lot more capabilities to Bisquixe. I could use help on figuring that out.
And that’s it! That’s the entirety of the Bisquixe extension: turning on hyperlinks, adding commands to tell the interpreter to add images and sound, and adding commands that pass text strings to the interpreter.
I’ll cover the interpreter in the next post.