Developer tool idea: Notes system

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
@berration
Regular
Posts: 70
Joined: Sun Jul 15, 2007 2:36 pm
Projects: EH...
Contact:

Developer tool idea: Notes system

#1 Post by @berration » Mon Feb 28, 2011 1:33 pm

So, while working on development for Errant Heart, I came across this idea for something that I thought would be useful: A notes system.

To give you an idea of what I'm talking about:

Voight-Kampff will create a sort of bare-bones version of the VN, placing the script, along with placeholder backgrounds and sprites into RenPy. As the artist, I'll play through the VN, taking notes and making sketches as I do so…

However, he also likes to put notes in comments—things like what should be in a background, thoughts on what a character should look like, the mood of the music, sound effects, etc. The problem is, I need to go back through the actual code to look at any of this.

So my thought is: Is there some way we can make some sort of Notes system that can be enabled or disabled (for the developer only, of course) that would…well, I'm not sure. Contain a pop-up with comments on the scene? I'm not exactly sure how or where they should appear, since the VN uses both ADV and NVL modes.

Do any of you coding geniuses out there have any ideas on how such a thing could be implemented?
Image

User avatar
Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Developer tool idea: Notes system

#2 Post by Anima » Mon Feb 28, 2011 2:18 pm

You could use a screen for that and give the text as an argument to the screen.
Something like:

Code: Select all

init :
    screen developerNotes:
        default devNote = ""
        text devNote

    python:
        def showdevNote(pNote):
            if config.developer == True:
                renpy.show_screen("developerNotes", devNote = pNote)

# The game starts here.
label start:
    $ showdevNote("Hello World")
The screen should be formatted a bit, but that's the gist of it.
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
PyTom
Ren'Py Creator
Posts: 15454
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:

Re: Developer tool idea: Notes system

#3 Post by PyTom » Mon Feb 28, 2011 2:59 pm

Since characters are really just python functions, you can simplify the use of Anima's code a bit.

Code: Select all

screen developerNotes:
    if devNote:
        window:
            yalign 0.0
            background "#0008"

            text devNote

init python:
    devNote = ""

    def note(s, **kwargs):
        global devNote
        devNote = s

# The game starts here.
label start:
    show screen developerNotes

    note "Perhaps we should have some thunder sound effects here as well."

    "It was a dark and stormy night; the rain fell in torrents..."

    # Hide the note.
    note ""

    "except at occasional intervals, when it was checked by a violent gust of wind which swept up the streets (for it is in London that our scene lies)..."

Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: Developer tool idea: Notes system

#4 Post by SusanTheCat » Mon Feb 28, 2011 3:19 pm

My brain just became evil and now wants to have something that would let you add notes to a screen during the game that are spit out to a log.

/me goes off to figure out how to do this.

Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
rioka
Royal Manga Tutor
Posts: 1255
Joined: Fri Jul 16, 2004 12:21 pm
Completed: Amgine Park, Garden Society: Kykuit, Metropolitan Blues (art)
Location: somewhere in NY
Contact:

Re: Developer tool idea: Notes system

#5 Post by rioka » Mon Feb 28, 2011 5:02 pm

Pretty neat! You can make a director's cut-type game or completely use that as a game play mechanic.

User avatar
Gargargarrick
Newbie
Posts: 17
Joined: Mon Jan 10, 2011 5:28 am
Completed: Across the Night to You
Projects: In The Chaos, Das Minneschwert, Star Gazers
Location: USA
Contact:

Re: Developer tool idea: Notes system

#6 Post by Gargargarrick » Wed Mar 02, 2011 6:27 pm

SusanTheCat wrote:My brain just became evil and now wants to have something that would let you add notes to a screen during the game that are spit out to a log.
Not sure if this is what you want, but there are some Python commands that print strings to plaintext files.

Code: Select all

    $ name = renpy.input("Enter your name.", length=20)
    
    python:
        with open(config.gamedir + "/records/name.txt", 'wb') as fo:
            fo.write(name)
            fo.close()
