Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Wed 21/09/2011 08:52:58

Title: Problem with dialog options off
Post by: steptoe on Wed 21/09/2011 08:52:58
Hi..  Problem with dialog options off

The below works but with a slight problem.

With 2 options left it does not 'return' but goes straight to option 4.



// Dialog script file
@S  // Dialog startup entry point
Chris: We need to pull together.
Chris: What do you have in your pockets Dopey?
Richy: Let me see...
return

@1
Richy: A penknife
Chris: That could prove handy. Can I borrow it?
Richy: Sure
 cChris.AddInventory(iknife);
option-off 1
return

@2
Richy: A shopping reciept.
Chris: Paper. Mm, could be useful to start a fire!
Richy: A fire??
Chris: One never knows
 cChris.AddInventory(ipaper);
option-off 2
return

@3
 if (player.HasInventory(iskunk))
 {
Richy: I've got some skunk.
Chris: I have some skunk already.
option-off 3

 }
 else
Chris: Can I have some?
Richy: What for? I've only an ounce left!
Chris: I have an idea.
Richy: Ok but you owe me Del.
Chris: Cheers mate
Richy: Yeh
 cChris.AddInventory(iskunk);
option-off 3
return

@4
Chris: Thanks
Richy: Ok
stop




Title: Re: Problem with dialog options off
Post by: Dualnames on Wed 21/09/2011 10:06:59

@3
 if (player.HasInventory(iskunk))  
{
Richy: I've got some skunk.
Chris: I have some skunk already.
 }
 else
{
Chris: Can I have some?
Richy: What for? I've only an ounce left!
Chris: I have an idea.
Richy: Ok but you owe me Del.
Chris: Cheers mate
Richy: Yeh
 cChris.AddInventory(iskunk);
}
option-off 3
return


it's probably this.
Title: Re: Problem with dialog options off
Post by: steptoe on Wed 21/09/2011 10:18:16
Dualnames

I have included what you said but no avail, so far



// Dialog script file
@S  // Dialog startup entry point

Chris: We need to pull together.
Chris: What do you have in your pockets Dopey?
Richy: Let me see...
return

@1
Richy: A penknife
Chris: That could prove handy. Can I borrow it?
Richy: Sure
 cChris.AddInventory(iknife);
option-off 1

return
@2
Richy: A shopping reciept.
Chris: Paper. Mm, could be useful to start a fire!
Richy: A fire??
Chris: One never knows
 cChris.AddInventory(ipaper);
option-off 2
return

@3
 if (cChris.HasInventory(iskunk))
 {


Richy: Skunk. But I've only got a little left.
Chris: That's ok I have some.
option-off-forever 3

}
 else
{
Chris: Can I have some?
Richy: What for: I've only an ounce left!
Chris: I have an idea.
Richy: Ok but you owe me Del.
Chris: Cheers mate
Richy: Yeh
 cChris.AddInventory(iskunk,6);
}
option-off-forever 3
return


@4
Chris: Cheers.
Richy: Hope the things can help us!
stop



Thanks anyhow

Title: Re: Problem with dialog options off
Post by: Adrian on Wed 21/09/2011 16:29:23
In dialog system the problem is that you can't mix regular scripting comands and dialog syntax within curly braces. Try this instead:


@3
  if (player.HasInventory(iskunk)) 
  {
    cRichy.say("I've got some skunk.");
    cChris.say("I have some skunk already.");
  }
  else
  {
    cChris.say("Can I have some?");
    cRichy.say("What for? I've only an ounce left!");
    cChris,say("I have an idea.");
    cRichy,say("Ok but you owe me Del.");
    cChris.say("Cheers mate");
    cRichy.say("Yeh");
    cChris.AddInventory(iskunk);
  }
option-off 3
return

Title: Re: Problem with dialog options off
Post by: steptoe on Wed 21/09/2011 20:13:11
Hi Adrian

after correcting a few errors of your code it still does not work as it should..

I shall persevere.

Title: Re: Problem with dialog options off
Post by: Adrian on Thu 22/09/2011 15:11:12
Quote from: steptoe on Wed 21/09/2011 20:13:11
Hi Adrian

after correcting a few errors of your code it still does not work as it should..

I shall persevere.


Oh yeah, sorry for the mistakes about say instead of Say and the messy indenting ect.

The thing is when you have only two options left and you choose one of them, the last one will be triggered automatically every time. This is normal behaviour and I don't know if there's a way to change that.


Title: Re: Problem with dialog options off
Post by: steptoe on Thu 22/09/2011 16:57:08
Hi Adrian

I made a 'Dummy' option and it works now.

Something to remember.

cheers

Title: Re: Problem with dialog options off
Post by: Khris on Thu 22/09/2011 17:57:16
You can do this:
  game.show_single_dialog_option = 1;
Title: Re: Problem with dialog options off
Post by: steptoe on Thu 22/09/2011 20:52:27
That sounds handy LeKhris

cheers