Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Radiant on Mon 04/09/2017 05:38:13

Title: The inverse of run-script / dialog_request
Post by: Radiant on Mon 04/09/2017 05:38:13
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)
Title: Re: The inverse of run-script / dialog_request
Post by: Monsieur OUXX on Mon 04/09/2017 11:45:04
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)
Title: Re: The inverse of run-script / dialog_request
Post by: Crimson Wizard on Mon 04/09/2017 12:03:40
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).
Title: Re: The inverse of run-script / dialog_request
Post by: Radiant on Mon 04/09/2017 12:58:56
Hmm, I was hoping for something that doesn't require rewriting 50-odd existing dialogs :)
Title: Re: The inverse of run-script / dialog_request
Post by: Snarky on Mon 04/09/2017 14:41:37
There's also the NBD Custom Dialog module (http://www.adventuregamestudio.co.uk/forums/index.php?topic=48218.0), 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.