DoOnceOnly problem ( SOLVED )

Started by NickyNyce, Tue 05/07/2011 19:10:52

Previous topic - Next topic

NickyNyce

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....

Khris

Code: ags
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().

Code: ags
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(".......... ");
    }
  }
}

NickyNyce

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


Knox

lol! I know exactly what you mean...peeking out the closed blinds to see...see if "they" are watching...watching...with "their" eyes... :=
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk