Community

SCI Programming => SCI Syntax Help => Topic started by: NilG on April 22, 2019, 01:21:24 PM

Title: Printing Variable Contents
Post by: NilG on April 22, 2019, 01:21:24 PM
Hey all,

Probably a ridiculous beginner question, but I've taken a look a couple of times and just don't know how to print out the contents of a variable, just so I can check what a local or global is set to.  Not looking for anything magic, I just haven't been able to sort the syntax to a Print statement that allows it to print the contents rather than the variable name itself.

So yeah, I think pretty basic, but could be useful in some debugging while wrapping up, and just in better understanding some of the behind-the-scenes behavior.
Title: Re: Printing Variable Contents
Post by: troflip on April 22, 2019, 02:09:50 PM
FormatPrint uses the same formatting characters as C's printf. So you can do something like:

(FormatPrint "Ego x: %d" (ego x?))
Title: Re: Printing Variable Contents
Post by: NilG on April 27, 2019, 11:15:22 AM
Nice, thanks.  Didn't figure it would be super complicated, but I suck.