SOLVED: Stopping function

Started by Slasher, Wed 16/07/2014 19:56:16

Previous topic - Next topic

Slasher

Hi,

I am creating a game status report and have hit a snag.

I need to stop a function....

This is the function:

Code: ags

int walktimer;

function Walking() 
{
    if(player.Moving)
      {
          walktimer=0;
      }  
    else if (walktimer > GetGameSpeed ())
      {
          Stopped_Moving += 1;
          LNotMoving.Text = String.Format("%d", Stopped_Moving);
          walktimer = 0;
      }
    else walktimer++;
}



In Rep exec always:

Code: ags

  LDoors.Text = String.Format("%d", Doors);
  Larrows.Text = String.Format("%d", Arrows);
  LNotMoving.Text = String.Format("%d",Stopped_Moving);
  LSecrets.Text = String.Format("%d",Secret_Area);
  LRemain.Text = String.Format("%d",lapsed);
  LTime_Taken.Text = String.Format("%d",lapsed);
  LLostTime.Text = String.Format("%d",Stopped_Moving);
  LMeanTime.Text = String.Format("%d",lapsed-Stopped_Moving);
  Walking(); // This is the function I need to stop when viewing the status report... The gui is set to pause game.


Can you help..

cheers

EDIT Tut tut... added this:

Code: ags
if(gStatus.Visible==false)
  Walking();
  


All now ok (nod)




Khris

Are you asking for
Code: ags
  if (!gStatus.Visible) Walking();

?

Edit: Yeah. How long did you try and fix this yourself before opening a thread...? :P

Slasher

Hi Khris,

about 2 minutes as I had only just began implementing it... It suddenly dawned on me what I needed to do...


SMF spam blocked by CleanTalk