Page 1 of 1
Double indented short_descs
Posted: Wed Jan 11, 2012 1:51 pm
by Bainespal
I've had a long standing problem with the standard Library short description for NPCs ("Whoever is here."). That message is being indented twice, standing out starkly against the single-indented long_desc of the room and short_descs of objects. This problem showed up in my other unfinished Hugo game, and right now it's the only thing I would ideally like to correct in World Builder before sending Release 2 to the IFDB/IF Archive. However, I'll still release the new version even if I can't fix this aesthetic bug.
Here is an example of the problem:
Code: Select all
Your workshop
Automatons scurry to and fro in the complex of interconnected machinery, which churns and whirls across the vast convex surface of the Sphere.
Hugor is here.
As you can see, "Automatons" at the beginning of the room description is indented two spaces, but "Hugor" is indented four spaces. The same problem happens with the other NPC in World Builder.
The short_desc properties of both NPCs contain a routine that returns a string if a condition is met, or else returns "false" to produce the standard Library message. That code seems to work well, except for this problem.
Re: Double indented short_descs
Posted: Wed Jan 11, 2012 2:09 pm
by Tdarcos
Bainespal wrote:
The short_desc properties of both NPCs contain a routine that returns a string if a condition is met, or else returns "false" to produce the standard Library message. That code seems to work well, except for this problem.
Is it a naked quoted string or is it preceded by "print "?
Try sticking a semicolon on the end of the message string being displayed first. If it gives you an error, put a print statement in front of it. When there are multiple strings, in some cases Hugo presumes a \n on the end of earlier ones, forcing a newline. Using a semicolon warns the compiler not to force a newline after the string. This is exactly how the
print statement in Basic works.
Posted: Wed Jan 11, 2012 2:28 pm
by Roody_Yogurt
The problem is that ShortDescribe, the routine that checks to see if an object has a short_desc property or should get a default one, has this bit of code:
The ampersand means that it checks if there is any code at all in the short_desc property- not just that it returns false- it'll do the Indent, I think.
Ok, I've been looking into this problem for several minutes now. I think the
easiest answer is to never return false and fake generic no-short_desc messages yourself, depending on the conditions at hand.
Just the same, I will think on this a bit more.
Posted: Wed Jan 11, 2012 2:37 pm
by Roody_Yogurt
Just kidding! There IS an easier way!
Define the constant AFTER_PERIOD before hugolib.h is included:
Then, in those cases where short_descs return false, also change the global variable override_indent to true.
(Took me a while to realize that AFTER_PERIOD is used literally nowhere else in the Hugo library)[/code]
Re: Double indented short_descs
Posted: Wed Jan 11, 2012 4:17 pm
by Bainespal
Tdarcos wrote:
Is it a naked quoted string or is it preceded by "print "?
Try sticking a semicolon on the end of the message string being displayed first. If it gives you an error, put a print statement in front of it. When there are multiple strings, in some cases Hugo presumes a \n on the end of earlier ones, forcing a newline. Using a semicolon warns the compiler not to force a newline after the string. This is exactly how the print statement in Basic works.
That's a very good thought, but not quite the issue at hand. Thanks for the observation. I too learned much the same through trial and error.
Roody, thanks again for the solution. I'm sorry to bother you so much. ;) I never would have known about the existence of AFTER_PERIOD.
Posted: Wed Jan 11, 2012 4:19 pm
by Roody_Yogurt
I feel obnoxious that I post to this base so much (and so excitedly reply to things), but other than that, I am happy to help!