Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: MillsJROSS on Mon 30/06/2003 05:06:23

Title: Problem with GlobalInt Displaying Messages
Post by: MillsJROSS on Mon 30/06/2003 05:06:23
I have a point in my game, where after something happens I want a dialog box to appear when I get to a certain screen. Now I set a Global Int, and with the other code, my code works fine. But once I put a displayMessage, code, it displays the message no matter what the GlobalInt is set for. (I've already set it so it starts at 0 from the beginning). What's wierd is that the the scripting works perfect until I put that code in. And I know I've put it in correctly. I even tried a couple of diffrent kinds of Display scripts...the same results as the DisplayMessage.

-MillsJROSS
Title: Re:Problem with GlobalInt Displaying Messages
Post by: Gilbert on Mon 30/06/2003 05:12:48
hmmm can you post that part of code in question here?
Title: Re:Problem with GlobalInt Displaying Messages
Post by: MillsJROSS on Mon 30/06/2003 05:28:40
oops...I intended to, sorry.

Here it is before said code...

{
if (GetGlobalInt(1)==20)
  {PlayMusic(3);}    
  {SetGlobalInt(1,10);}
}  

After...

{
if (GetGlobalInt(1)==20)
  {PlayMusic(3);}    
  {SetGlobalInt(1,10);}
  {DisplayMessage(16);}
}  

Hope that helps.

-MillsJROSS
Title: Re:Problem with GlobalInt Displaying Messages
Post by: Gilbert on Mon 30/06/2003 06:05:13
hehe isn't it obvious? ;)

{
if (GetGlobalInt(1)==20)
{PlayMusic(3);
SetGlobalInt(1,10);
DisplayMessage(16);}
}

Even the old version should be:
{
if (GetGlobalInt(1)==20)
{PlayMusic(3);
SetGlobalInt(1,10);}
}

(Unless that was what you intended to do)
Title: Re:Problem with GlobalInt Displaying Messages
Post by: MillsJROSS on Mon 30/06/2003 06:27:56
Thanks Gil...that did the trick. But no it wasn't so obvious...I actually had the DisplayMessage before the SetGlobalInt, and that didn't work either. I had tried making a whole seperate globalint for just the dialog, that didn't work either. But somehow this one did, and that's all I honestly care about. Thanks! You've allowed AQ to go that much further.

-MillsJROSS
Title: Re:Problem with GlobalInt Displaying Messages
Post by: Gilbert on Mon 30/06/2003 06:36:30
The problem was not the order of the codes, it's in the braces. As you enbraced PlayMusic(3); with the full open and closed braces, so ONLT that line will be actions of that 'if' statements, the following 2 lines will not belong to the 'if' statement.
Title: Re:Problem with GlobalInt Displaying Messages
Post by: MillsJROSS on Mon 30/06/2003 06:45:19
Yes, but that doesn't explain why when I made a whole diffrent set of codes for just the Displaymessage it didn't work.

Which would look similar to this

{
if (GetGlobalInt(1)==20)
{DisplayMessage(16);}
}
Title: Re:Problem with GlobalInt Displaying Messages
Post by: Gilbert on Mon 30/06/2003 07:23:47
Hmmm... Probably because that original standalone {SetGlobalInt(1,10);} did something to it, but I cant tell as I didn't see the whole script. Anyway, it's fine that the problem was solved. :D