Cube provide several features :
1. CodeEditor(/cube code, also you can open key bindings to give it a key)
You can run debug codes in the default snippet editor, here are some key features for the editor:
- Auto indent when you type codes in it.
- Auto syntax color, you can change the colors in the menu.
- Auto-complete based on a API list and the words in the codes.
- An operation history based on you operation(like input several codes, press backspace to delete several lines, not based on the time), you can use CTRL+Z to undo, CTRL+Y to redo.
- Use CTRL+G and give a line number to go.
- Use CTRL+F to find text, F3 for continue search(only works for word now)
- Use CTRL+A then TAB to format the code, this is failsafe operation.
- Use CTRL+ENTER to insert a new line after the current line and move the cursor to the new line.
- Use F5 to run the code.
- You can use Pageup, Pagedown to jump pages.
- You can use Doublc-Click to a word.
- You can use SHIFT + UP or DOWN or LEFT or RIGHT or PAGEUP or PAGEDOWN to select blocks.
- You can click the line number to select one line.
- You can press mouse down on a line number and move the mouse to other line number to select several lines.
Also you can click the button on the top left to show the snippet tree, click the Add button on the root (you'll see the button when move mouse on it).
Give it a name, and you'll have a new snippet can used to save codes, also you can choose the auto-run for the snippet so it'll be auto run in the beginning of the next game session.
If you don't like commands like ctrl+z, ctrl+y, you can set them in the Commond:
(Yeah, I try to give a system so users can write mods for Cube, but I don't have more time for it, so it's now only used to modify the command keys)
You can Click the Log button to open a Log panel :
You can type some commands in the bottom edit box, press enter to run it, "= exp" will be converted to "print(exp)", the print here is special designed only send message to the log panel, the log panel is editable, so you can copy it or clear it.
You can also use UP or DOWN to toggle the history commands.
If you run the code in the snippet, print is original, so only send message to the chat message frame, if you want send message to the log panel, you should use :
Cube.Log(msg, r, g, b)
All four parameters are required(Maybe added in the next version).
2. Debugger(/cube debug)
There is only one input box at the top, you can type in the table or a frame's global name, or an expression that the result is a table or a frame, then press enter to see the result.
Like the pic, you can input "GetMouseFocus()" then move mouse to a frame and press the enter to show the details of the target frame. Children and layer regions would also be shown in the tree. If you select a node that's an ui element, it would be shine so you may easily find it, also the edit box would show the access path of the node.