Problem with GlobalInt Displaying Messages

Started by MillsJROSS, Mon 30/06/2003 05:06:23

Previous topic - Next topic

MillsJROSS

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

Gilbert

hmmm can you post that part of code in question here?

MillsJROSS

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

Gilbert

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)

MillsJROSS

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

Gilbert

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.

MillsJROSS

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);}
}

Gilbert

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

SMF spam blocked by CleanTalk