Comment blocks

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Comment blocks

#1 Post by monele »

I think I already asked this but I don't remember getting a precise answer so here it is again :

Is there any way to comment blocks of RenPy code ? I'd like to redo a particular scene but with the possibility to go back to the old version easily if it doesn't work. Putting # in front of every line would be rather tedious :/.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#2 Post by PyTom »

This is more of an editor function then a language one, IMHO. In SciTE (and SciTE for Ren'Py), commenting a block of text can be done by selecting it, and then chosing Edit > Block Comment or Uncomment.

Similarly, block indent can be done by selecting text and hitting Tab, and block outdent can be done by selecting text and hitting shift-Tab.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#3 Post by monele »

Mmm... true, yet Java offers two way to comment : // and /* */. One for lines and the other one for blocks. HTML and CSS follow a similar rule.
Since I'm quite used to my editor, I'd rather not change it.

Ah well, I just found a "comment" function like what you said. Well, it'll do for now I suppose ^^;... If it's not too difficult to implement though, please consider it since it would allow any editor to use that functionality. If it is, well, nevermind ^^;.
In any case, thanks :)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#4 Post by PyTom »

Which editor are you using to edit Ren'Py code? Have you customized it in any way?

I resist the idea of block comments, because they are unnecessary and make the code a little harder to read. Block comments make it hard to determine if a given line will execute or not, because then the user has to scroll up and look for the start of the comment block to determine if a given line is commented out. While syntax highlighting helps alot with this, in general editors that are sophisticated enough to support syntax-highlighting also support block comments.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#5 Post by monele »

I use Crimson Editor and haven't really customized it. I sometimes use the Python syntax highlighting if needed but that's all ^^;

shaja
Regular
Posts: 73
Joined: Sun Oct 16, 2005 8:34 am
Contact:

#6 Post by shaja »

I also use Crimson Editor, but using a copy of the python syntax files with added renpy keywords.

To set it up properly:

In the Crimson Editor 'link' subdirectory, create an "extension.rpy" file containing:

Code: Select all

LANGSPEC:RENPY.SPC
KEYWORDS:RENPY.KEY
In the 'spec' subdirectory, copy 'python.key' to 'renpy.key' and 'python.spc' to 'renpy.spc'.

Edit the 'renpy.key' file, and add to the end of the [KEYWORDS0:GLOBAL] section the lines:

Code: Select all

# ===== RenPy keywords =====
at call hide image init jump menu onlayer python
return scene set show with label
As long as the syntax type is autodetected as renpy (which is what the 'extension.rpy' file sets up), you can select a range of lines in the editor, right-click, and pick 'Make Comment' from the context menu.

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#7 Post by monele »

Perfect ! :D. Thanks a lot ^____^

Post Reply

Who is online

Users browsing this forum: apocolocyntose, DewyNebula