-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An alias including "." doesn't play well with game.multiplecommands
#1270
Comments
I'm not particularly happy with the solution I proposed there; as it only works with verb menus/buttons. Really it should work with typed commands as well. Second solution would be checking object aliases for dots (during UpdateObjectLinks, maybe?) and making a list to check and escape dots in the same way; but that still only works if the name is exactly right. My best idea for a solution (still not perfect) would be a later check. After generating a list of partial matches for an object name, you could check if multicommand mode is on, and there are commands remaining in the command queue, and the command string ends with the current string we're trying to match, and the alias contains the last word of the command string immediately followed by a dot. (could also have some additional checks; like the next command in the queue not matching any command regexes on its own; or the first word of the next command being in the possible alias). If so, stick the current and next command strings together with a dot, stick it on the beginning of the command queue, and fire HandleNextCommandQueueItem rather than proceding to the next name to resolve. |
Oh, I didn't even consider the links or the buttons. I only tested this one by typing the commands in a new test game -- with none of the stuff described in that other issue added to it. You pointed out the flaw with Do you think I can/should change this to work with that? Or would that be completely different code? EDIT: I should read these on my actual computer instead of my phone before responding. I apparently need new glasses, heheheh. I see what you're saying. This is the only function I have modified concerning this, and it seems to work during testing (but I do work at the Overlook Hotel 😄): <function name="HandleCommand" parameters="command, metadata"><![CDATA[
handled = false
if (game.menucallback <> null) {
if (HandleMenuTextResponse(command)) {
handled = true
}
else {
if (game.menuallowcancel) {
ClearMenu
}
else {
handled = true
}
}
}
if (not handled) {
StartTurnOutputSection
if (StartsWith (command, "*")) {
SuppressTurnscripts
msg ("")
msg (SafeXML (command))
msg ("Noted.")
// Added for Quest 5.8
FinishTurn
}
else {
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))
}
}
if (game.command_newline) {
msg ("")
}
game.pov.commandmetadata = metadata
if (game.multiplecommands) {
foreach (alias, metadata) {
command = Replace (command, alias, Replace (alias, ".", "@@@DOT@@@"))
}
commands = Split(command, ".")
if (ListCount(commands) = 1) {
game.pov.commandqueue = null
HandleSingleCommand (Trim(Replace(command, "@@@DOT@@@", ".")))
}
else {
game.pov.commandqueue = commands
HandleNextCommandQueueItem
}
}
else {
game.pov.commandqueue = null
HandleSingleCommand (Trim(command))
}
}
}
]]></function> |
If
game.multiplecommands
istrue
and there is a.
in an object's alias, there will be issues.I have a fix based on the code posted by angelwedge in this issue: #1256 (comment)
I'll submit the PR after a little more testing.
The text was updated successfully, but these errors were encountered: