Okay! I’ve been able to now get arbitrary css changes into this.
Here’s an example. This version (same link as above) has 4 new commands:
elset picks the name of the element or class that you are trying to change
feset picks the css element you want to change
atset picks the attribute you want to put into that element.
So, for instance, to change the text to italics in just the main window, begin by inputting the following:
then XYZZY applies it:
If your text uses commas, it won’t work, as I strip out the commas on the Javascript end.
@kamineko I didn’t even think about keeping this type (or a certain kind of this type) of command in game would be helpful! I was planning on just including phrases authors can use ‘behind the scenes’. But yeah, being able to adjust things in-game would be nice!
I had fun using this set of commands:
elset .BufferWindow
feset font-size
atset 50px
xyzzy
It would be fun to make a game that lets you mess with things like this, and then once it looks how you like, prints out a CSS file you can just add to your game. That would help people who don’t want the full special interpreter/extension but do want just the CSS.
I’ve seen both people who gave feedback mention adding links in-line. Changing just one word or couple of words in a block of text is significantly harder than what I’m doing. I’ll check on it, and hope it works out well! If I can add any link at all, it will be easy to allow links that execute commands.
Full inform code for this release (2):
Code
"Audiovisual" by Mathbrush
Test is a room.
The release number is 2.
Release along with a "Mathbrush" interpreter.
Colorsetting is an action applying to a topic. Understand "cs [text]" as colorsetting.
Carry out colorsetting:
let temp be the topic understood;
colorset temp;
To colorset (T - a text):
(-
if(glk_gestalt(311, 0)){
glk($0170, Glulx_ChangeAnyToCString(TEXT_TY_Say, {T}));
}
-)
Tempelement is some text that varies.
Tempfeature is some text that varies.
Tempattr is some text that varies.
tempelement is ".WindowFrame".
Tempfeature is "background-color".
Tempattr is "yellow".
Cssmessiness is an action applying to nothing. Understand "xyzzy" as cssmessiness.
Carry out cssmessiness:
let Temp be "[tempelement],[tempfeature],[tempattr]";
css-set Temp;
elsetting is an action applying to a topic. Understand "elset [text]" as elsetting.
Carry out elsetting:
now tempelement is the topic understood;
say "The element searched for is now [the topic understood].";
fesetting is an action applying to a topic. Understand "feset [text]" as fesetting.
Carry out fesetting:
now tempfeature is the topic understood;
say "The feature changed is now [the topic understood].";
atsetting is an action applying to a topic. Understand "atset [text]" as atsetting.
Carry out atsetting:
now tempattr is the topic understood;
say "The attribute value is now [the topic understood].";
To css-set (Temp - a text):
(-
if(glk_gestalt(311, 0)){
glk($0171, Glulx_ChangeAnyToCString(TEXT_TY_Say, (+ Temp +)));
}
-)
(the ‘glk_gestalt’ checks if the interpreter supports this stuff. Then glk($0171… etc. sends things to my special function in Quixe, which splits up the values using comma separation, as I had difficulty getting it to accept multiple strings).