Plasmashop

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Plasmashop

Postby Jonnee » Sun Jun 14, 2009 10:07 am

Heyho!

Today I wanted to start python scripting for Breldur, but all links to download Plasmashop seem to be dead.
Anyone knows where to get a copy or may send me the .zip-file please?

Thank you, Jonnee 8-)
User avatar
Jonnee
 
Posts: 266
Joined: Fri Nov 16, 2007 9:45 pm

Re: Plasmashop

Postby D'Lanor » Sun Jun 14, 2009 10:35 am

Try UruPython. PlasmaShop's default Python template used to be bugged anyway. I am not sure if it that has been fixed by now.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Plasmashop

Postby Jonnee » Sun Jun 14, 2009 10:50 am

Thanks, I got it.
User avatar
Jonnee
 
Posts: 266
Joined: Fri Nov 16, 2007 9:45 pm

Re: Plasmashop

Postby Zrax » Tue Jul 14, 2009 11:40 am

D'Lanor wrote:Try UruPython. PlasmaShop's default Python template used to be bugged anyway. I am not sure if it that has been fixed by now.


Perhaps it would have been wise to let the author of PlasmaShop know this, rather than assuming it's permanently broken and looking for a new tool ;). In any case, the primary download location of PlasmaShop can be found at the libPlasma forum, under this topic.
User avatar
Zrax
 
Posts: 202
Joined: Fri Sep 28, 2007 5:19 pm
Location: Waist-deep in a conecano

Re: Plasmashop

Postby D'Lanor » Tue Jul 14, 2009 2:29 pm

New tool? UruPython has been around longer than PlasmaShop. And It still beats any other tool in simplicity and ease of use (at least the GUI version which I recommended). :D

btw, the PlasmaShop problem was in the glue section. There have been several posts about it on this forum. At some point PlasmaShop seemed to get overzealous with its tuple correction and tried to write elif (type(obj) == type((,))): instead of elif (type(obj) == type(())): which caused a syntax error.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Plasmashop

Postby Tsar Hoikas » Tue Jul 14, 2009 3:34 pm

D'Lanor wrote:New tool? UruPython has been around longer than PlasmaShop. And It still beats any other tool in simplicity and ease of use (at least the GUI version which I recommended). :D


I'm pretty sure Zrax meant the "different" new rather than "newer" new.
Image
User avatar
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 1838
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasmashop

Postby Zrax » Tue Jul 14, 2009 4:42 pm

Tsar Hoikas wrote:I'm pretty sure Zrax meant the "different" new rather than "newer" new.

That's correct, sorry for the confusion...

Regarding the tuple bug, I do remember noticing this problem, but I honestly don't remember if I ever did anything about it... The problem is that decompyle itself, in its initial distribution, would never put a comma at the end of a tuple. What this means is that lines like mySDL['blah'] = (0) would in fact assign an 'int' to the SDL variable (rather than a tuple like mySDL['blah'] = (0,) would do), which causes Uru to completely ignore the assignment altogether. I'm not completely sure (so correct me if I'm wrong), but I believe UruPython has the exact same behavior, and will therefore also cause this silent bug. When I discovered this, I went into the code and changed it to always put the comma -- however, as you point out, this means that empty tuples show up as '(,)', which is a syntax error. It's still a bug, but at least the latter is a more noticeable one, since it actually shows up at compile time. I'll go ahead and check what the current version does, and see if I can fix it without going too crazy :P.

EDIT: Turns out the bug was easier to fix than I thought... So a new release of PlasmaShop 2.x is now available with this tuple bug fixed. Thanks!
Last edited by Zrax on Tue Jul 14, 2009 5:07 pm, edited 1 time in total.
User avatar
Zrax
 
Posts: 202
Joined: Fri Sep 28, 2007 5:19 pm
Location: Waist-deep in a conecano

Re: Plasmashop

Postby D'Lanor » Tue Jul 14, 2009 5:04 pm

Nope. UruPython does it correct.

In the decompyle Walker.py module there is an n_build_list function which looks like this:

Code: Select all
    def n_build_list(self, node):
        """
        prettyprint a list or tuple
        """
        lastnode = node.pop().type
        if lastnode.startswith('BUILD_LIST'):
            self.write('['); endchar = ']'
        elif lastnode.startswith('BUILD_TUPLE'):
            self.write('('); endchar = ')'
        else:
            raise 'Internal Error: n_build_list expects list or tuple'
       
        self.indentMore(INDENT_PER_LEVEL)
        line_seperator = ',\n' + self.indent
        sep = INDENT_PER_LEVEL[:-1]
        for elem in node:
            assert elem == 'expr'
            value = self.traverse(elem)
            self.write(sep, value)
            sep = line_seperator
        self.write(endchar)
        self.indentLess(INDENT_PER_LEVEL)
        self.prune()


And this is the fix by Anonymous54321:

Code: Select all
    def n_build_list(self, node):
        """
        prettyprint a list or tuple
        """
        isTuple = 0
        lastnode = node.pop().type
        if lastnode.startswith('BUILD_LIST'):
            self.write('['); endchar = ']'
        elif lastnode.startswith('BUILD_TUPLE'):
            self.write('('); endchar = ')'
            isTuple = 1
        else:
            raise 'Internal Error: n_build_list expects list or tuple'
       
        self.indentMore(INDENT_PER_LEVEL)
        line_seperator = ',\n' + self.indent
        sep = INDENT_PER_LEVEL[:-1]

        count = 0

        for elem in node:
            assert elem == 'expr'
            value = self.traverse(elem)
            self.write(sep, value)
            sep = line_seperator
            count = count + 1

        if ((isTuple == 1) & (count == 1)):
            self.write(',')
 
        self.write(endchar)
        self.indentLess(INDENT_PER_LEVEL)
        self.prune()
Last edited by D'Lanor on Tue Jul 14, 2009 5:09 pm, edited 1 time in total.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Plasmashop

Postby Zrax » Tue Jul 14, 2009 5:09 pm

Oops, you were too fast -- I just released a fix of my own... I had a slightly different solution which just tests the size of the tuple, and only uses a comma if the size is 1:

Either way, the fixed version is now available at the usual download location...

Code: Select all
        lastnode = node.pop().type
        if lastnode.startswith('BUILD_LIST'):
            self.write('['); endchar = ']'
        elif lastnode.startswith('BUILD_TUPLE'):
            self.write('(')
            if len(node) == 1:
                endchar = ',)'
            else:
                endchar = ')'
        else:
            raise 'Internal Error: n_build_list expects list or tuple'
User avatar
Zrax
 
Posts: 202
Joined: Fri Sep 28, 2007 5:19 pm
Location: Waist-deep in a conecano

Re: Plasmashop

Postby diafero » Wed Jul 15, 2009 6:34 am

UruPython also has a bug btw (at least when used in wine): For example, if I have a file called "Jalak.py" and one called "JalakJournals.py", it will not show the first in the list of files to select for inclusion in the pak. However, if you hit "Cancel" in the pack dialogue and open it again (so that it selects all the files), it will correctly select such a file, too.
Regarding PlasmaShop, I could never got it to decompyle an unpacked file for me.
For packing I now have a script which is adapted to my needs, and independant of wine :D (it requires an installation of Python 2.2, but lucky enough the old sources can still be compiled on current systems).
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2803
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron