Don't let this happen to you

Continuing on the theme of displaying text in an XML gauge, I just spent more time than I would like to admit trying to figure out why this script wasn't working for me:

%( (A:ATC ID) )%!s!

The problem, of course (which I only resolved by stepping into the depths of the stack-calculator code), was that I was missing the UNITS for this simvar.  Yes, "ATC ID", which is a string, requires UNITS.  UNITS!  Argh.  So I changed it to this:

%( (A:ATC ID, string) )%!s!

and I was on my merry way.

So learn from my stupid mistakes!  Don't do this!  Don't forget that all "A:" variables require units! See my post on "An alphabet worth of variables" for which types require units.  And I just added an assert (which we can hopefully upgrade to some kind of error message that end users can see) so that I at least won't suffer from my own stupidity in this arena again.

Comments

  • Anonymous
    November 17, 2005
    The comment has been removed
  • Anonymous
    November 17, 2005
    The comment has been removed
  • Anonymous
    November 21, 2005
    Hi,

    The only problem with allowing default units is that if a gauge builder assumed different units the gauge would "work", but not "work right". Somewhat subtle and harder to debug than it not showing up at all.

    And the default units would have to be clearly stated in the SDK. :)

    Take care,
  • Anonymous
    November 22, 2005
    I share your pain! Actually, I think making the requirement for units absolute would be a good move... As it stands now, the "sometimes you need 'em, sometimes you don't" is rather confusing and counterintuitive... ;)