Page 1 of 1

Runtime visual novel editor

Posted: Sun Aug 21, 2016 9:50 am
by picobyte
# EditButton
Add a quick fix/edit button for Ren'Py developerment. Without config.developer the editor is not be accessible.

The editor provides a means to proofread your visual novel while running it and without leaving. One button in the quickmenu provides access to this editor that shows the Ren'py code at the location you were, in visual modus. The editor provides basic features, has a few quirks still.

Installation into existing git project add as a git submodule:
https://github.com/picobyte/RVRE

and run
game/RVRE/scripts_and_fixes/install.sh

or if in windows:
game\RVRE\scripts_and_fixes\install.bat

An example repository (and a tutorial for the editor)
https://github.com/picobyte/EditButton

Issues and feature requests can be added to this thread or in the issues of the respective repositories

Features:
The editor isn't perfect, and currently has a limited set of features:
* basic editing
- cursor, clipboard, selection (Shift+)(Ctrl+)key movement,
- selection can only cover the screen you're working in; WIP
* Undo / redo, (Ctrl-z/Ctrl-y), only the cursor position thereafter is a bit odd, WIP.
* editor display style configuration (color scheme)
* Ren'py error checking - can be hidden.
* file saving
- only available if the code is without errors. A safety net, because errors make the editor unavailable.
- 'Apply' returns to visual modus with a reload so changes should be visible.
(there should probably also be a save without leaving the editor)
* returning to visual modus discarding changes
* returning to visual modus keeping changes *temporarily* in memory
- changes are lost after reload or loading.
* Spell checking - can be disabled:
- languages English, also available for French, German, Portuguese, Spanish. Russian should work with an update see instruction in EditButton Readme.
- suggestions for changes can be chosen from a drop-down (or pull-up) menu
* find text, very basic, still.
* file and line number are shown in the window title, cursor and mouse position as well, updated upon cursor movement.
* there is a right-click mouse menu.
- languages and styles can be chosen here.
- Selecting font is listed (changing to a larger font while text is selected causes error, though).


This is a runtime Ren'py editor. Licensed LGPL or MIT can be allowed under certain conditions. Do not use this in commercial closed source only visual novels without eventual public releases unless a permission was granted. It's ok in commercial if the public version is a few behind.

Re: Edit dialogue + Code button for developer

Posted: Tue Aug 23, 2016 2:13 am
by Taleweaver
Wrong forum. Thread moved.

Re: Edit dialogue + Code button for developer

Posted: Tue Aug 23, 2016 5:32 pm
by picobyte
Taleweaver wrote:Wrong forum. Thread moved.
So what exactly seems to be my question?

Re: Edit dialogue + Code button for developer

Posted: Tue Aug 23, 2016 5:35 pm
by trooper6
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.

Re: Edit dialogue + Code button for developer

Posted: Tue Aug 23, 2016 5:47 pm
by picobyte
Ah yes, that seems right.

Re: Edit dialogue + Code button for developer

Posted: Sat Nov 04, 2017 8:14 pm
by picobyte
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.

Re: Edit dialogue + Code button for developer

Posted: Fri Nov 10, 2017 7:26 pm
by picobyte
added undo (ctrl+z) and redo (ctrl+y)

Re: Runtime visual novel editor

Posted: Fri Aug 27, 2021 7:29 pm
by picobyte
Fixed selection, some cursor issues, and error display.

Re: Runtime visual novel editor

Posted: Sat Aug 28, 2021 6:17 pm
by picobyte
Added search with Ctrl+f and fixed some more issues. Also see the animated gif which displays what the current version looks like.

Re: Runtime visual novel editor

Posted: Sun Aug 29, 2021 6:17 pm
by picobyte
Added a spell checker. Currently mistakes can be shown (in red) or toggled off. Suggesting alternatives is still under development.
The language is set on the line

Code: Select all

lang = SpellChecker(language='en')
the checker also supports other languages, with 'ru', 'es', 'fr', 'pt' or 'de'

Edit: Added some instructions that should hopefully also work in windows

Re: Runtime visual novel editor

Posted: Wed Sep 01, 2021 6:31 pm
by picobyte
Added spelling replacement suggestion dropdown menus
explanation on github how to install libraries for editor in windows

Re: Runtime visual novel editor

Posted: Sun Sep 05, 2021 7:37 pm
by picobyte
updated the undo/redo code:

Changes in history are stored per line, now only the initial state is stored, not every small edit. Cursor updates are now also stored in history. The result is that edits between cursor updates can now undone / redone together, which is more intuitive. The view is now also updated after undo/redo, which is better, although the view position is not always exactly where you'd expect it, still.

This is fairly complex (could introduce bugs). Edit: bugs I observed seem resolved, only cursor position after undo/redo remains a bit odd.

Re: Runtime visual novel editor

Posted: Mon Sep 06, 2021 9:24 pm
by picobyte
Font and font_size should can now be adjusted more easily. Two fonts are preconfigured: Inconsolata and ProggyClean. Adding a different custom mono font should be doable, but requires tweaking font_w_ratio and font_h_ratio:

adjust font_h_ratio until selection shadows lines vertically, if shadow is shown before lines, decrease ratio.
adjust font_w_ratio until selection shadows a line entirely, if shadow is too short, decrease ratio.
wordwrap is also affected, which makes it a little confusing. just scroll to the first line, start from there.

Edit 1: suggestion menus now pull-up if too low on screen. They also auto-close, if not hoovered, in 1.5 sec.
Edit 2: suggestions now only occur in strings or comments.

Re: Runtime visual novel editor

Posted: Sun Sep 19, 2021 9:05 pm
by picobyte
Added context menu, i.e. right mouse button menu. This is still work in progress. Implemented are changing styles and changing language.
Instructions in README for Russian language (requires updated databases). However, couldn't get it to display Cyrillic, other languages seemed ok. Could be UTF-8 or locale or charset related, not sure.
would like to add:
* code templates
* renpy.jump() to this (cursor) location
* jump to definition (maybe using exuberant tags or so).
* a file menu (open/browse files, save as, etc.)
Not everything should end up in the context menu, the idea is to make the bottom buttons drop-up menus as well for (the usual) options.
Also some kind of forms would be nice to have
Added lots of bugs^H^H^H^Hfeatures.

Edit: the edit_button.rpy is becoming too large, moved python code to module.
Edit: performance improved a bit
Separate repo for editor only and more easy install