msg("You see an {object:apple}.")msg("Would you like to {cmd:KillTroll:kill the troll} or {cmd:Escape:run for the hills}?")jaynabonne wrote:If you want to click on "apple" and have it enter "apple" at the command line, then you'd need to adapt the parser to handle object input like that- that is, a bare object name on its own (and still decide what you want it to do).
jaynabonne wrote:but it might be a bit jarring at first to have to type *and* click on things to complete a single command. I'm curious to see how it would work.
In Quest 5.4, msg calls the OutputText function in CoreOutput.aslx so you can insert Log calls there etc. This would also be a good place to call some new Request perhaps, which could instruct the player UI to write to a transcript file.
<function name="ProcessTextCommand_Object" type="string" parameters="section, data">
<![CDATA[
objectname = Mid(section, 8)
text = ""
colon = Instr(objectname, ":")
if (colon > 0) {
text = Mid(objectname, colon + 1)
objectname = Left(objectname, colon - 1)
}
object = GetObject(objectname)
if (object = null) {
return ("{" + ProcessTextSection(section, data) + "}")
}
else {
if (LengthOf(text) = 0) {
text = SafeXML(GetDisplayAlias(object))
}
if (game.enablehyperlinks) {
if (not HasInt(game, "lastlinkid")) {
game.lastlinkid = 0
}
game.lastlinkid = game.lastlinkid + 1
linkid = "verblink" + game.lastlinkid
colour = ""
if (HasString(object, "linkcolour") and GetUIOption("UseGameColours") = "true") {
colour = object.linkcolour
}
else {
colour = GetLinkTextColour()
}
style = GetCurrentTextFormat(colour)
// * * * I changed the following * * *
return ("<a id=\"" + linkid + "\" style=\"" + style + "\" class=\"cmdlink elementmenu\" data-elementid=\"" + object.name + "\">" + text + "</a>")
}
else {
return (text)
}
}
]]>
</function>
"<a onclick=\"InsertInput((this.innerText || this.textContent))\" id=\"" + linkid + "\" style=\"" + style + "\" class=\"cmdlink elementmenu\" data-elementid=\"" + object.name + "\">" + text + "</a>"