Monkey is a script editor in Rhino4 used to edit, run, debug and compile scripts. It contains all the standard programmer editor features such as Find/Replace, multi-document interface, code trees and integrated help files.
The Monkey script editor is a plug-in, not a stand-alone application, meaning it can only be run inside of Rhino4. You can either run the '_Monkey' command to open the script editor, or access the plug-in via the Monkey menu within the Rhino menu bar. After a short delay, Monkey will be displayed. Since the editor is likely to be displayed as a large window, it is non-dockable. By default, the window is linked to Rhino, meaning that if you minimize Rhino, Monkey will also disappear. It is possible to unlink Rhino and Monkey.
The Monkey plug-in can be downloaded here.
The code editor is the most important area within the Monkey Editor. It is here that the scripting actually takes place. The code editor provides many useful tools that a simple text editor does not have, including:
Syntax Highlighting is a feature that displays source code in different colors and fonts according to the category of terms. This feature eases writing in a programming language, as both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it's made only for human readers/editors.
Intellisense is a convenient way to access descriptions of functions, particularly their parameter lists. It speeds up coding by reducing the amount of name memorization needed and keyboard input required. It also allows for less reference to external documentation, as interactive documentation on many symbols in the active scope appears dynamically in the form of tool tips while programming.
To the left of the Code Editor, there is also a sequence of line numbers which can be extremely useful when error checking and debugging. One can apply Breakpoints to these line numbers by simply clicking on them, and they can remove those Breakpoints by clicking on them another two times. A Breakpoint is utilized in the debugging process and will be explained further below.
The toolbar at the top of the Monkey Editor is broken up into three sections:
File Management contains ubiquitous buttons such as New, Open, Save, Save All, and Save As. The Execution portion of the Monkey Editor has buttons that relate to the operation of the script such as Run the Script and Debug the Script. Run the Script will simply execute the code that is contained within the Code Editor, while Debug the Script will also execute the code within the Code Editor, but it will also open another interface used in debugging the script as shown below:
The Syntax Tree located to the left of the Monkey Editor contains all of the Rhino methods and functions available to the programmer. The functions are grouped by their associated methods which can be expanded to reveal the functions or collapsed to hide the functions by clicking on the plus sign located next to the category of interest. To find out more information about a particular function, the programmer simply has to double-click on the function itself and the RhinoScript help window opens to that particular function. The programmer also has the ability to drag the function from the Syntax Tree to the Code Editor which places the function inside of the programmer's script. From there the programmer simply must modify the parameters associated with that function in order for it to operate properly.