I’m working with mulehollandaise on an Inform6 extension that vaguely mimics Emily Short’s Glulx Text Effects with more ideas thrown in. He has translated it from his native French and I’m tweaking it here and there. The limitations of not being able to exactly specify the text styles in Glulx (as opposed to Zcode) is acceptable to us, but color is eluding us. Looking at Emily’s code, it seems like I should be able to effect a text color change by using this function:
[ MySetColor S N;
S=S+8;
glk_stylehint_set(wintype_TextBuffer, S, stylehint_TextColor, N);
];
But it doesn’t work.
When I last messed with the color code of 6/12 for Glulx, the status of color control in Glulx was something of a mess. I came to understand that changing text color on the fly was impossible. Now that I’ve gone through Emily’s extension, it seems that this is now possible. What am I missing?
So… do I close and reopen the window to accomplish this? I don’t understand. Is the Glulx SetColour() code in 6/12 just plain wrong?
I fiddled around a little with the demo program in Glulx Text Effects and it seems that I can change text colors on the fly, or at least make it look like it.
I’d be really interested in understanding how colored text would work in Glulx, so that we can determine if there’s an equivalent to what the Z-Machine does, or if we should give up. From what I understand:
There are two custom user styles available on top of the default ones
You have to define them using style hints
If you open a window and give a style hint it’s not going to do anything until you open the window again / another window
For those reasons if you want to define custom user styles you should do it before the window is even opened
The Z-Machine has 8 different colors, Glulx can have way different shades but not more than 8 at the same time because there are 8 user styles in total? (or n, where n is the number of user styles, but my point is there are a limited number of styles, some defined by default, and the rest may already be defined by the user)
But: what does Glulx Text Effects do, and how does it do it? How does it change colors on the fly? Is one of those statements false?
I don’t really care/mind if the effects are not possible in Glulx; it would be nice, sure, but at this point it’s more about figuring out if it’s even possible Any help is appreciated!
There’s 11 standard colours if you count the three shades of grey introduced in the 1.1 standard, which also allows you to specify arbitrary colours.
There are 11 styles, 9 of which have built in definitions. If you’re careful about how you use them, you can reset the built in styles and use them as generic purpose styles like the two user styles. style_Note for example is only used in very rare circumstances by Inform, so you can probably turn it into a user style safely.
It allows you to specify the text styles using a table. It can’t change styles on the fly.
Danni… How much of this will require changes to the Library? Much of the colour-related code in the Library doesn’t work for Glulx, even though it seems to be written for Glulx. This wasn’t my coding, but stuff I inherited from the old Inform CVS repo. I’m pondering stripping out all color-related stuff and rely instead on add-ons to supply this functionality.
I’m not really familiar with the I6 library any more sorry. But stripping it out would be a reasonable strategy. It wouldn’t be hard to make something like GTE for I6, or even just copying its I6 functions.
I don’t think there’s any central place. But it’s not hard to search the source of a minimal I7 game (for VM_Style)… here’s what I found:
The input style is used, naturally, for input
The blockquote style is used for boxes
The header style is used for the game title in the banner
The subheader style is used for room names
The alert style is used for the *** YOU HAVE DIED *** type messages
The note style is used for score notifications
Each of them are only used once I think, except for emphasised and subheader, which I think are used for italics and bold.
So if you want to use some of these for other purposes it wouldn’t be hard: if you don’t use boxes, write a custom banner function, write a custom death message, don’t use scoring, then you could use the blockquote, header, alert and note styles freely for any other purpose.
Btw, does anyone know if the clr_on setting is turned on in I7? I don’t remember ever seeing it before, but the templates have quite a bit of code for it.
Thanks for that explanation. I really think it should be in I7’s documentation; it’s not necessarily obvious and it’s information I think the authors should have.
Not just the authors… I customised my styles a bit on the interpreter, and I just kept hoping I wasn’t breaking anything, because I didn’t really know what I was customising.