Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: NickyNyce on Tue 05/07/2011 19:10:52

Title: DoOnceOnly problem ( SOLVED )
Post by: NickyNyce on Tue 05/07/2011 19:10:52
I'm malfunctioning today, sorry for having to post, I searched the forum and checked the manual, but still can't get this to work right.

Basically I'm checking whether a variable is true or false in after fade in, If it is false, I would like to run a few lines of code just (Once);

In the manual it shows....if (Game.DoOnceOnly(" Whatever "))
I'm having a problem figuring how out how to script this while checking a variable, I tried this every way but the right way.

function room_AfterFadeIn()
{
 PlayMusic(4);
 if(GoodWire==false)
 {
   cGuy.Walk(350, 288, eBlock, eWalkableAreas);
   cGuy.FaceLocation(350, 200, eBlock);
   cGuy.Say("...........");
   cGuy.Say(".......... ");
 }
}

I need some hand holding here....
Title: Re: DoOnceOnly problem
Post by: Khris on Tue 05/07/2011 19:38:30
function room_AfterFadeIn()
{
  PlayMusic(4);
  if(GoodWire==false && Game.DoOnceOnly("Whatever"))
  {
    cGuy.Walk(350, 288, eBlock, eWalkableAreas);
    cGuy.FaceLocation(350, 200, eBlock);
    cGuy.Say("...........");
    cGuy.Say(".......... ");
  }
}


As long as GoodWire is false, AGS shouldn't bother to check if the second part is true so this should work.
If it doesn't, put Game.DoOnceOnly in its own if().

function room_AfterFadeIn()
{
  PlayMusic(4);
  if (!GoodWire)
  {
    if (Game.DoOnceOnly("Whatever"))
    {
      cGuy.Walk(350, 288, eBlock, eWalkableAreas);
      cGuy.FaceLocation(350, 200, eBlock);
      cGuy.Say("...........");
      cGuy.Say(".......... ");
    }
  }
}
Title: Re: DoOnceOnly problem
Post by: NickyNyce on Tue 05/07/2011 19:50:16
You are a gentlemen and a scholar, the first works perfect. If it wasn't for you guys helping me, I wouldn't be locked in my house for 4 months peeking out my windows like Golem in the lord of the rings.

The more you help, the more pale I get.

Thanks Khris

Title: Re: DoOnceOnly problem ( SOLVED )
Post by: Knox on Wed 06/07/2011 03:55:24
lol! I know exactly what you mean...peeking out the closed blinds to see...see if "they" are watching...watching...with "their" eyes... :=