Runtime visual novel editor

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
picobyte
Newbie
Posts: 8
Joined: Mon Mar 14, 2016 2:15 pm
Contact:

Runtime visual novel editor

#1 Post by picobyte » Sun Aug 21, 2016 9:50 am

This is a runtime Ren'Py editor. Do not use this in commercial only visual novels without eventual public release.

repository: https://github.com/picobyte/EditButton

Required to get the editor are the files:
game/Inconsolata-Regular.ttf
game/renpyformatter.py
game/renpy_lexer.py
game/edit_button.rpy
README.txt

Follow instructions in the readme. Also make sure you have a backup of your .rpy files, or work in a repository, if you intend to use this. 'Apply' in the editor writes changes to your .rpy files. If you have the file open in an external editor with unsaved changes you get into trouble.

The above files, and a button, e.g. in screen.rpy quickmenu, will enable an edit code button. When pressed, an editor is shown to edit the current .rpy file. As long as changes are syntactically correct, they can be applied to the rpy file. If changes cause a syntax error, this error is shown (unless silenced). Edits can also be cancelled or a return to visual mode can be used to keep the edits in store temporarily. Applied changes might be visible in visual mode after triggering a reload (shift+r) It may be possible that the reload restarts the novel, though.

There is undo (ctrl+z) and redo (ctrl+y) functionality. You may have to press undo a bit more then expected. Cursor can be placed by keyboard or mouse and the mousewheel should work. Multiline selection is possible, and works mostly as expected: deletion of selected text, copy, cut and paste with ctrl+c, ctrl+x and ctrl+v, shift/ctrl + cursor movement, ctrl + shift for word selection.

Latest version fixes an issue for non-linux OS.

Are there particular issues or features missing?

Known issues:
undo/redo is a bit silly
The edit button does not work when translation is active. Not sure how to address this. The editor should work in the native language so this is usually not an issue. Please let me know if editing unicode text still causes problems.


The README.txt indicates how install pygments for color support. Not sure if this works for non-linux OS. I install pygments in the game directory, and removal of some unicode characters was requires as instructed in README.

Add e.g. to the quick menu the last two lines to provide an edit button to start the editor.

Code: Select all

screen quick_menu():

    # Ensure this appears on top of other screens.
    zorder 100

    # Add an in-game quick menu.
    hbox:
        style_prefix "quick"

        xalign 0.5
        yalign 1.0

        if config.developer and _editor.editor:
            textbutton _("Edit") action [_editor.editor.start(renpy.get_filename_line()), ShowMenu('editor')]
Last edited by picobyte on Sun Nov 19, 2017 4:49 pm, edited 30 times in total.

User avatar
Taleweaver
Writing Maniac
Posts: 3369
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: Edit dialogue + Code button for developer

#2 Post by Taleweaver » Tue Aug 23, 2016 2:13 am

Wrong forum. Thread moved.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

picobyte
Newbie
Posts: 8
Joined: Mon Mar 14, 2016 2:15 pm
Contact:

Re: Edit dialogue + Code button for developer

#3 Post by picobyte » Tue Aug 23, 2016 5:32 pm

Taleweaver wrote:Wrong forum. Thread moved.
So what exactly seems to be my question?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3047
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Edit dialogue + Code button for developer

#4 Post by trooper6 » Tue Aug 23, 2016 5:35 pm

You are currently in the Cookbook section, where people share code...which is what you are doing with your post, yes?
You are not currently in the Questions Section.
A Close Shave:
*Last Thing Done (Jul 7) Finished Emotion Matrix for Joint Customer Sprite.
*Currently Doing: Print Matrices, & decide emotions to use for Joint Sprite, think about blinking and lip flap. Maybe also about TransitionConditionSwitch?
*First Next thing to do: Code in all the sprite emotion and camera movement for Close Shave Sprite Sections
*Next Thing to Do: Code in all CG and special animation stuff
*Other Next Thing: Do SFX
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

picobyte
Newbie
Posts: 8
Joined: Mon Mar 14, 2016 2:15 pm
Contact:

Re: Edit dialogue + Code button for developer

#5 Post by picobyte » Tue Aug 23, 2016 5:47 pm

Ah yes, that seems right.

picobyte
Newbie
Posts: 8
Joined: Mon Mar 14, 2016 2:15 pm
Contact:

Re: Edit dialogue + Code button for developer

#6 Post by picobyte » Sat Nov 04, 2017 8:14 pm

A new version is pushed to the github repository. Pygments is now a requirement. Highlights:
Editing is improved.
There is some mouse support (cursor movement by mouseclick).
Live highlighting and debugging.
Debug check that allows only applying code that cause no parse errors.
The visual novel script explains how the editor works.

picobyte
Newbie
Posts: 8
Joined: Mon Mar 14, 2016 2:15 pm
Contact:

Re: Edit dialogue + Code button for developer

#7 Post by picobyte » Fri Nov 10, 2017 7:26 pm

added undo (ctrl+z) and redo (ctrl+y)

Post Reply

Who is online

Users browsing this forum: No registered users