So I’m fooling around with a game concept where a ton of the content is randomly generated at the start. This includes the name of the town in which it takes place, which I’ve written a super-basic routine to generate (basically, it picks some numbers out of a hat, and then prints chunks of predefined text that correspond to those numbers, resulting in wonderfully made-up-on-the-spot sounding names). So my question is, how do I change the title to reflect this?
What I’m going for is something along the lines of “MedievalQuest*: The Adventures of [X] of [Y]”, where X is the player’s name (which I’ll get around to figuring out how to do later, hopefully on my own) and Y is the name of the town.
I want to do this without replacing the Banner() routine, since that would be kind of messy and involve copy-pasting everything that’s not related to the title, and also wouldn’t affect other times when the game’s name is printed (such as the brief, superbrief, and verbose commands). Is this feasible, or am I in way over my head here?
You’ve named the four places where the story title is printed. So that’s how hard it would be to replace them. Messy, but simple.
You could also do this by setting the Story constant to a string containing string substitution variables: “The Adventures of @00 of @01”. See the last part of chapter 1.11 of the I6 manual. However, using variable text for those (like a player’s name) is going to be a big fat nuisance – I think you have to compress the string at runtime. Stick with the simple way.
In chapter 5.7 of the inform manual, you can see how to manipulate text randomly. There is even a “sticky” function so if a room description is x the first time its seen, the next time the player sees it it says the same thing, but the next time the game is plays it may be different. Here’s how it goes:
“The newspaper headline is: [one of]War Casualties[or]Terrorists[or]Banks[sticky random] [one of]Continue To Expand[or]Lose Out[sticky random].”
Ah, okay. So exactly which part of the library is it that holds the Banner() routine, so I know which parts to yank over to my version (namely, the headline, the release and serial numbers, and whatnot)?
Never mind, found it. So yeah, I’ve gotten this to work. Thanks, Zarf! (In fact, I should probably give you most of the programming credit, with all the help you’ve given, man.)
Now this leaves the matter of naming the player, which shouldn’t be too hard…right? I’m assuming that it should be somewhat like the white cubes deal in “Balances”, but someone please stop me if that assumption is wrong.