Print Text and Values to Console(scripting)

From The DarkMod Wiki
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 does the same as sys.print but conveniently appends a line break at the end.

Template:Editorial