Jump to content

Photo

How can I make sure ifs in a while loop get used error free and checke


  • Please log in to reply
4 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 October 2018 - 10:45 PM

Let's say if in a while(true) loop I have 10
if (whatever = whatever)
{
  if (whatever = whatever)
  {
    if (whatever = whatever)
    {
      whatever = whatever;
    }
  }
}
and 20
if (whatever = whatever)
{
  if (whatever = whatever)
  {
    whatever = whatever;
  }
}
and 40
if (whatever = whatever)
{
  whatever = whatever;
}
how can I make sure that all such if statements are error free checked completely properly and also error free completely working properly?

#2 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 05 October 2018 - 10:51 PM

Add in a line or two to make them do something obvious. Make it spawn an enemy, or move Link, or draw something, or whatever.
You cold also use Trace(), which writes a number to allegro.log. It won't tell you immediately, but you can check the log after it runs to see if it wrote the numbers you expect.
  • ShadowTiger likes this

#3 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 October 2018 - 11:39 PM

Thanks also what is an example of a Trace() if proper example please?

#4 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 06 October 2018 - 10:05 AM

// Writes "123.0000" to allegro.log if Link is touching the FFC, or "456.0000" if he's not
if(LinkCollision(this))
{
    Trace(123);
}
else
{
    Trace(456);
}

  • ShadowTiger likes this

#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 07 October 2018 - 11:12 PM

I tend to use TraceS(), to trace a string, but the result is the same.
If you enable the debug console, you can watch these traces live, while the quest runs.

Some users use DrawString() or something similar to put a visual effect on the screen.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users