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.
This is a small aesthetic problem, but I can't solve it on my own. I have two rooms in my game that need to display different names depending on certain conditions. In both cases, my code works as expected except that it puts a period after the room title in both the status line and the main window. I have no idea where the period is coming from, and it doesn't matter whether or not I use "print" or just have a double-quoted string.
Here's an example of the code (using different strings than in my game):
room hillside
{
name
{
if night_flag = true
return "A Shadowy Incline"
else
return "A Sunny Hillside"
}
}
Personally, I'm a little unclear on what are the rules about returning strings from object properties. The other day, I was unsuccessfully trying to return a printed string from a cant_go property or something, so I share your confusion.
My only guess is that since object.name isn't treated like a regular string, wackiness ensues.
Wow... I'm surprised that this little bug is such an obscure problem.
Roody_Yogurt wrote:The other day, I was unsuccessfully trying to return a printed string from a cant_go property or something, so I share your confusion.
That's also good to know. If I have to have a conditional can't-go message (which I'm contemplating at the moment), I won't bother putting the condition in a cant_go property; I'll trap it in "location DoGo" instead.
Thanks for doing all the digging. It's surely a good thing that this is being documented in HxE.