Difference between revisions of "Manual:Basic Essentials"

From Mudlet
Jump to navigation Jump to search
Line 5: Line 5:
 
;send( command, echo the value = true/false )
 
;send( command, echo the value = true/false )
 
:This sends "command" directly to the network layer, skipping the alias matching. The optional second argument of type boolean (print) determines if the outgoing command is to be echoed on the screen.
 
:This sends "command" directly to the network layer, skipping the alias matching. The optional second argument of type boolean (print) determines if the outgoing command is to be echoed on the screen.
:If you want your command to be checked if it’s an alias, use expandAlias() instead. example:
+
 
 +
See also: [[#sendAll|sendAll]]
 +
 
 +
{{note}} If you want your command to be checked as if it's an alias, use [[#expandAlias|expandAlias()]] instead.
 +
 
 
<lua>
 
<lua>
 
send( "Hello Jane" ) --echos the command on the screen
 
send( "Hello Jane" ) --echos the command on the screen
 
send( "Hello Jane", true ) --echos the command on the screen
 
send( "Hello Jane", true ) --echos the command on the screen
 
send( "Hello Jane", false ) --does not echo the command on the screen
 
send( "Hello Jane", false ) --does not echo the command on the screen
 +
 +
-- use a variable in the send:
 +
send("kick "..target)
 
</lua>
 
</lua>
  

Revision as of 05:13, 7 August 2012

Basic Essentials

These functions are generic functions used in normal scripting. These deal with mainly everyday things, like sending stuff and echoing to the screen.

send

send( command, echo the value = true/false )
This sends "command" directly to the network layer, skipping the alias matching. The optional second argument of type boolean (print) determines if the outgoing command is to be echoed on the screen.

See also: sendAll

Note Note: If you want your command to be checked as if it's an alias, use expandAlias() instead.

<lua> send( "Hello Jane" ) --echos the command on the screen send( "Hello Jane", true ) --echos the command on the screen send( "Hello Jane", false ) --does not echo the command on the screen

-- use a variable in the send: send("kick "..target) </lua>

echo

echo( windowName, text )
This function appends text at the end of the current line. The current cursor position is ignored. Use moveCursor() and insertText() if you want to print at a different cursor position.
If the first argument is omitted the main console is used, otherwise the mini console windowName. === Example 1:

<lua> echo( "Hello world\n" ) -- writes "Hello world" to the main screen. echo( "info", "Hello this is the info window" ) -- writes text to the mini console named "info" if such a window exists </lua>