Page 29 of 38

Re: Ren'Py Gripes

Posted: Fri Sep 09, 2016 3:59 pm
by Shakezula
Hi folks :D

I noticed that when you build a game, the python standard library is automatically included in the base folder, but its not available when developing from the launcher. I've decided it wouldn't take any space overhead to just copy it from a temp build to every project's base folder and put in the line config.searchpath.extend(['base\\lib\\pythonlib2.7'] in the init code. Is there a way to import modules from the library thats already inside the actual renpy SDK folder itself, since it's there anyway, and will be automatically included in the build?

Thanks for all you do Tom! :mrgreen:

Re: Ren'Py Gripes

Posted: Fri Sep 09, 2016 6:18 pm
by PyTom
Huh? You should be able to import any module that's included with Ren'Py. (We don't include the whole python library, just the modules we use, and a few more that we think are likely to be used by games.) An import statement will use the copy included with the Ren'Py SDK, even if it's not in the base folder.

Re: Ren'Py Gripes

Posted: Fri Sep 09, 2016 9:17 pm
by Shakezula
hmm.. i get an error when ive tried to use things, like the string module for instance, unless i put init python: import string. am i doing it wrong?

Re: Ren'Py Gripes

Posted: Fri Sep 09, 2016 10:11 pm
by PyTom
No, module imports need to be in an init python block. That's because importing stuff outside those blocks leads to all sorts of problems with saving and loading.

Re: Ren'Py Gripes

Posted: Mon Sep 19, 2016 11:26 am
by Alex
Would it be possible to set the number of times the timer in screen will repeat?

Re: Ren'Py Gripes

Posted: Tue Sep 20, 2016 12:40 am
by Sleepy
I did a thread about the issue (viewtopic.php?f=8&t=40385) but I thought it was worth posting about. Would it be possible to make the quick menu hide when not in dialogue mode, like in the pre-update?

I found without linking quick menu to something like the say screen, the quick menu would show outside the dialogue screens and even during transitions. It's not a game breaker or something unfixable but it's a distracting default.

Re: Ren'Py Gripes

Posted: Wed Oct 05, 2016 5:41 pm
by AXYPB
Imagebuttons with the action Preference("display", "window") only show the selected_idle state when the window size is equal to the config variables that define the defaults. If the window is resized, the button is idle, resulting in both Windowed and Full Screen buttons rendering as unselected. I find that setting the action to a list of [Preference("display", "window"),SelectedIf(not _preferences.fullscreen)] allows a button that sets the display mode to Windowed to present as selected in any circumstance when full screen is not active.

Re: Ren'Py Gripes

Posted: Wed Oct 05, 2016 9:48 pm
by PyTom
You can also just use Preference("display", "any window"). The default size is preferred because it's where the game is expected to be the sharpest.

Re: Ren'Py Gripes

Posted: Mon Dec 19, 2016 7:38 pm
by godot
I can't delete this post and it probably belongs somewhere else so sorry about that.

Re: Ren'Py Gripes

Posted: Fri Dec 23, 2016 11:23 pm
by TaoistFruitbat
I've recently had some headaches with Ren'py overwriting functions when passing keywords to labels.

For example, I have a JRPG-esque battle engine. I define a function to start a battle within Ren'py.

Code: Select all

# File: tern_functions.rpy
# This functions are used only in the renpy script. 

init -19 python:

    def conflict(participants):
            """
            Creates a conflict and moves the player to the conflict label.
            """

            Conflict(participants)
An instance of Conflict stores the data for the current battle, and deals with some battle logic.

Code: Select all

# File: conflict.py
# This is imported to Renpy
 
class Conflict(object):
 
    def __init__(self, actors, player_start=True):
        # Some init code...
 
    def begin_conflict(self):
        """
       Begins the conflict and send us to the conflict screens.
       :return: None
       """
        self.step()
        menus.jump('conflict_start', conflict=self)
The menus.jump is essentially Ren'py's call function in disguise. The conflict_start label looks like

Code: Select all

label conflict_start(conflict):
    
    "Hoi!"

    python:
        menus.s_choice("The conflict starts!")
        conflict.step()
        player.participant.is_in_conflict = True 
        jump('conflict_action_phase', actor=conflict.next_actor(), conflict=conflict)
However, once the code reaches this label conflict, instead of becoming the function in tern_functions.rpy, becomes a object of Conflict once the text "Hoi" displays. It should stay as the function.

If I call the conflict parameter 'con' instead of 'conflict' then the conflict function is not overwritten.

I've tried to mimic this in pure python but couldn't, so I figure label conflict_start(conflict): is somehow setting the conflict function equal to the conflict object I pass into the label.

It's easy enough to avoid this by renaming the conflict function or the conflict keyword in the label. It's just annoying because I must avoid passing labels names that are used as functions. I have a decent amount of functions and a decent amount of parameters to pass into labels. The code reads clearer when I do not have to abbreviate variables to avoid overwriting functions with the same name. Mostly though, I do not expect this to happen and I worry that this will cause people bugs.

(Below is the custom jump code. I doubt it has anything to do with the problem, but I'm putting it here just in case.)

Code: Select all

# File: promenus.py

import renpy.exports as renpy 

class ProMenus(object):

    #init some stuff...

    def jump(self, label, clear_stack=True, add_to_stack=True, *args, **kwargs):
        """
        Jumps to the label.
        :param label: String of the label we are jumping to.
        :param clear_stack: Boolean. If true, clear the stack.
        :param add_to_stack: If true, add the label to the stack. This is done after clearing the stack.
        :param container: If not none, then go the that container's menu.
        :param user: Actor that is doing something. Used with containers
        :return: Label we jumped to. (Return for testing purposes.)
        """

        # Update entire game state.
        self.step()

        # Decide if we clear the menu stack
        if clear_stack:
            self.stack.clear()
        # Add label to stack.
        if add_to_stack:
            self.stack.push(label)

        # Have Ren'py jump to the label. We cannot pass it empty kwargs or args,
        # so we go through many cases.
        if kwargs and args:
            self.renpy.call(label, *args, **kwargs)
        if kwargs:
            self.renpy.call(label, **kwargs)
        if args:
            self.renpy.call(label, *args)
        else:
            self.renpy.call(label)

Re: Ren'Py Gripes

Posted: Tue Dec 27, 2016 11:16 am
by nyaatrap
It would be good if transform also support named spaces, something like

Code: Select all

 transform gui.right:
Because transforms are one of the most frequently used global variables but simple names, so they conflict many times.

Re: Ren'Py Gripes

Posted: Sat Dec 31, 2016 4:21 am
by Imperf3kt
Is there or can we get, some sort of inspector tool?

Sort of like what Google Chrome has for checking the source code of websites.
Image

I ask because I want to be able to click on an image _in the game_, not from a file list in the developer tools, and see exactly why and how it is called, so I can work out how to get rid of it.

Re: Ren'Py Gripes

Posted: Wed Jan 04, 2017 8:01 pm
by gas
Can someone please update the image and sound gallery to fit the new GUI, new functions and 2017 way of things? It's a pain to rewrite everything when I'm asked for.
The button system is quite outdated and having dedicated button styles will be REALLY helpful.

Re: Ren'Py Gripes

Posted: Thu Jan 05, 2017 6:22 pm
by xavimat
Imperf3kt wrote:Is there or can we get, some sort of inspector tool?
Maybe you know those already, but there are more developer options than the developer tools menu:
Shift + E Shows the text editor: https://www.renpy.org/doc/html/develope ... or-support
Shift + I Shows the Style inspector: https://www.renpy.org/doc/html/develope ... inspecting

Re: Ren'Py Gripes

Posted: Sun Jan 08, 2017 5:16 pm
by Caveat Lector
***EDIT: PROBLEM HAS BEEN FIXED, MUCH THANKS TO EBIHIME! JUST DELETE THE GUI.RPY FILE!!!

So, I’ve been having difficulties with programming my project “Colette and Becca”. Morhigan has been helping me out, but we’ve come across a major problem that has left us both stumped. That problem being, the textbox is flipped upside down to go at the top of the screen, instead of at the bottom (and I have tested this out on both my Windows 7 laptop AND Windows 10 desktop—exact same problem on both). However, Morhigan has NOT had this problem with the test build on her computer.

We were both stumped over this for a while, until I went in to test out another one of my projects, The Haunting of Blackbird School, a few days ago. The textbox for that ALSO got flipped to the top of the screen.

And here’s what both of these projects have in common:

I had updated both CaB AND Blackbird to be compatible with the NEW updated version of Renpy! I hadn’t encountered this problem BEFORE the update. I was working with the default old-school Renpy GUI in Blackbird, and Morhigan’s GUI in CaB. So what is the problem?