Text Editor
UPBGE has a Text Editor among its editor types, accessible via the Editor type menu, or the shortcut Shift-F11.
Header
The newly opened Text editor is empty, with a very simple header. More options become available when a text file is created or opened.
- Editor Type
The standard editor selection button.
- Menus
Editor’s menus.
- Resolve Conflict
Resolves modified file conflicts when an external text file is updated from another program.
- Reload from Disk
Opens the file from drive again, overriding any local changes.
- Make Text Internal
Converts the external text data-block into an internal one.
- Ignore
Hides the warning message until the external text file is modified externally again.
- Text
A data-block menu to select a text or to create a new one. After that the header will change.
- Run Script (play icon)
Executes the text as a Python script Alt-P. This execution has placed out of Game Engine only, and it is focused for development mainly. If you want to execute a Python script inside the Game Engine check the Python Scripting chapter.
- Show
Toggle display options.
Line Numbers, Word Wrap, Syntax Highlighting
Find & Replace
- Find Text Ctrl-F
Searches for instances of a text that occur after the cursor. Using the eyedropper icon will search for the currently selected text and sets the selection to the match. Find Next searches for the next instance of the text.
- Replace Text Ctrl-H
Searches for the text specified in Find Text and replaces it with the new text. Using the eyedropper icon will set the currently selected text as the replace text. Replace searches for the next match and replaces it. Replace All searches for the match and replaces all occurrences of the match with the new text.
- Case
Search is sensitive to upper-case and lower-case letters.
- Wrap
Search again from the start of the file when reaching the end.
- All
Search in all text data-blocks instead of only the active one.
Properties
- Margin
Shows a right margin to help keep line length at a reasonable length when scripting. The width of the margin is specified in Margin Column.
- Font Size Ctrl-WheelUp
The size of the font used to display text.
- Tab Width
The number of character spaces to display tab characters with.
- Indentation
Use Tabs or Spaces for indentations.
Usage
Running Scripts
The most notable keystroke is Alt-P which makes the content of the buffer being parsed by the internal Python interpreter built into UPBGE. Before going on it is worth noticing that UPBGE comes with a fully functional Python interpreter built-in, and with a lots of Blender/UPBGE-specific modules.
Warning
This script execution takes place outside Game Engine, and it is intended for development purpose only. If you want to execute a Python script inside the Game Engine check the Python Scripting chapter.