Print Text and Values to Console(scripting): Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
(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...)
 
mNo edit summary
Line 33: Line 33:




{{editorial-scripting}}
{{editorial}} {{scripting}}

Revision as of 18:33, 23 December 2008

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