Using the Code Editor

The Code Editor is used to edit and compile the source files for all scripts used by MHS. Any text editor is sufficient for editing the source files, as the .lss file format is plain text with no special formatting, however only the Code Editor can be used to compile the scripts.

 

Layout

Number Name Description
Editing Area This is were you edit the code for the open script. You may edit any script file, regardless of whether it is part of any script set or not.
Functions

This dockable window displays all functions available for the current script set. It organizes them into groups and displays their names and parameters and provides an explanation for each.

As with all dockable windows, hold Ctrl to drag it while not allowing it to dock.

Scripts

This dockable window displays the scripts in the current script set.

As with all dockable windows, hold Ctrl to drag it while not allowing it to dock.

Output Area This is where compilation errors or message generated by the script go. Using PrintF(), Warning(), and Error() send their texts here.
Script Tabs Each open script has a tab. Edit a script by selecting its tab.
Compile Button Use this to compile the current script set. Compiling a script set implies that all running threads in the script will be halted. Scripts are automatically compiled at the launch of the program, so this is not required to begin using scripts.

 

Script Sets

Scripts are broken into sets. For example, scripts related to the MHS system, scripts related to the Hex Editor, etc. Currently the only supported script set is System, which are the scripts that work with MHS generically.

To change between current script sets, use the Script Set menu item. Currently the only script set is System. When you select a new script set, the Functions dockable window will list the functions for that script set, and the Scripts dockable window will display the script files that are in that script set.

 

To add a script file to a script set, press Ctrl-D or select the File/Add to Scripts menu item. The file will be added to the current script set, which means it will be compiled with the other scripts in the set either the next time MHS is run or the next time you press Compile.

To remove a script file from the current script set, press Ctrl-R or select the File/Remove from Scripts menu item.

 

Creating/Modifying Files

To create a new script file, press Ctrl-N or select the File/New menu item. New files are not added to the current script set automatically.

To open an existing script file, whether part of any script set or not, press Ctrl-O or select the File/Open menu item.

To save an open script file, select its tab and press Ctrl-S or select the File/Save menu item. If the file has not been saved already, you will be prompted to supply a file name.

To save a script file under a new name, select its tab and press Ctrl-Shift-A or select the File/Save As menu item.

To save all open script files, select the File/Save All menu item.

To close an open script file, select its tab and press press Ctrl-F4 or select the File/Close menu item. If the file has not been saved since its last modification, you will be prompted to save.

To close all open script files, press Ctrl-Shift-F4 or select the File/Close All menu item. All unsaved files will prompted you to save.

 

Edit Options

The edit options are standard and are in no way unique to this application.

Menu Item Shortcut Operation
Undo Ctrl-Z Undo the last operation in the current script file. There is no limit on the number of operations that can be undone.
Redo Ctrl-Y Redo the last operation in the current script file.
Cut Ctrl-X Cut the selected text from the current script file.
Copy Ctrl-C Copy the selected text from the current script file.
Paste Ctrl-V Paste text over the selected area in the current script file. If no selection, the paste operation is performed at the caret position and the data is inserted.
Delete Del Delete the selected text in the current script file. If no selection, the character before the caret is deleted.
Select All Ctrl-A Select all text in the current script file.

 

Find

Press Ctrl-F or select the Search/Find menu item to load the Find dialog. the following chart explains each option.

Option Description
Find What This is the text to find.
Match Whole Word Only Indicates that only whole words will be matched in the search. Whole words are words that are surrounded on both sides by characters other than alpha-numeric characters and underscores.
Match Case Indicates that the values found in the script file must have the same case as the value in Find what.
Regular Expression Indicates that Find what is a regular-expression-formatted string. See Wildcards and Regular Expressions.
Wrap Around Indicates that the search will wrap at the end of the file and come back to the starting point before the search is complete.
Up Indicates the search will proceed upwards.
Down Indicates the search will proceed downwards.
Mark All Instead of finding the next occurrence, this will place a bookmark on all occurrences found.

Press F3 or select the Search/Find Next... menu item to repeat the search from the current position. Repeating a search uses the previous search parameters and always performs a Find Next operation rather than a Mark All operation, even if Mark All was the last operation performed. The search is also always performed downwards.

Press Ctrl-F3 or select the Search/Find Previous... menu item to repeat the search, but upwards instead of downwards.

 

Replace

Press Ctrl-H or select the Search/Replace menu item to load the Replace dialog. The following chart explains each option.

Option Description
Find What This is the text to find.
Replace With If replacing, all matches are replaced with this text value.
Match Whole Word Only Indicates that only whole words will be matched in the search. Whole words are words that are surrounded on both sides by characters other than alpha-numeric characters and underscores.
Match Case Indicates that the values found in the script file must have the same case as the value in Find what.
Regular Expression Indicates that Find what is a regular-expression-formatted string. See Wildcards and Regular Expressions.
Wrap Around Indicates that the search will wrap at the end of the file and come back to the starting point before the search is complete.
Find Next Finds the next occurrence without replacing it.
Replace Finds the next occurrence and replaces it.
Replace All Finds all occurrences and replaces them. The number of replacements made is displayed in the Replacements label.
Replace in Selection Finds all occurrences completely within the selected area and replaces them. The number of replacements made is displayed in the Replacements label.

 

Go To...

Press Ctrl-G or select the Search/Go To... menu item to load the Go To dialog.

You can go to any position in the current script file, either by line number or character position.

This is mostly used after compiling a script with errors. For the time being, the error report tells you the position of the error and you must manually go there using the Go To dialog. To quickly go to any error, press Ctrl-G and immediately type the error line. By default, when the dialog is loaded, the Line field is automatically highlighted and ready to be edited.

 

Bookmarks

Bookmarks are used to indicate areas of interest in your code. They appear as white ragged-edged circles next to the line numbers. Bookmarks allow easy navigation of your code through the keyboard shortcuts (F2 and Ctrl-F2) used to quickly go to the next and previous bookmarks.

To add a bookmark, press Ctrl-B or select the Search/Toggle Bookmark menu item. If no bookmark is on the current line of the current file, one will be added, otherwise the existing one will be removed.

To go to the next bookmark after the caret position, press F2 or select the Search/Next Bookmark menu item.

To go to the previous bookmark from the caret position, press Ctrl-F2 or select the Search/Previous Bookmark menu item.

To clear all bookmarks, press Ctrl-Shift-F2 or select the Search/Clear All Bookmarks menu item.

 

Dockable Windows

If any of the dockable windows are closed, they can be reopened by using the Window menu item.

All dockable windows in MHS can have their docking disabled by holding Ctrl while dragging them.

You can quickly open a script file in a script set by double-clicking it in the Scripts dockable window.

 

Code Folding

To fold a segment of code, click on the grey line anywhere in the range of the folding - indicator, as shown in the diagram to the left.

Folded code is designated by a line under the folded code segment and an unfolding + in the grey area to the left.

To unfold again, click the unfolding + indicator.

 

Options

The Code Editor options can be accessed in the Options dialog (Tools/Options menu item). Here you can enable or disable showing of lines and code folding, select the font and text size, and select styles and colors for each of the type of text elements.

Option Description
Show Lines Determines if line numbers are shown. Does not change code windows that are already open.
Code Folding Determines if code folding is enabled. Does not change code windows that are already open.
Font Allows you to select a font from the list. Fixed-width fonts are listed first.
Size Indicates the size of the text.
Styles Allows you to select the bold, italic, and color styles for each of the text elements.

 

The IDE control is Scintilla.
Copyright © 2006 Shawn (L. Spiro) Wilcoxen