Difference between revisions of "Manual:Script Editor"

From Mudlet
Jump to navigation Jump to search
(Replace image with text for a11y & also include keyboard navigation from PR #2979)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Editor =
+
{{TOC right}}
 +
{{#description2:Manual on the editor and shortcuts available to navigate, select and edit scripts, triggers, aliases, etc.}}
 +
= Script Editor =
  
== Editor shortcuts ==
+
The Script editor screen (default key: Alt+E) provides access to Mudlet's automation features such as; [[Manual:Trigger Engine|triggers]], [[Manual:Aliases|aliases]], [[Manual:Scripting|scripts]], [[Manual:Timers|timers]], [[Manual:Introduction#Keybindings|keybindings]], [[Manual:Using Variables in Mudlet|variables]] and [[Manual:Introduction#Buttons|buttons]].  It also has an [[Manual:Introduction#Runtime_errors_aka_Errors_View|error console]], statistics generator and debug console.
 +
 
 +
== Lua Code Editor ==
 +
 
 +
Edit Lua scripts in the large code editor found in the bottom right section of the Script Editor.  Mudlet runs Lua 5.1 and can access any [[Compiling_Mudlet#Lua_.26_Luarocks|Lua libraries]] install on your system.  The API can be found [[Manual:Lua_Functions|here]].
 +
 
 +
[[File:Lua-code-editor.png|thumb|center|Editing a Lua script]]
 +
 
 +
=== Editor shortcuts ===
  
 
The following shortcuts are available in the Lua code editor:
 
The following shortcuts are available in the Lua code editor:
  
{| style="width: 500px; border-bottom:solid 5px #882222;"  
+
{| class="alternating-table" style="width: 500px; border-bottom:solid 5px #882222;"  
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Navigation shortcuts
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Navigation shortcuts
|-
+
|-  
 
| style="font-family: monospace, monospace;" | Ctrl+Tab
 
| style="font-family: monospace, monospace;" | Ctrl+Tab
 
| Focus next section
 
| Focus next section
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+Tab
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+Tab
 
| Focus previous section
 
| Focus previous section
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+S
 +
| Save current item (trigger, alias, etc.)
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+Shift+S
 +
| Save complete profile
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+1
 +
| Show [[Manual:Technical_Manual#Trigger_Engine|trigger]] editor
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+2
 +
| Show [[Manual:Technical_Manual#React_on_input_-_Mudlets_Alias_Engine|aliases]] editor
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+3
 +
| Show scripts editor
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+4
 +
| Show [[Manual:Technical_Manual#Timer_Engine|timers]] editor
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+5
 +
| Show [[Manual:Introduction#Keybindings|keys]] editor
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+6
 +
| Show [[Manual:Technical_Manual#Using_Variables_in_Mudlet|variables]] editor
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+7
 +
| Show [[Manual:Introduction#Buttons|buttons]] editor
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+8
 +
| Show [[Manual:Introduction#Seeing_errors_in_your_code|error]] log console
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+9
 +
| Display statistics in main window
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+0
 +
| Open central debug console window
 
|}
 
|}
  
  
{| style="width: 500px; border-bottom:solid 5px #882222;"  
+
{| class="alternating-table" style="width: 500px; border-bottom:solid 5px #882222;"  
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Selection shortcuts
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Selection shortcuts
 
|-
 
|-
 
| style="font-family: monospace, monospace;" | Ctrl+A
 
| style="font-family: monospace, monospace;" | Ctrl+A
 
| Select all text
 
| Select all text
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+Left click
 
| style="font-family: monospace, monospace;" | Ctrl+Left click
 
| Add cursors
 
| Add cursors
Line 27: Line 73:
 
| style="font-family: monospace, monospace;" | Ctrl+Alt+Up
 
| style="font-family: monospace, monospace;" | Ctrl+Alt+Up
 
| Extend custors up
 
| Extend custors up
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+Alt+Down
 
| style="font-family: monospace, monospace;" | Ctrl+Alt+Down
 
| Extend custors down
 
| Extend custors down
Line 33: Line 79:
 
| style="font-family: monospace, monospace;" | Esc
 
| style="font-family: monospace, monospace;" | Esc
 
| Switch to one cursor
 
| Switch to one cursor
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+D
 
| style="font-family: monospace, monospace;" | Ctrl+D
 
| Select words at the cursor
 
| Select words at the cursor
Line 39: Line 85:
 
| style="font-family: monospace, monospace;" | Ctrl+L
 
| style="font-family: monospace, monospace;" | Ctrl+L
 
| Select next lines
 
| Select next lines
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+L
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+L
 
| Select previous lines
 
| Select previous lines
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+F
 +
| Opens the script editor's FIND dialog.
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | F3
 +
| Moves to the next FIND result.
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Shift+F3
 +
| Moves to the previous FIND result.
 
|}
 
|}
  
  
{| style="width: 500px; border-bottom:solid 5px #882222;"  
+
{| class="alternating-table" style="width: 500px; border-bottom:solid 5px #882222;"  
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Editing shortcuts
 
! colspan="2" style="color:white; background-color:#882222; text-align:left;" | Editing shortcuts
 
|-
 
|-
 
| style="font-family: monospace, monospace;" | Ctrl+]
 
| style="font-family: monospace, monospace;" | Ctrl+]
 
| Indent right
 
| Indent right
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+[
 
| style="font-family: monospace, monospace;" | Ctrl+[
 
| Indent left
 
| Indent left
Line 56: Line 111:
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+D
 
| style="font-family: monospace, monospace;" | Ctrl+Shift+D
 
| Duplicate
 
| Duplicate
 +
|- style="background-color:#ffefef;"
 +
| style="font-family: monospace, monospace;" | Ctrl+/
 +
| Toggle selection comment
 
|-
 
|-
 
| style="font-family: monospace, monospace;" | Alt+Backspace
 
| style="font-family: monospace, monospace;" | Alt+Backspace
 
| Delete rest of the word left
 
| Delete rest of the word left
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Ctrl+Backspace
 
| style="font-family: monospace, monospace;" | Ctrl+Backspace
 
|  
 
|  
|-
+
|-  
 
| style="font-family: monospace, monospace;" | Shift+Backspace
 
| style="font-family: monospace, monospace;" | Shift+Backspace
 
|  
 
|  
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Alt+Delete
 
| style="font-family: monospace, monospace;" | Alt+Delete
 
| Delete rest of the word right
 
| Delete rest of the word right
|-
+
|-  
 
| style="font-family: monospace, monospace;" | Ctrl+Delete
 
| style="font-family: monospace, monospace;" | Ctrl+Delete
 
|  
 
|  
|-
+
|- style="background-color:#ffefef;"
 
| style="font-family: monospace, monospace;" | Shift+Delete
 
| style="font-family: monospace, monospace;" | Shift+Delete
 
|  
 
|  
 +
|-
 +
| style="font-family: monospace, monospace;" | Ctrl+R
 +
| Toggle read-only
 
|}
 
|}

Latest revision as of 07:23, 23 June 2024

Script Editor

The Script editor screen (default key: Alt+E) provides access to Mudlet's automation features such as; triggers, aliases, scripts, timers, keybindings, variables and buttons. It also has an error console, statistics generator and debug console.

Lua Code Editor

Edit Lua scripts in the large code editor found in the bottom right section of the Script Editor. Mudlet runs Lua 5.1 and can access any Lua libraries install on your system. The API can be found here.

Editing a Lua script

Editor shortcuts

The following shortcuts are available in the Lua code editor:

Navigation shortcuts
Ctrl+Tab Focus next section
Ctrl+Shift+Tab Focus previous section
Ctrl+S Save current item (trigger, alias, etc.)
Ctrl+Shift+S Save complete profile
Ctrl+1 Show trigger editor
Ctrl+2 Show aliases editor
Ctrl+3 Show scripts editor
Ctrl+4 Show timers editor
Ctrl+5 Show keys editor
Ctrl+6 Show variables editor
Ctrl+7 Show buttons editor
Ctrl+8 Show error log console
Ctrl+9 Display statistics in main window
Ctrl+0 Open central debug console window


Selection shortcuts
Ctrl+A Select all text
Ctrl+Left click Add cursors
Ctrl+Alt+Up Extend custors up
Ctrl+Alt+Down Extend custors down
Esc Switch to one cursor
Ctrl+D Select words at the cursor
Ctrl+L Select next lines
Ctrl+Shift+L Select previous lines
Ctrl+F Opens the script editor's FIND dialog.
F3 Moves to the next FIND result.
Shift+F3 Moves to the previous FIND result.


Editing shortcuts
Ctrl+] Indent right
Ctrl+[ Indent left
Ctrl+Shift+D Duplicate
Ctrl+/ Toggle selection comment
Alt+Backspace Delete rest of the word left
Ctrl+Backspace
Shift+Backspace
Alt+Delete Delete rest of the word right
Ctrl+Delete
Shift+Delete
Ctrl+R Toggle read-only