The inverse of run-script / dialog_request

Started by Radiant, Mon 04/09/2017 05:38:13

Previous topic - Next topic

Radiant

Ok, so it's possible to run a regular script from a dialog script, by using the 'run-script' command which invokes dialog_request().

Is it possible to do the reverse, i.e. from a regular script do something like "call dialog X as if option Y was clicked"? (instead of Dialog.Start which starts it from the beginning)

Monsieur OUXX

Not that I know of.
If your issue is only that you want one of the options clicked, then you could probably work around it by (temporarily) disabling all the other dialog options in the root node of the dialog. But there's the other problem: accessing a "sub-dialog" directly. Keep in mind that dialog trees are designed so that each "dialog" is actually a node of a potentially bigger dialog tree that you require as an entry point, accessible from the "outside" (i.e. from regular AGS script)
 

Crimson Wizard

#2
This may be done by splitting dialog into multiple dialogs. Each dialog also has a starting point that may be used to perform preliminary actions, and even stop current dialog afterwards instead of displaying any choice.

For example, you have dOnlyDialog with two options, and you want to be able to -
1) Give player a choice between these options, or
2) Be able to run any of those options from the script.

So, what you may do is to create 3 dialogs instead:
1) dRootDialog, which will have two options, by clicking on them one of the two dialogs begin.
2) dOption1 and dOption2 dialogs that has the immediate action under @S (and then either stop, show their own options, or run dRootDialog, whatever is required).

Radiant

Hmm, I was hoping for something that doesn't require rewriting 50-odd existing dialogs :)

Snarky

There's also the NBD Custom Dialog module, which allows you to start from a particular dialog option, but you'll have to rewrite all the dialog scripts as a big if-else function (which to me seems like it defeats the purpose of using dialogs at all).

This capability might be a reasonable AGS feature request. The only issue I can see is what to do if a script asks to launch a dialog from an option that has been disabled.

SMF spam blocked by CleanTalk