Suggestion: GetDialogOptionText(int topic, int option)

Started by SSH, Fri 12/09/2003 11:24:58

Previous topic - Next topic

SSH

EDIT: See last post of mine...


I think that to allow sprite-based dialogs, all CJ would have to add to AGS would be:

int RunDialogOption(int topic, int option);

Which would run the Dialog Option as if it were clicked on and return the following:

0 : illegal option: it is disabled
1 : ran option and ended with "return"
2 : ran option and ended with "stop"

or some other encodsing as CJ sees fit.

Then  one could make

import function myRunDialog(int topic);

which could use GetDialogOption to see which options are enabled and use a GUI or whatever to show the sprites and then use the new RunDialogOption to run the talking bit. It would be compatible with existing dialog scripts. However, GUI inetractions calling the dialog and unchanged scripts using RUnDIalog instead of myRunDialog would sitll use the old system. It would be more work, but maybe CJ could add a global option "Use script for RunDialog" and then a global script function called run_dialog or whatever could be configured by the programmer...


EDIt: Oops, sorry, I've posted this before, although not in so much detail!

See: http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=6534;start=msg79663
12

Pumaman


SSH

#2
I just realised that there is a way to implement this with the existing AGS. It relies on the fact that if there is only one enabled dialog option, then that one only will be played automatically.

However, I haven't tested this! It may not work, depending on what happens if you try and access non-existent dialog options with the GetDialogOption and SetDialogOption functions... maybe CJ could provide a GetTotalOptions(int dialog) or a global variable/array...?



function RunDialogOption(int topic, int option)
{
  char saveopt[30];
  int i=0;
  // Keep record of current dialog option state
  while (i<30) {
    saveopt=GetDialogOption(topic, i);
    SetDialogOption(topic, i, 0);
    i++;
  }
  SetDialogOption(topic, option, 1);
  RunDialog(topic);
  // Now restore saved dialog options
  while (i>=0) {
    SetDialogOption(topic, i, saveopt);
    i--;
  }
}
12

Scorpiorus

Great idea SSH. Haven't tested as well but looks like it would work.

~Cheers

SSH

Obviously, you couldn't tell the difference between the dialog terminating with return or with stop and use of goto-dialog and goto-previous would be prohibited, but that could be worked around using run-script or set-globalint.

It would also be handy if dialog options could have Properties (if you were doing a sprite-based dialog system) so that you could use them to store the sprite number. Alternatively, if a function could return the option name...

So , CJ: GetDialogOptionProperty(int topic, int option, string property) or GetDialogOptionText(int topic, int option) please!
12

Pumaman


SMF spam blocked by CleanTalk