Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ali_cirox on Wed 14/10/2009 17:35:21

Title: [Solved]Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 17:35:21
I want to creat this situation:
You speak to Char. 1 after that to Char 2
and if you speak to Char. 1 at this time,after you already have spoken to Char. 2 there should run an other dialog as at the first time.
But I dont know how to do it!?

sorry wheater my english is bad
I try, but I´m German

Title: Re: Other Dialog avaliable after an other has been run?
Post by: NsMn on Wed 14/10/2009 17:38:35
Use a boolean and change it's value to true if the player talks to one of the characters, and before talking to them, check whether bool is set to true.
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 17:45:40
much thanks for the quick answer NsMn.

But I don´t know that much of AGS, yet.
And I don´t know how to create a Boolean.
Could you discribe it to me?
or do you know a toturial? that would be brilliant
Title: Re: Other Dialog avaliable after an other has been run?
Post by: NsMn on Wed 14/10/2009 17:56:36
Since you're german, I'd recommend one of the tutorials or the forum on Adventuretreff.de.
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 18:06:36
I´ve searched evry single toturial on Adventuretreff.de.
but nothing about boolean or bool
do you know an other site?
englisch would be no problem.
the Problem of toturials for AGS is that I dont find much on google.
I only found those on this site and on Adventuretreff.de.
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Matti on Wed 14/10/2009 18:21:19
A Boolean is just a certain kind of variable.


bool dialogchange;


creates a boolean called dialogchange.


dialogchange=true;
dialogchange=false;


will set it to true or false.

If you read through the AGS manual and do its tutorial, things like these should be perfectly clear.
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 18:29:21
Okay. I´ll watch the manual and this toturial once more
thank you Mr. Matti and NsMn
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Helme on Wed 14/10/2009 18:31:37
Damn... to slow. But my solution would have been more complicated ::)
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 18:48:03
Sry but i don´t find a solution in the toturials of ags and in the manual ,too.

And how do i use this codes
sry but i realy dont know

bool dialogchange;
dialogchange=true;
dialogchange=false;

could someone please post me an example?
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Crimson Wizard on Wed 14/10/2009 18:59:25
Sample:


bool SpokenWithChar2Already; // initially it will be = false

// this function runs when you speak to Char1
function Char1_TalkTo()
{
  // here we check boolean variable's value
  if (SpokenWithChar2Already)   // means: if = true
  {
      dDialogChar1_2.Start();
  }
  else   // means: if = false
  {
      dDialogChar1_1.Start();
  }
}

// this function runs when you speak to Char2
function Char2_TalkTo()
{
  dDialogChar2.Start();
  SpokenWithChar2Already = true; // when you speak with char2 boolean variable becomes 'true'
}


For reference, in case you do not know, boolean type of variable is a logical type that stores simply TRUE or FALSE (that can be also thought as YES or NO, ON and OFF or 0 and 1 etc, whatever you like).
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 19:14:57
Now, I think,  I got it ;D

I thank you realy much
Crimson Wizrad
an all others for shure , too


Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 20:09:13
i only have a problem with this part of code

SpokenWithChar2Already = true

what do I fill in for the "Char2" 
I already tried

cPlayer1
and dPlayer1
(is the script name is cPlayer1 and the dialog is dPlayer1)

but nothing worked

Title: Re: Other Dialog avaliable after an other has been run?
Post by: Crimson Wizard on Wed 14/10/2009 21:06:58
Quote from: Ali_cirox on Wed 14/10/2009 20:09:13
i only have a problem with this part of code

SpokenWithChar2Already = true

what do I fill in for the "Char2"  
I already tried

cPlayer1
and dPlayer1
(is the script name is cPlayer1 and the dialog is dPlayer1)

but nothing worked

There seem to be some kind of misunderstanding.
Variable name has no relation to character, dialog or any other names.
You could call it ABCDEF, MyVar, WhateverBooleanVariable etc, and so on.
I named it SpokenWithChar2Already. If you don't like this name, you can rename it as you like BUT you must make sure that it is named the same anywhere you use it.

For example, if you like it be called "SpokenWithPlayer1", then you should change it not only in that function, but also here:

bool SpokenWithChar2Already;

to

bool SpokenWithPlayer1;


and here:

   if (SpokenWithChar2Already)

to

   if (SpokenWithPlayer1)
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Ali_cirox on Wed 14/10/2009 21:50:51
Now all misunderstuds are removed
i finaly undestand how that works
the reason why in chrashed
was that I don´t knew that I have to create this bool in global scrip

Thanks for you troubles!

I dont know if I have to write this
im in this forum for a few hours
but myproblem is solved
and the treat can be closed
Title: Re: Other Dialog avaliable after an other has been run?
Post by: Khris on Wed 14/10/2009 21:55:34
Just "Modify" your first post and put "[Solved]" at the beginning of the subject.