SUGGESTION: Dialog.OptionCount

Started by SSH, Mon 18/12/2006 14:49:21

Previous topic - Next topic

SSH

AFAIK, there's no way currently to get the number of options that exist within a dialog. I'd like to do something like this:

Code: ags

function AnyChoice(Dialog *dt) {
  int i=0;
  int count=0;
  while (i<dt.OptionCount) {
    if (dt.GetOptionState(i) != eOptionOn) count++;
    i++
  }
  return count;
}

if (AnyChoice(dlgFred)<2) Display("No point talking to him any more");
else dlgFred.Start();


12

Dave Gilbert

#1
Hear hear.  This would would very useful in cases where you talk to an NPC whom you have exhausted all possible conversation topics with.  Even simpler would be to bring this down to one line of code.  Something like:

if (dFred.number_of_topics <= 1)
  Display ("You have nothing else to say to him.")

Pumaman



monkey0506

Though it would be reasonably easy to implement (if there were an OptionCount property to set the upper limit for each topic's options), would it make sense as well if there were a function such as Dialog.GetOptionCountWithState(DialogOptionState) to get the number of dialog options with the specified state set?

SMF spam blocked by CleanTalk