Page 1 of 1

New developer mode?

Posted: Thu Mar 31, 2011 9:30 am
by Voight-Kampff
Just thinking out loud, wondering if there might be some way to solve one of my own annoying dilemas in developing a rather lengthy game.

Is there, or could there be some way to turn on a "developer mode" that would allow one to access a special menu that would list all individual scenes in a game?

I'm currently using "label" to separate scenes. And it'd be nice if Ren'Py could evaluate all of those entries and allow me to load any one that I choose, at any point, so I could test code changes in that particular scene - rather than try to find an old saved game that MIGHT be located somewhere near the scene that I need to test.

Re: New developer mode?

Posted: Thu Mar 31, 2011 9:52 am
by PyTom
The problem with jumping to an arbitrary label is that it only sometimes works. Jumping to an arbitrary label can fail if:

- The label isn't immediately followed by a scene statement. (Or in general, if it inherits the scene from a previous part of the program.)
- The game stores state in variables. These variables won't be set up at the time of the jump.

Ren'Py's warp system - which hasn't been used/promoted in quite some time, but seems to still work - tries to solve the first problem by going back to a previous scene statement from the line that is warped to. You can invoke warp using a command line like:

Code: Select all

renpy.exe tutorial/ --warp tutorial_sprite.rpy:80
I think the most common way people have done this is to put together a secret menu, which lets them jump to an appropriate part of the game. This secret menu can also set up variables as necessary, so you might be able to make it through the rest of the game.

That being said, the ability to force a jump to a label isn't a horrible thing to have - if people think it will be useful despite the potential problems, I'll add it.

Re: New developer mode?

Posted: Thu Mar 31, 2011 10:05 am
by Aleema
I ... am ... going to second this proposal? I find myself making my own label directory for every one of my games, and if there was some way to do this, even with variables botched (these often don't matter if I'm just checking scripting with my SHIFT+R handy). I'm even a-ok with getting a blank screen if it inherited an image before it. That's something I knew when I made it a separate label and then linked to it.

I do the "secret menu" PyTom recommends, but I do it for every game, so I think a request for something like this seems as important to development as other things on the To Do list.

Re: New developer mode?

Posted: Sun Apr 10, 2011 10:14 am
by Spiky Caterpillar
IIRC, there's already a command to get a list of all the labels in the game, so something like (pseudocode)

Code: Select all

     all_labels = renpy.labels() # I don't remember the real command.
     ui.vbox()
     for lbl in all_labels:
          ui.textbutton(lbl,clicked=ui.jumps(lbl))
     ui.close()
inside a scrolling pane is possible. (A bit impractical for any long project, though. Pagination, sorting, and filtration are left as an exercise for the implementor. If I were doing it, I'd have a text widget you can type partial label names into, and limit the buttons shown to only those containing whatever you've typed.)