Text colour effects for the glulx target

I have recently had to remove text colour effects from a game that no longer compiles to z-code because it’s too big.

[url]https://intfiction.org/t/if-archive-hugo-downloads/59/1]

Can anyone tell me how to re-implement for glulx?

I’ll leave better people than me to answer the question directly. I’d just like to point out that, if it’s not possible to use the colour effects (and I don’t know whether it is or it isn’t, but every time this comes up it seems extremely dicey anyway), then it should at least be possible to merely use different text styles, like italic or bold (bold is probably best).

If you aim for online play, you could just edit the css files.

I think the idea, though, is for it to remain an “I7 example” sort of thing. So it has to illustrate how this functionality can be achieved withing I7.

I found something called Glulx Text Styles.i7x
github.com/i7/extensions/blob/7 … Styles.i7x

The extension didn’t gave me any error, but I couldn’t figure out how to use it for color, either.

Quote from Shuffling Around source code, using the extensions Flexible Windows by Jon Ingold, and Glulx Text Effects. It might require some juggling to get compatible versions of both extensions. This code is for Inform 7 6G60 but may work with slight changes.

[code]chapter glulx stuff

Table of Common Color Values (continued)
glulx color value assigned number
g-pure-blue 255 [== $0000FF]
g-pure-green 40960 [== $00A000]
g-pure-red 16719904 [== $FF2020]

Table of User Styles (continued)
style name justification obliquity indentation first-line indentation boldness fixed width relative size glulx color
header-style – -- – -- bold-weight – 2 g-black
special-style-1 – -- – -- regular-weight proportional-font 0 g-pure-red
special-style-2 – -- – -- regular-weight proportional-font 0 g-pure-green
italic-style – -- – -- – -- 0 g-black
fixed-letter-spacing-style – -- – -- – -- 0 g-black
bold-style – -- – -- – -- 0 g-black
alert-style – -- – -- – -- 0 g-black
note-style – -- – -- – -- 0 g-black
input-style – -- – -- – -- 0 g-black
blockquote-style left-justified no-obliquity 0 0 regular-weight proportional-font 0 g-pure-blue
[normal-style – -- – -- – -- 0 g-black]

The back-colour of the main-window is g-white.

to say bluetext:
(- glk_set_style(style_BlockQuote); -)

to say hc-sp:
if hc-acc is true, say " ";

[the syntax here is, only screen-reader space for *c, neither for *cn, forced space for *cf]

to say bc:
say “[bluetext]B[r]”;

to say bcn:
say “[hc-sp][bluetext]B[r]”;

to say bcf:
say " [bluetext]B[r]";

to say gc:
say “[second custom style]G[r]”

to say gcn:
say “[hc-sp][second custom style]G[r]”

to say gcf:
say " [second custom style]G[r]"

to say rc:
say “[first custom style][hc-sp]R[r]”

to say rcn:
say “[hc-sp][first custom style]R[r]”

to say rcf:
say " [first custom style]R[r]"

to say ast:
say “[if hc-acc is true] [end if]”[/code]

Glulx Text Effects’ styles won’t apply to the status window unless you also use Flexible Windows.

Lots of dependencies for what should be an I7 example…

Inform 7’s built in Glulx/Glk UI support is very minimal, I’d guess so that it remains compatible with the Z-Machine. Maybe in a future version more of it will be able to be built in. (But we’ll have to figure out what we want, rather than the confusing mix of incompatible event extensions etc.)

Alternatively, as we continue to improve the Public Library, it may be much easier to install extensions, perhaps resolving and downloading them automatically. Then we could keep to the micro extensions I was proposing in another topic, as they will be easier to maintain I think.

The following seems to work. :smiley:

Include Flexible Windows by Jon Ingold.

Table of User Styles (continued)
window	style name	background color
all-grid-windows	special-style-1	"#FF0000"

To say red reverse:
	say special-style-1;
	
To say default letters:
	say roman type;

When figuring out what we want, I think it would be a good idea to seriously consider changing the Glulx and Glk specs to allow for the kinds of text changes that are possible for Z-machine.

I agree. Maybe we need to make a numbered list of all absent features so we can track what Z can do that Glulx can not - and which VM’s have implemented these features as things move forward.

There should not be anything the Z-machine can do that Glulx cannot. I’ll start a thread for discussing this. See viewtopic.php?f=38&t=20648

Be careful with multiple windows. Here is an expanded version of your example to play with:

"FlexibleWindowsUser1User2Styles0" by "Community"

The story genre is "Other". The release number is 1.  
The story headline is "Glulx technical demonstration".

Include version 15/161003 of Flexible Windows by Jon Ingold.
[DEPENDENCY: Simple Graphical Window automatically includes Flexible Windows by Jon Ingold]
[Include version 10/161003 of Simple Graphical Window by Emily Short.]

[ Trouble - Inform 7 build 6M62 on Ubuntu 16.04
Experiment with commenting out various window targets and how the story-hints comes out.]
Table of User Styles (continued)
window	style name	background color	color
all-windows	special-style-1	"#FF0000"	"#00FFFF"
all-windows	special-style-2	"#FFFF00"	"#000000"
all-grid-windows	special-style-1	"#FF0000"	"#00FFFF"
all-grid-windows	special-style-2	"#FFFF00"	"#000000"
all-buffer-windows	special-style-1	"#FF0000"	"#00FFFF"
all-buffer-windows	special-style-2	"#FFFF00"	"#000000"
story-hints	special-style-1	"#FF0000"	"#00FFFF"
story-hints	special-style-2	"#FFFF00"	"#000000"

To say red reverse:
	say special-style-1;

To say highlighted:
	say special-style-2;
	
To say default letters:
	say roman type;


[**** Window: story-hints ]
The story-hints window is a text buffer g-window spawned by the main window.
The position of the story-hints window is g-placebelow.
[ This is the way the status window is defined in the Flexible Windows extension. ]
The scale method of the story-hints window is g-fixed-size.
The measurement of the story-hints window is 1.
The rock number of the story-hints window is 355. [ "If we set numbers ending in 5 for our manual rocks, we will never conflict with the automated numbering."]

Toggling the story-hints window is an action out of world.
Understand "storyhints" as toggling the story-hints window.
Understand "story-hints" as toggling the story-hints window.
Understand "story hints" as toggling the story-hints window.

Carry out toggling the story-hints window:
	if the story-hints window is g-present:
		close the story-hints window;
	otherwise:
		open the story-hints window.

Rule for refreshing the story-hints window:
	[ToDo: set a counter and increment so we have some idea of how frequently this redraws.]
	say "Stuck in the story? [red reverse]Do not dial 911[default letters] in the [highlighted]USA![default letters] - Try west.".

The background color of the story-hints window is "#FFDEA0". [light brown/tan]


Place is a room. "Type 'storyhints' to toggle second window. West is another room with user1 and user2 style.".

Wild West is a room, west of Place. "You made it to the [red reverse]Wild Occidental[default letters], type [highlighted]'east'[default letters] to return to Place. [red reverse]Je ne puis pas jouer avec toi, dit le renard."

From what I understand, the Glk (Linux) version of Inform 7 6M62 IDE can behave different from the Windows one regarding the window background color. On this code I just posted, Ubuntu 16.04 x64 with 6M62 shows the tan background on the story-hints window only on two words. This also seems to show a bug for me: the words “- Try west.” do not appear on the screen, I can’t even copy/select them.