Dialog options on/off?

Started by Jock, Wed 12/08/2009 22:55:22

Previous topic - Next topic

Jock

Hello. I am trying to make a basic game with ags but am having problems with dialog options.
How do you turn options on and off?
The command of option-off x from the manual seems not to work in any way I can interprate it.

I want to make it so that if the player in one of the rooms sees something he can then ask a character in the other room about it but if he has not yet seen it then obviously he should not be able to have that option.

Can you on/off options in dialog or must I use loads of different alternative dialogs and then just have a big if statement in the character talk event thing.

monkey0506

"option-off x" only works in a dialog script. So, for example you could put:

Code: ags
@1
EGO: I'd like to purchase that hat.
MERCHANT: Great! That's $50.
EGO: What?!? $50?
MERCHANT: You want the hat?
EGO: ...
EGO: Here you are then.
  player.InventoryQuantity[iMoney.ID] -= 50;
  player.AddInventory(iHat);
  UpdateInventory();
option-off 1
return


In a regular script you can use the command Dialog.SetOptionState:

Code: ags
dMerchantWares.SetOptionState(1, eOptionOff);

Jock


Bobsy

I too am having troubles with this. I'm trying to have a dialog where the first time you have one conversation, then on subsequent times you get a different one, a shortened summary.

The way I thought I could work it is to have two options in the same dialog. They start off with the first one turned on and the second one turned off. On completion of option one, it switches round so @1 is now turned off and @2 is turned on. That way, the player never sees the dialog option choices, but I could keep the whole thing in the same dialog.

So, I reckoned it would work like so:
Code: ags

@1
Venture: Sebastian! There are armed men outside!
Colonel: What?
Venture: Guns, Sebastian! Rat-a-tat boom and all that!
Venture: blah blah blah etc.
option-off-forever 1
option-on 2
stop

@2 
Venture: Still too comfortable to move?
Colonel: What?
Venture: Never mind.
stop


But this DOESN'T WORK! I'm incredibly frustrated that no matter what I seem to do, the first dialog option simply won't ever disappear. Every time I initiate the dialog all I get is @1 every time.

I've even tried using
Code: ags
  dColonel02.SetOptionState(1, eOptionOffForever);
  dColonel02.SetOptionState(2,eOptionOn);


Both in the dialog and in regular scripts, and am still getting the same maddening result.

monkey0506

I just tested it and it works fine for me. I'm curious, what is the structure you have for your dialog?

What I mean is over on the left you should have the list of options for the player to say. There should be two checkboxes (Show and Say) for each. What configuration do you have there?

Khris

Same here, works exactly like it should.

Here's my setup:


Just FYI: You could also use a variable and .Say lines, as in, you only need to use the dialog functionality if you are going to offer choices to the player.

Bobsy

Aha, found out what was making it balls up so badly. I'd somehow missed out the Return at the start, and for whatever reason that was messing it all up. Thanks for the help guys. A relief to know my system wasn't totally nuts.

I know that strictly speaking I could use variables, but right now I'm still learning AGS, and I'm trying different ways of doing things to see which I prefer. Plus, there's already a global variable with that character, changing from a pre-event dialog to this post-event dialog. My feelings were that too many variables and combinations therein would strain my little brain somewhat.

Anyway, crisis over! I think this means my prototype game is more or less done.

SMF spam blocked by CleanTalk