Difference between revisions of "User:Missionz3r0"

From Mudlet
Jump to navigation Jump to search
(Use flexbox instead of float for API header)
(Use semantic headers instead of custom ones.)
Line 11: Line 11:
 
=== echo ===
 
=== echo ===
 
<div class="mw-collapsible mw-collapsed" role="complementary" style="border:1px solid; box-sizing: border-box; float:right; min-width: min(100%, 80ch); max-width: 80ch; overflow:auto; padding:1ch">
 
<div class="mw-collapsible mw-collapsed" role="complementary" style="border:1px solid; box-sizing: border-box; float:right; min-width: min(100%, 80ch); max-width: 80ch; overflow:auto; padding:1ch">
   <div>
+
   <h4> API </h4>
    <div aria-level="4" role="heading">'''API'''</div>
+
  <div style="border-top: 1px solid; display:flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; margin-top:1ch">
    <div style="border-top: 1px solid; display:flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; margin-top:1ch">
+
    <div>
      <div>
+
      <h5>Usage</h5>
        <div aria-level="5" role="heading" style="margin-top:1ch;">'''Usage'''</div>
+
      <p><code style="margin-left:1.6em;">ok, err = echo([console_or_label_name,] text)</code></p>
        <p><code style="margin-left:1.6em;">ok, err = echo([console_or_label_name,] text)</code></p>
+
    </div>
      </div>
 
  
      <div>
+
    <div>
        <div aria-level="5" role="heading" style="margin-top:1ch;">'''Origin'''</div>
+
      <h5> Origin </h5>
        <p><code>C++</code></p>
+
      <p><code>C++</code></p>
      </div>
 
 
     </div>
 
     </div>
 
   </div>
 
   </div>
Line 28: Line 26:
 
   <div class="mw-collapsible-content">
 
   <div class="mw-collapsible-content">
 
     <div>
 
     <div>
       <div aria-level="5" role="heading" style="margin-top:1ch;">'''Parameters'''</div>
+
       <h5> Parameters </h5>
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:30ch 9ch auto; ">
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:30ch 9ch auto; ">
 
           <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;"><code>console_or_label_name?</code></dt>
 
           <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;"><code>console_or_label_name?</code></dt>
Line 41: Line 39:
  
 
     <div>
 
     <div>
       <div aria-level="5" role="heading" style="margin-top:1ch;">'''Returns'''</div>
+
       <h5> Returns </h5>
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:30ch 9ch auto;">
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:30ch 9ch auto;">
 
         <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;"><code>ok?</code></dt>
 
         <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;"><code>ok?</code></dt>
Line 54: Line 52:
  
 
     <div>
 
     <div>
       <div aria-level="5" role="heading" style="margin-top:1ch;">'''History'''</div>
+
       <h5> History </h5>
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:9ch auto;">
 
       <dl style="box-sizing:border-box; display:grid; grid-gap:0px; grid-template-columns:9ch auto;">
 
           <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;">v4.8.0</dt>
 
           <dt style="border-right: 1px solid; margin:0 0 8px 0; font-weight:normal; padding:0 0.8ch 1px 1.6em;">v4.8.0</dt>
Line 69: Line 67:
 
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()]]
  
<div aria-level="4" role="heading" style="margin-top:1em;">'''Example: label'''</div>
+
==== Example: label ====
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
-- This example creates a transparent overlay message box to show a big warning message "You are under attack!" in the middle  
 
-- This example creates a transparent overlay message box to show a big warning message "You are under attack!" in the middle  
Line 82: Line 80:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
<div aria-level="4" role="heading" style="margin-top:1em;">'''Example: miniconsole'''</div>
+
==== Example: miniconsole ====
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
-- first, determine the size of your screen
 
-- first, determine the size of your screen

Revision as of 18:13, 18 February 2026

Current Projects/Issues

  • #1149 Public functions missing documentation in wiki
    • #1640 Wiki templates for easy versions
  • #7851 Bulkify db:add
  • #8864 Handle db:_migrate's assertions and transactions better

Basic Essentials

I intend to turn the following into composable templates. As they exist now is just to experiment with and get feedback on presentation and format.

echo

This function appends text at the end of the current line.

See also: moveCursor(), insertText(), cecho(), decho(), hecho()

Example: label

-- This example creates a transparent overlay message box to show a big warning message "You are under attack!" in the middle 
-- of the screen. Because the background color has a transparency level of 150 (0-255, with 0 being completely transparent 
-- and 255 opaque) the background text can still be read through.
local width, height = getMainWindowSize()
createLabel("messageBox",(width/2)-300,(height/2)-100,250,150,1)
resizeWindow("messageBox",500,70)
moveWindow("messageBox", (width/2)-300,(height/2)-100 )
setBackgroundColor("messageBox", 255, 204, 0, 200)
echo("messageBox", [[<p style="font-size:35px"><b><center><font color="red">You are under attack!</font></center></b></p>]])

Example: miniconsole

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