Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MugMan on Sun 29/11/2015 02:34:35

Title: Trouble with calling on global variables to start dialouge
Post by: MugMan on Sun 29/11/2015 02:34:35
Code (ags) Select

cEgo.Say ("Hello Trashcan");
cTrash.Say ("Greetings Senpai!");
cEgo.Say (" AHHHHHHHHHH!");
cTrash.Say ("What's wrong?");
cEgo.Say ("I never really expect trash cans to talk back.");
cTrash.Say ("A foolish mistake to make,");
TrashMet+=1;
if (TrashMet=1); {
dTrashConversation.Start();

Here's the error message i'm getting:
GlobalScript.asc(534): Error (line 534): Parse error in expr near 'TrashMet'
I'm really not sure what to do, or if i'm even doing this right, i'd really appreciate any reply.
Title: Re: Trouble with calling on global variables to start dialouge
Post by: Grok on Sun 29/11/2015 05:52:13
line 8

    if (TrashMet=1);

should be

    if (TrashMet==1)
Title: Re: Trouble with calling on global variables to start dialouge
Post by: Retro Wolf on Sun 29/11/2015 06:23:12
You don't close the bracket, also there's no point because TrashMet will always be 1 or over.
Title: Re: Trouble with calling on global variables to start dialouge
Post by: Monsieur OUXX on Tue 01/12/2015 10:04:59
Let's recap :

Quote from: MugMan on Sun 29/11/2015 02:34:35
int TrashMet=0; // <-- This should be a GLOBAL variable! Ask if you don't know how to do
... //your dialog stuff
TrashMet+=1;
if (TrashMet==1);  //removed the semicolon
{
    dTrashConversation.Start();
}

I suppose you want dTrashConversation to start only the first time?