@Alberth That sounds good, but may be quite a bit more complex once you want to localise to other languages, depending on how easily you want your localisation work to be. I would rather put all that into compiled code, though, because then you can directly invoke stuff as a result of choosing an option, and it allows you to have more control over dynamically generated dialogues or something. Although even then (or especially then :D), localisation will be a pain.
I would simply have a dialogue class, which has a command to generate a list of options (another class), and then there's a callback on each option that gets triggered when you have selected one (such as on_chosen
and on_not_chosen
or something, if you have different options which also trigger behaviours if you do not chose them). Not that you have to over-OOP it, but it's a good conceptualisation, I think. Each chosen option can then transform the dialogue into the next phase, either statically or dynamically. The dialogue itself should also contain some kind of context as to which things it's referring to (such as the player and a specific NPC, maybe also some other object of interested that the dialogue is about, etc.). Basically each option needs display() string
, on_chosen(Dialogue &)
, and optionally on_not_chosen(Dialogue &)
, which modify or destroy the dialogue or affect things referenced by the dialogue. A rejected option can also lead to the creation of another option in the next stage of the dialogue.
Anyway, just brainstorming, not sure what exactly you want to do, anyway. If your requirement is just clicking A until the dialog displayed all its text, obviously, you would not need something like this. But I'm assuming you want the player to make choices and that the dialogue actually affects things.