Print Text and Values to Console(scripting)

From The DarkMod Wiki
Revision as of 18:32, 23 December 2008 by Fidcal (talk | contribs) (New page: Print Text and Values to Console(scripting) ''written by Fidcal'' ==Print to Console== sys.print() sys.println() To send text or values or string or numeric variables to the console u...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Print Text and Values to Console(scripting)

written by Fidcal

Print to Console

sys.print()

sys.println()

To send text or values or string or numeric variables to the console use:

sys.print(data1+data2+data3...);

...where 'data' is separated by plus signs and can be:

  • A string of characters within double quote marks
  • A numeric value
  • A string or numeric variable
  • Any legal calculation or expression such as 3*4+2
  • Any combination of the above, separated by plus signs (but numeric values will be added so 3+5 will display as 8 not 35)

Use \n within double quotes to force a linefeed, eg, "Line1\nLine2"

Examples:

sys.print("\n\nYour script is running");
sys.print("\n"+x+" green bottles");
sys.print(99);
sys.print(3*4+x/2);

sys.println appears to do the same as sys.print - even numeric calculations.


Template:Editorial-scripting