Difference between revisions of "Writeln"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{ #vardefine:name|writeln}}{{ #vardefine:return_type|void}}{{ FunctionPage| name={{#var:name}}| function_category=Relay Browser Functions| function1={{Function| name={{#var:na…')
 
imported>Icon315
(Code Sample)
Line 17: Line 17:
  
 
function_description=Prints the specified {{pspan|text}} to the source of the page to be displayed by a relay browser script, ending with a line break (in the source, not necessarily in how the text is displayed).|
 
function_description=Prints the specified {{pspan|text}} to the source of the page to be displayed by a relay browser script, ending with a line break (in the source, not necessarily in how the text is displayed).|
 +
code1={{CodeSample|
 +
title=Code Sample|
 +
description=If you have 5 or more hobo nickels, it will write "bowl of fishysoisse '''(5)'''" at the top of the page|
 +
code=<syntaxhighlight>
 +
int i_a(string name) {
 +
item i = to_item(name);
 +
int a = item_amount(i) + closet_amount(i) + storage_amount(i) + display_amount(i);
 +
return a;
 +
}
  
 +
 +
if ( (i_a("hobo nickel")) >= 5 )
 +
writeln("<div class='abc'><span class='title'><td><br><b></b><a>bowl of fishysoisse <b>(5)</b></td></a<center></span></div>");
 +
 +
</syntaxhighlight>}}|
 
needscode=yes|
 
needscode=yes|
  
 
see_also={{SeeAlso|write}}|
 
see_also={{SeeAlso|write}}|
 
}}
 
}}

Revision as of 23:39, 10 April 2010

needs(code_samples);

Function Syntax

void writeln(string text )

  • text is the text to print

Prints the specified text to the source of the page to be displayed by a relay browser script, ending with a line break (in the source, not necessarily in how the text is displayed).

Code Sample

If you have 5 or more hobo nickels, it will write "bowl of fishysoisse (5)" at the top of the page

int i_a(string name) {
	item i = to_item(name);
	int a = item_amount(i) + closet_amount(i) + storage_amount(i) + display_amount(i);
	return a;
}


if ( (i_a("hobo nickel")) >= 5 )
	writeln("<div class='abc'><span class='title'><td><br><b></b><a>bowl of fishysoisse <b>(5)</b></td></a<center></span></div>");

See Also

write()