will put the text entered as "name" into the text file "name.txt" in the "records" directory, for example. (Make sure these both exist.) You have to be careful with whether text is appended to or replaces existing text, but it can be quite handy if you only want to log certain things, as opposed to Ren'Py's usual log function. ^^
Development blog | Home page
The thing to remember is that people can change.

User avatar
@berration
Regular
Posts: 70
Joined: Sun Jul 15, 2007 2:36 pm
Projects: EH...
Contact:

Re: Developer tool idea: Notes system

#7 Post by @berration » Wed Mar 02, 2011 10:01 pm

Finally got a chance to try some of this code out. It'll probably take a little playing around to get something to my liking, but these suggestions give me a good place to start. Thanks!
Image

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: Developer tool idea: Notes system

#8 Post by SusanTheCat » Thu Mar 03, 2011 1:28 pm

Gargargarrick wrote: Not sure if this is what you want, but there are some Python commands that print strings to plaintext files.

Code: Select all

    $ name = renpy.input("Enter your name.", length=20)
    
    python:
        with open(config.gamedir + "/records/name.txt", 'wb') as fo:
            fo.write(name)
            fo.close()
will put the text entered as "name" into the text file "name.txt" in the "records" directory, for example. (Make sure these both exist.) You have to be careful with whether text is appended to or replaces existing text, but it can be quite handy if you only want to log certain things, as opposed to Ren'Py's usual log function. ^^
Cool! Thanks.

I have created some code that puts a button in the top right-hand corner that puts the the word "TYPO" and the file and line number. I can pair that with the code you put and have a snazzy typo indicator. The idea is that when the playtester sees a typo, they can hit the button and the fixer would know exactly where the typo took place!

Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
Greeny
Miko-Class Veteran
Posts: 921
Joined: Sun Dec 20, 2009 10:15 am
Completed: The Loop, The Madness
Projects: In Orbit, TBA
Organization: Gliese Productions
Location: Cantankerous Castle
Contact:

Re: Developer tool idea: Notes system

#9 Post by Greeny » Thu Mar 03, 2011 7:35 pm

Look, let me be honest here. Unless you're prepared to go back in the end and manually delete all these notes, this is going to have a very bad influence on your file size, you'll be sending the end-user a large portion of junk data.

And if you are willing to do manually remove them, you might as well just put these notes into regular say statements.
I also don't see when .txt files got obsolete in this whole story.
In Orbit [WIP] | Gliese is now doing weekly erratic VN reviews! The latest: Halloween Otome!
Gliese Productions | Facebook | Twitter
Image

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: Developer tool idea: Notes system

#10 Post by SusanTheCat » Fri Mar 04, 2011 12:17 am

I've been making "#TODO" comments in my code. Then I can do a quick grep to see what still needs to be done.

The same could be done for the notes. 'Specially if you call them stuff_todo instead of notes. Then it is a simple thing to strip them out and they do their job to let the play testers know that there was supposed to be a sound effect there. (Or whatever)

Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: Developer tool idea: Notes system

#11 Post by SusanTheCat » Sat Mar 05, 2011 8:00 pm

In case anyone is interested, here is my hacked together code.

The purpose is to put it in while developing so that when your play testers encounter a typo or continuity problem, all they have to do is click a button and the file and line number are entered into a file called "comments.txt".

Code: Select all

    init python:

    def log_typo(myType = "TYPO"):    
        try:
            f = file(config.gamedir + "/comments.txt", "a")
            filename, line = renpy.get_filename_line()
            print >>f, myType,filename,line
            f.close()
        except:
            pass
            
    def log_typo_plot(): 
        log_typo("PLOT")

    def button_log_typo():

        ui.vbox(xpos=0.99, ypos=0.02, xanchor='right', yanchor='top')
        ui.textbutton("Typo", xminimum=80, clicked=log_typo)
        ui.textbutton("Plot", xminimum=80, clicked=log_typo_plot)
        ui.close()


    config.window_overlay_functions.append(button_log_typo)
Of course different types of muttons can be added for different purposes. (Sound, pauses, graphics)

Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

Post Reply

Who is online

Users browsing this forum: No registered users