documentation indexreference manualfunction index

Contents

Integrating Crimson Editor with Ren'Py

Crimson Editor is a freeware Windows text editor, available here.

Editor Preferences

In the program's Preferences dialog, General category, tab size should be set to 4 and "Use spaces in place of tab" should be checked. "Allow multiple instances" should not be checked. "Enable auto indent" should be checked.

In the General/Visual category, "Show tab characters" should be checked.

In the File category, "Convert tabs to spaces before saving" should be checked.

Syntax Highlighting

To setup Ren'Py syntax highlighting with Crimson Editor, three configuration files must be created.

First, create a text file named `extension.rpy` in the `link` subdirectory of the main Crimson Editor program directory. The `extension.rpy` file should contain the lines:

LANGSPEC:RENPY.SPC
KEYWORDS:RENPY.KEY

This file directs Crimson Editor to apply Ren'Py syntax highlighting to all files it opens with the ".rpy" extension.

Second, create a text file named `renpy.spc` in the `spec` subdirectory of the main Crimson Editor program directory. The `renpy.spc` file should contain the lines:

# Ren'PY LANGUAGE SPECIFICATION FILE FOR CRIMSON EDITOR
# Derived from the Python language specification file
# FIRST EDITED BY IGKANG 2000.11.11
# derived from PHP.SPC, Geert van Boven (g.vanboven@dignion.com or gvb@vbit.nl) 26 sept. 2001

$CASESENSITIVE=YES
$MULTILINESTRINGCONSTANT=YES
$DELIMITERS=(){}[]<>+-*/%="'~!@#&$^&|\?:;,.
$KEYWORDPREFIX=&
$ESCAPECHAR=\
$QUOTATIONMARK1="
$QUOTATIONMARK2='
$LINECOMMENT=#
$PAIRS1=()
$PAIRS2=[]
$PAIRS3={}

Third, create a text file named `renpy.key` in the `spec` subdirectory of the main Crimson Editor program directory. The `renpy.key` file should contain the lines:

[-COMMENT-:GLOBAL]
# Ren'Py LANGUAGE KEYWORDS FILE FOR CRIMSON EDITOR
# Derived from the Python keywords file, updated bst 2006/9/16
# FIRST EDITED BY Geert van Boven (g.vanboven@dignion.com or gvb@vbit.nl) 26 sept. 2001

[KEYWORDS0:GLOBAL]
# ===== program flow control =====
break
continue
elif else
for from
if import
pass
reload return
while

# ===== built in functions and other reserved words =====
abs and apply assert
buffer
callable chr class cmp coerce compile complex
def del delattr dir divmod
eval exec execfile
filter float
getattr global globals
hasattr hash hex
id in input int intern is isinstance issubclass
lambda len list locals long
map max min
not
oct open or ord
pow print
range raw_input reduce repr round
setattr slice str
tuple type
unichr unicode
vars
xrange
zip

# ===== additional RenPy keywords =====
as at call expression hide image init jump label menu
onlayer python return scene set show with zorder

# ===== exception handling =====
except
finally
raise
try

Running Ren'Py from Crimson Editor

Ren'Py may be launched directly from Crimson Editor as a User Tool.

Default options

To run Ren'Py with default launching options, use these User Tool options:

Custom game directory

To run Ren'Py with a custom game directory, use these User Tool options:

Warp to script line

To run Ren'Py with a custom game directory, use these User Tool options:

Open Explorer to game data directory

It may be useful to open Explorer to the game data directory, to show the non-script resources. Use these User Tool options:

Running Crimson Editor from Ren'Py

It is also possible to run Crimson Editor from Ren'Py. To do this, you'll need to add code like:

init:
    $ config.editor = '"c:\\Program Files\\Crimson Editor\\cedt.exe" /L:%(line)d %(filename)s'

You'll need to chage c:\\Program Files\\Crimson Editor\\cedt.exe to the path to your installed Crimson Editor path. Backslashes in the path need to be doubled, as you're in a python string.

Once the game has had this line added to it, start it up. Pressing shift-e in the game will start an editor at the line corresponding to the currently executing Ren'Py statement.

Crimson Editor usage notes

To increase the indent level of a block of text, select the lines making up the block, and hit `Ctrl+.` or `Tab`

To decrease the indent level of a block of text, select the lines making up the block, and hit `Ctrl+,` or `Shift+Tab`

To comment out a block of text, select the lines making up the block, and hit `Ctrl+m`

To uncomment a previously commented block of text, select the lines making up the block, and hit `Ctrl+Shift+m`

User macros may be defined and hotkeyed to, for instance, insert a commonly used show statement.

Projects may be defined for easy access to all the script files making up a game project.

Line bookmarks are toggled with `Ctrl+F2`. Jump to the next bookmark with `F2`, or previous with `Shift+F2`


documentation indexreference manualfunction index