Dialog options and returning

Started by Bobsy, Sun 20/06/2010 16:04:35

Previous topic - Next topic

Bobsy

So I have a dialog. It has five different options currently. Options 1-4 all end by turning themselves off (option-off X) and returning to the remaining options. Option 5 should be invisible throughout, and only becomes available / activates automatically when ALL the other options have been exhausted. Is there an elegant way to do this without messing around with global variables?

For clarity's sake, here's the entirety of the dialog:

Code: ags
// Dialog script file
@S  // Dialog startup entry point

Ego: But it all looks so vital for puzzle solving!
Ego: Surely you can't need it ALL..?
Thigh: Try me.
  player.FaceLocation(231, 0);
return

@1
Thigh: Need it for chopping.
Ego: The set of small throwable knives?
Thigh: Also for chopping.
Ego: The ladle?
Thigh: Chopping!
option-off 1
return

@2
Thigh: You want to deprive the Colonel of his tea? Go ahead.
option-off 2
return

@3
Thigh: The Prongenator? Absolutely vital pronging device. Mine.
option-off 3
return

@4
  player.FaceCharacter(cThigh);
Thigh: Can't tenderise a beef without it.
  player.FaceLocation(231, 0);
option-off 4
return

@5
  player.FaceLocation(231, 0);
Ego: I promise to be marginally careful!
Thigh: *sigh*
Thigh: You can BORROW the whisk.
Ego: But it's broken.
Thigh: Oh, so you DON'T want it?
Ego: No no, I'll take it! I'll cherish this broken whisk. Forever!
Thigh: See that you do.
  object[6].Animate(3, 0, eOnce);
stop


Kweepa

This isn't very elegant but at least it keeps things contained to the dialog script:
Code: ags

option-off 1
  if (dDialog0.GetOptionState(2) == eOptionOff
    && dDialog0.GetOptionState(3) == eOptionOff
    && dDialog0.GetOptionState(4) == eOptionOff)
  {
    dDialog0.SetOptionState(5, eOptionOn);
  }

And similarly for the other options.
Still waiting for Purity of the Surf II

Bobsy

Yup, that works well. Thanks for your help!

I'll leave it open for now in case anyone else has a different way of doing the same, but otherwise, case closed.

SMF spam blocked by CleanTalk