Keyboard shortcuts for dialog selection

Started by Snarky, Mon 05/09/2011 09:27:12

Previous topic - Next topic

Snarky

I've been looking through the manual and searching the forums (with Google since forum search is broken), but I haven't found any way to select dialog options using keyboard shortcuts. For example, press 1 to select option 1, press 2 for option 2 and so on (Edit: No, not that. See below).

The best idea I have had so far is to implement the custom dialog options rendering, write a bunch of extra logic to the on_key_press method to set a variable with which option was selected then simulate a mouse movement to trigger dialog_options_get_active, which would read that variable and set DialogOptionsRenderingInfo.ActiveOptionID accordingly, and then finally simulate a mouse click to activate that option. It sounds horribly kludgey and fragile, though, and I'm not sure it would even work.

Is there a better way?

Khris

This is already implemented; I just checked the 9verb template and I can select dialog options using the number keys just fine.

Snarky

Right, bad example. I don't actually want to use the number keys, but some other set of keys that I define (or a user-defined set). Numbers for dialog options appears to be hardcoded into AGS with no ability to customize it.

I'm planning to implement a custom dialog system to do Phoenix Wright-style cross-examination, where the options will represent back, forward, press and object (and would appear as four buttons in different places on the screen), and I wanted to bind them to e.g. left-arrow, right-arrow, p and o. I don't think the 9-verb template has any help with that.

If there's no way to make it work, I guess I'll have to ditch the built-in dialog system and write all the dialog transitions in AGS-script instead (possibly using the StateMachine module to keep track of conversation state).

abstauber

With a custom dialog GUI, you could at least influence the topic selection. But currently there's no way to "say" a topic by keyboard.

monkey0506

AFAIK there's no way to simulate a click on a dialog option (even using the custom rendering functions). I've discussed before how useful a Dialog.RunOption function would be to run the script for a specific dialog option. It presumably wouldn't actually be that difficult to link into the point at which AGS is already queuing this anyway (but I haven't looked into that part of the source).

hedgefield

Quote from: monkey_05_06 on Mon 05/09/2011 15:14:57
AFAIK there's no way to simulate a click on a dialog option.

Perhaps not if you use the built-in dialogue editor, but I recently built a completely custom dialogue system, and while I have not implemented keyboard shortcuts for the actual options yet, I don't think it would be all that difficult. I already have a functioning system where I can sift through the options with the arrow keys and pressing space activates the highlighted option. From there I imagine it wouldn't be a stretch to bind a specific button to a specific key, like your up-down-O-P idea.

Snarky

To clarify, the UI would look something like this (though formatted to a different screen, of course):



You can see the four buttons on the lower half of the screen. The DS sensibly also bound these functions to the physical buttons, which was generally a much more convenient way to control the game than using the touch screen.

Of course, if you script it all yourself it's possible. But the built-in dialog system is convenient in that it offers goto, which (although often maligned) is the most intuitive way to define transitions between different states. I'd prefer to use it if it were possible, which it seems it isn't. StateMachine module it is, then!

monkey0506

Hooray, it might actually prove useful after having sat on my hard drive unreleased for years! :D

SMF spam blocked by CleanTalk