Multi-line Comments

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
User avatar
rabcor
Regular
Posts: 81
Joined: Sun Mar 17, 2013 3:07 pm
Projects: None (Need a programmer?)
Organization: Cestarian Games
Contact:

Multi-line Comments

#1 Post by rabcor » Mon Nov 25, 2013 3:32 pm

Is there any way to do multi-line comments in Ren'Py? (other than just stacking hashtags)

Python's syntax for it is

Code: Select all

'''
Comment
'''
But renpy gives me errors if i do that. (End of line expected.)

User avatar
i1abnrk
Regular
Posts: 38
Joined: Wed Nov 20, 2013 1:50 pm
Projects: Critter Corral, Haremu Kikkemu Mo
IRC Nick: i1abnrk
Deviantart: i1abnrk
Github: i1abnrk
Location: Wisconsin
Contact:

Re: Multi-line Comments

#2 Post by i1abnrk » Wed Nov 27, 2013 1:17 am

You could do line continuations with the backslash character

Code: Select all

#This is a really long comment and because python\
Is a utf-8 language I can easily concatenate my\
Physical lines by escaping the newline character\
With a backslash.
or you could wrap your comment block with a python: block.

Code: Select all

    python:
        """
A multiline comment is still valid
If it is inside a python block but
Don't forget to match indentation
With the matching triple quote
        """
The first example may not work on Windows because the line terminator is two characters.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Multi-line Comments

#3 Post by xavimat » Wed Nov 27, 2013 12:28 pm

Sorry for my question but... what's the problem with the '#' ?
I mean, in Editra, just select all the lines you need to comment, press Ctrl-1 and you're done. (I think is Ctrl-Q or Ctrl-K in notepad++)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
rabcor
Regular
Posts: 81
Joined: Sun Mar 17, 2013 3:07 pm
Projects: None (Need a programmer?)
Organization: Cestarian Games
Contact:

Re: Multi-line Comments

#4 Post by rabcor » Wed Nov 27, 2013 2:52 pm

Thanks, i1abnrk your first example didn't seem to work (then again, i am in windows, but cross platform compatibility is extremely important to me and it'd be a complete waste to develop on Ren'Py and not make use of it's cross platform capabilities don't you think?)

I'd rather not lengthen my code by calling up a python block solely for the purpose of writing a comment, instead as an alternative i just created an RTF document to write what i wanted to use a multi-line comment for.

The disadvantage of not having a multi-line comment functionality is (from my perspective) mostly the fact that all your comments will be in the same color scheme within the editor (so you can't tell just by a glance where which comments are, for example my goal this time was to create a list of all the bools/flags i've got, and the labels with a brief description in case i'd forget what's what later in development as a precaution inside of script.rpy which i currently only use for character definitions, since it's already a list of all the characters i've defined i figured it'd be nice to put other lists in there as well.)

It's ctrl+q in notepad++, but its not a matter of speed, rather readability and dividing the comments into two seperate types. I guess also when it comes to commenting out actual chunks of code i guess it's preference whether you like to use the key-bind for single line commenting all selected lines or to use a multi-line comment function for it, i prefer to use the multi-line comment function for it.

Maybe i'm just being special, i don't know.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Multi-line Comments

#5 Post by xavimat » Thu Nov 28, 2013 3:49 am

Thanks, rabcor. I see now.

I'd add a comment, a little off-topic, but related to organizing the work in the rpy files:
I'm using a lot the # TODO feature in Renpy. The launcher scans the .rpy files, finds the '# TODO' lines and presents them in 'Navigate Scrip > TODOs'. It's really useful.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
rabcor
Regular
Posts: 81
Joined: Sun Mar 17, 2013 3:07 pm
Projects: None (Need a programmer?)
Organization: Cestarian Games
Contact:

Re: Multi-line Comments

#6 Post by rabcor » Thu Nov 28, 2013 9:33 am

I did not know about that feature, thanks for telling me this, it's bound to be useful! :)

Post Reply

Who is online

Users browsing this forum: No registered users