Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SSH on Mon 18/12/2006 14:49:21

Title: SUGGESTION: Dialog.OptionCount
Post by: SSH on Mon 18/12/2006 14:49:21
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:


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();


Title: Re: SUGGESTION: Dialog.OptionCount
Post by: Dave Gilbert on Mon 18/12/2006 19:12:10
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.")
Title: Re: SUGGESTION: Dialog.OptionCount
Post by: Pumaman on Mon 18/12/2006 20:49:43
Sounds reasonable to me.
Title: Re: SUGGESTION: Dialog.OptionCount
Post by: strazer on Mon 18/12/2006 21:11:30
Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=600
Title: Re: SUGGESTION: Dialog.OptionCount
Post by: monkey0506 on Thu 21/12/2006 07:10:59
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?