Strange Attribute?

Dcoder
02 Jan 2021, 09:08(Quest TA 5.8)
What does the "Display hyperlinks in commands" checkbox under the "Room Descriptions" tab of the game object do?
This checkbox corresponds to the Boolean attribute game.echohyperlinks
(default setting is true
).
I couldn't find an answer on the forums (or barely a mention). The reason I ask is that if I uncheck it (set to false
), some of the object aliases in my game (that use text processor directives) fail to display properly.
K.V.
02 Jan 2021, 14:48 <function name="HandleCommand" parameters="command, metadata">
This part:
shownlink = false
if (game.echocommand) {
if (metadata <> null and game.enablehyperlinks and game.echohyperlinks) {
foreach (key, metadata) {
if (EndsWith(command, key)) {
objectname = StringDictionaryItem(metadata, key)
object = GetObject(objectname)
if (object <> null) {
msg ("")
msg ("> " + Left(command, LengthOf(command) - LengthOf(key)) + "{object:" + object.name + "}" )
shownlink = true
}
}
}
}
if (not shownlink) {
msg ("")
OutputTextRaw ("> " + SafeXML(command))
}
}
https://github.com/textadventures/quest/blob/2e521f35b4e780ae440b0b43a34e20794e7c0adc/WorldModel/WorldModel/Core/CoreParser.aslx#L44
This line: OutputTextRaw ("> " + SafeXML(command))
It looks like it doesn't use the text processor when that is unchecked.
You could try changing it to msg("> " + SafeXML(command))
, but I did not test it.
mrangel
02 Jan 2021, 19:18KV I don't think that should be the problem. Without hyperlinks, it's just printing the command the player typed; and that shouldn't contain text processor directives anyway.
However, I do think that "{object:" + object.name + "}"
should be "{object:" + object.name + ":" + key + "}"
in that code; if the player types an object's alternate alias, it should echo what they typed.
K.V.
02 Jan 2021, 19:52Without hyperlinks, it's just printing the command the player typed; and that shouldn't contain text processor directives anyway.
Oh, I see. With hyperlinks, it's replacing key
(which is the object's name as entered by the player) with the link.
Which means your "however" seems to be spot on.
...except if the player entered the first few letters, wouldn't the link be just those first few letter?
Also, I think Dcoder had issues with the text processor stuff in an object's name (or alias), and Quest maybe got updated to handle that in 5.8? (If not, there's some modified code to handle it in his game, I think.)

Dcoder
03 Jan 2021, 03:47I was just curious to understand what that attribute did. I was surprised that unchecking that box could break so much of my game so easily!
If I leave it checked (game.echohyperlinks = true
), my aliases which contain text processor directives work fine. If unchecked, the directive's literal text will be printed out instead of the interpreted result of that directive. So I will leave it checked.
K.V.
03 Jan 2021, 22:39If unchecked, the directive's literal text will be printed out instead of the interpreted result of that directive. So I will leave it checked.
If you get bored, uncheck it.
Enter a command that returns the buggy text. Open the debugger, look at player.currentcommand
. See what the command is. (If it's something interesting, come back with a screenshot!)
mrangel
04 Jan 2021, 01:58Oh!
It's when you click on an object link. Then, the command sent to the server will include the object's alias. As far as Quest is concerned, the player typed in a bunch of text processor commands and it's just echoing back what you typed.
So I guess KV was right the first time :)

Dcoder
04 Jan 2021, 02:20Enter a command that returns the buggy text. Open the debugger, look at player.currentcommand. See what the command is.
For example, I have a "trees" object, the alias of which is a text processor directive {=game.SomeString}
. game.SomeString
contains an HTML image that displays instead of the regular text when you look at
the "trees" object.
So when the box is checked by default, the command look at trees
will be echoed, but with an image of trees instead of the alias "trees".
However, if you uncheck the box, look at trees
will echolook at {=game.SomeString}
, or sometimes look at <span><img src="blahblahblah"></span>
(i.e., the contents of game.SomeString).
This is also what the debugger shows under player.currentcommand
. So I am talking about the echoed command here, not the trees' "look" description.
Just FYI, this isn't a problem that I need to solve, more like a curiosity.