Difference between revisions of "User:Dt192/Sandbox"

From Mudlet
Jump to navigation Jump to search
(Created page with "{{TOC right}} = 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 th...")
 
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
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.
 
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.
  
 +
{{TOC right}}
 
==echo==
 
==echo==
 
This function appends text at the end of the current line.
 
This function appends text at the end of the current line.
  
 
;Syntax
 
;Syntax
:echo(outputTarget, text)
+
:<code>echo(outputTarget, text)</code>
  
 
;Parameters
 
;Parameters
Line 14: Line 15:
  
 
;Returns
 
;Returns
: ''Nil''
+
: ''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: [[Manual:Lua_Functions#moveCursor|moveCursor()]], [[Manual:Lua_Functions#insertText|insertText()]], [[Manual:Lua_Functions#cecho|cecho()]], [[Manual:Lua_Functions#decho|decho()]], [[Manual:Lua_Functions#hecho|hecho()]]
 
See also: [[Manual:Lua_Functions#moveCursor|moveCursor()]], [[Manual:Lua_Functions#insertText|insertText()]], [[Manual:Lua_Functions#cecho|cecho()]], [[Manual:Lua_Functions#decho|decho()]], [[Manual:Lua_Functions#hecho|hecho()]]
  
You can use \n in an echo 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 various other formatting options [http://doc.qt.io/qt-5/richtext-html-subset.html as listed here].
+
<hr style="background-color: unset; border-bottom:1px dotted #595959" />
 +
 
 +
'''Notes'''
 +
 
 +
You can use <code>\n</code> 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 [http://doc.qt.io/qt-5/richtext-html-subset.html as listed here].
 +
 
 +
'''Examples'''
 +
<syntaxhighlight lang="lua">
 +
-- a miniconsole example
 +
 
 +
-- first, determine the size of your screen
 +
local windowWidth, windowHeight = getMainWindowSize()
  
As of Mudlet 4.8+, a single line is capped to 10,000 characters (this is when ~200 at most will fit on one line on your screen).
+
-- 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)
  
'''Examples...'''
+
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")
 +
</syntaxhighlight>

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")