CensoredUsername / unrpyc

A ren'py script decompiler
Other
864 stars 157 forks source link

Some statements missing when decompiling screens #19

Closed jackmcbarn closed 9 years ago

jackmcbarn commented 9 years ago

Minimal test case:

screen testScreen():
    modal False
    imagemap:
        if 1 + 1 == 2:
            auto "true%s.png"
        else:
            auto "false%s.png"

When compiled and then decompiled, this is the result:

screen testScreen():
    modal False
    imagemap:
        if 1 + 1 == 2:
        else:

Here's the relevant piece of the dump:

<renpy.sl2.slast.SLIf
    .entries = [
        (
            u'1 + 1 == 2',
            <renpy.sl2.slast.SLBlock
                .children = [],
                .keyword = [(
                    u'auto',
                    u'"true%s.png"'
                )],
                .location = (
                    u'game/good.rpy',
                    4
                ),
                .serial = 255
            >
        ),
        ( 
            None,
            <renpy.sl2.slast.SLBlock
                .children = [],
                .keyword = [(
                    u'auto',
                    u'"false%s.png"'
                )],
                .location = (
                    u'game/good.rpy',
                    6
                ),
                .serial = 256
            >
        )
    ],
    .location = (
        u'game/good.rpy',
        4
    ),
    .serial = 254
>
CensoredUsername commented 9 years ago

I was not aware that the if statement could contain keyword arguments for the surrounding statement. Thanks for the dump, that was very helpful.