\B.... but custom?

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Ice Cream Jonsey
Posts: 30193
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

\B.... but custom?

Post by Ice Cream Jonsey »

You know how \B .. \b denotes bold text in Hugo? And \I (text) \i does the same for italics? Can you make your own version of that?

Let's say you want \Y \y to note that the text in between should be yellow. Can you do that by making a change to the library?
the dark and gritty...Ice Cream Jonsey!

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I never found a way, when I was messing with colors before. A section starting at around line 240 in hemisc.c (the Hugo source code) shows where it handles format codes.

It would probably be possible to write your own front-end, but I don't know how slow it would be. Basically, you'd call a functon like MyPrint("whatever"), which converts "whatever" to an array and then processes it a character at a time. You could look for your own formatting codes there, and just "print" (with a semicolon after each character) anything that isn't your own code. It probably wouldn't even be a very difficult routine to write.

Guest

Post by Guest »

You could also write a little pair of routines like

StartMyText
"Blah Blah Blah..."
EndMyText

where StartMyText would 'text to <somearray>' and EndMyText would purge the <somearray> buffer, paying attention to your custom formatting, before setting 'text to 0', in order to save on filling up the dictionary with those phrases passed as arguments. If that makes any sense.

User avatar
Ice Cream Jonsey
Posts: 30193
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

Thanks, guys. Yeah, I ended up just with making a routine that lets me throw the text I want to be colored cyan as the routine's argument. Simple enough for what I'm trying to do, I think.

Robb
the dark and gritty...Ice Cream Jonsey!

Guest

Post by Guest »

Actually, for what it's worth, if you check out the FB source code, the dialogue coloring is handled sort of like I described.

User avatar
Ice Cream Jonsey
Posts: 30193
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

Oh! Well, then. Yes. I'm not married to breaking up lines of speech with the semicolon and a function call. I'm not married to that idea at all. I'm down at the bar on my fifth vodka gimlet just looking for an excuse.
the dark and gritty...Ice Cream Jonsey!

Post Reply