Difference between revisions of "User:Dt192/Sandbox"
(→echo) |
(→echo) |
||
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
;Syntax | ;Syntax | ||
− | :echo(outputTarget, text) | + | :<code>echo(outputTarget, text)</code> |
;Parameters | ;Parameters | ||
Line 15: | Line 15: | ||
;Returns | ;Returns | ||
− | : '' | + | : ''nil'' |
;Breaking Changes | ;Breaking Changes |
Latest revision as of 05:28, 31 January 2024
Basic Essentials
Just playing around with the format, as think we should standardise a format throughout the wiki (we don't currently). Don't think I like this layout more than the normal one (or do I :/), but I do think all functions should show a params breakdown if they take any and a returns section to avoid ambiguity. I also think it would be good to show the expected <type> for every param in some way.
echo
This function appends text at the end of the current line.
- Syntax
echo(outputTarget, text)
- Parameters
-
- outputTarget<string> (optional)
- Accepts the name of a miniconsole or label to redirect output to.
- text<string>
- Text you'd like to see printed.
- Returns
- nil
- Breaking Changes
- Mudlet 4.8+ single line capped to 10,000 characters (still well above the ~200 that span an average screen).
See also: moveCursor(), insertText(), cecho(), decho(), hecho()
Notes
You can use \n
in the text string to insert a new line. If you're echoing this to a label, you can also use styling to color, center, increase/decrease size of text and apply various other formatting changes as listed here.
Examples
-- a miniconsole example
-- first, determine the size of your screen
local windowWidth, windowHeight = getMainWindowSize()
-- create the miniconsole
createMiniConsole("sys", windowWidth-650,0,650,300)
setBackgroundColor("sys",255,69,0,255)
setMiniConsoleFontSize("sys", 8)
-- wrap lines in window "sys" at 40 characters per line - somewhere halfway, as an example
setWindowWrap("sys", 40)
echo("sys","Hello world!\n")
cecho("sys", "<:OrangeRed>This is random spam with the same background\n")
cecho("sys", "<blue:OrangeRed>and this is with a blue foreground. ")
cecho("sys", "<bisque:BlueViolet>Lastly, this is with both a foreground and a background.\n")