Plasmashop and Broken URU

Announcements and discussion regarding any projects related to Cyan Worlds' Plasma Engine including (but not limited to) CyanWorlds.com Engine, Drizzle, OfflineKI, PyPRP, and libHSPlasma.

Plasmashop and Broken URU

Postby ZURI » Wed Feb 02, 2011 6:59 pm

This evening, I used Andy's tutorial to create a linking book. I did my best to do it just as the tutorial states, but now have a bit of a problem.

After following through all the steps, I went to compile the pak and recieved an error that stated: RuntimeError: Bad magic number in .pyc file

I searched here in these threads and found someone else who had the same problem, which was due to a syntax error. I went back through and double checked everything that I had edited - but didn't find anything. After searching some more, I found a thread where someone was unable to compile their pak in Plasmashop, but could with URUPython. So, why not? I gave it a shot.

URUPython originally gave me an error stating that this line was improperly formatted:

class *yourage*GUI(ptModifier,):

The tutorial did not say to change this line, so I had left it alone. However, when I changed it to: class TaygahnBookGUI(ptModifier,): - it exported without error.
---
Here's where it gets good. When I start up URU to see if the linking book is working correctly, I reach relto without a KI. The age itself is also different (for example, the pillars are all up and the door is shut). When I jump off the cliff to re-link inside the hut, I cannot click on any of the books - the bookshelf is also now completely full. (Which is different, since I'm using a vanilla installation.) All I had in my relto are the books that were there upon the very first link.

What's going on here? I was trying to make a linking book and now I'm probably looking at doing a fresh installation. I tried deleting all of the files I had created, but when I go into the game, it's busted. Anyone have any thoughts why this could have happened?

It's a lot of code, but I could paste it here if it would help.
MOULagain KI: 45001
User avatar
ZURI
 
Posts: 366
Joined: Mon Nov 16, 2009 8:34 pm
Location: Cincinnati

Re: Plasmashop and Broken URU

Postby GPNMilano » Wed Feb 02, 2011 7:54 pm

My guess is that you compiled your python file into the main Python pak, and not it's own pak correct?
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: Plasmashop and Broken URU

Postby Tsar Hoikas » Wed Feb 02, 2011 8:00 pm

Posting your Python.0.elf log file would be most helpful in figuring out what went wrong. ;)
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasmashop and Broken URU

Postby ZURI » Wed Feb 02, 2011 8:32 pm

@Chloe... knowing me, it's quite possible. However, I do remember naming it Yedahna... But, now that I think of it, I may not have chosen the file type as .pak. Honestly, I was so flustered after mucking through the tutorial that I was probably mashing buttons. :evil: Python and I aren't exactly on the best of terms...

@Hoikas. I'm afraid it's too late to know, if you need that file. I immediately backed everything up, nuked URU and reinstalled. I'm already drizzled and back in business. Hmm,.. perhaps I shouldn't have been so hasty. It would be interesting to know what you could have read from that file.

@Chloe, I didn't think about restoring the /Python/ dir (I make regular backups), and seeing if that would've worked. I restored the /dat/ directory, but it still was acting....weird. I figured it was getting a reinstall sooner or later - and have work to do, so...
MOULagain KI: 45001
User avatar
ZURI
 
Posts: 366
Joined: Mon Nov 16, 2009 8:34 pm
Location: Cincinnati

Re: Plasmashop and Broken URU

Postby Luna » Thu Feb 03, 2011 1:32 am

I actually had the same problem once, and I think you packed your files in the wrong .pak. Easy mistake, irritating consequences ;)

But I'm interested in whether you succeed in getting the journal up in the end, I just quit trying in the end.
Code: Select all
long longestTimeWithoutPlayingMoula = (new Date()) - (new Date(2014, 9, 26));
User avatar
Luna
 
Posts: 204
Joined: Fri Oct 08, 2010 12:21 am
Location: Il y a encore des pommes.

Re: Plasmashop and Broken URU

Postby Egon » Thu Feb 03, 2011 2:25 am

ZURI wrote:class *yourage*GUI(ptModifier,):

The tutorial did not say to change this line, so I had left it alone.


Well kind of yeah, but the template it self state it quite clear on the beginning of the code:
For each occurance of *YourAge* you have to replace this with the actual name of your age.
Egon #2052375
Who You gonna call? Guild of Doorcallers! #5356672
Eder Tsogal/Delin Marathon
Image
User avatar
Egon
 
Posts: 284
Joined: Fri Nov 16, 2007 9:45 pm

Re: Plasmashop and Broken URU

Postby ZURI » Thu Feb 03, 2011 6:30 am

@Luna. No, it never did work. After doing a fresh install of URUCC, remaking the Pak file, reinstalling/updating drizzle, etc., it no longer makes the game crazy - but the linking book still doesn't work. It was getting late, and my bloodpressure was reaching the /stroke/ level - so I had to get away from it. I swear I was seeing red... I can't speak for you folks, but I'd almost hurt something - to have a GUI based plugin for things like this.... /me is dreaming of buttons, not lines of code written in martian.....

However, I will revisit it tomorrow.

@Egon. I don't know what it is with Python and I. I've sat through some very complicated /and boring/ Blender tutorials - and have always managed to make them work. Even at first, when just starting out - I was always able to muddle through. But, geeze, this coding part has me pulling my hair out. It just seems so overly complicated (mostly likely it's just a matter of getting my mind around it.) I tried paying attention all of D'lanor's notes - but apparantly I failed miserably.

I remember seeing a python manual link in another thread. I willl make an honest attempt to go through it and learn as much as I can. Lately, I've been having a tremendous amount of trouble with adding /extras/ to my Ages.

----

However, it no longer makes URU freak out.... so I may (haha, remind myself of Custer here) try giving it another shot. I probably just missed an obscure bit of coding somewhere. Does anyone know of a blend file with a linking book already in it that I could have a look at? I'm thinking part of my problem is the physical linking book itself. Am I supposed to make the whole book the clickable, or just the picture?

I used a separate plane for the clickable (yes, all names in the python files are relative to the appropriate objects.) If this isn't a good enough explaination of my question, I will snap some screens this evening after work.
MOULagain KI: 45001
User avatar
ZURI
 
Posts: 366
Joined: Mon Nov 16, 2009 8:34 pm
Location: Cincinnati

Re: Plasmashop and Broken URU

Postby Corvus » Thu Feb 03, 2011 8:13 am

I understand your feelings very well. I was very often (and still am sometimes) at a point where I would like to destroy something. :lol:

Do you know the Chain letter age Relltoo? It has a linking book and you can find the age files and the project files here to download:
Chain letter age

The age contains lots of stuff that might be helpful in your learning process.

You can download the age itself with Drizzle, makes it easier. :)
"To regard the imagination as metaphysics is to think of it as part of life, and to think of it as part of life is to realize the extent of artifice. We live in the mind."

-Wallace Stevens-
User avatar
Corvus
 
Posts: 204
Joined: Fri Feb 15, 2008 11:21 am
Location: Germany

Re: Plasmashop and Broken URU

Postby ZURI » Thu Feb 03, 2011 10:11 am

Thank you Corvus.:) I will download it and look at it. Mostly likely I'm making noob mistakes here. Thanks for the link!
MOULagain KI: 45001
User avatar
ZURI
 
Posts: 366
Joined: Mon Nov 16, 2009 8:34 pm
Location: Cincinnati

Re: Plasmashop and Broken URU

Postby andylegate » Thu Feb 03, 2011 10:16 am

Even with Cyan's plugin and Max being a "GUI Button" type of plugin, if you want popup linking books, we still have to deal with Python. There is no getting around that part.

D'Lanor's templates are good, but you still have to edit things within it, especially since he put examples in the template for people to see. I've had some people leave his example stuff in there and have problems.

I've tried to make my tutorials as simple as possible (not because I think everyone out there is dumb or anything like that, but because I know what it's like to have someone explain something, and not understand a word of what they just said). But there is no getting around having to learn your way around using things like PlasmaShop or UruPython. No one gets it right the first time (even today, if I make a linking book, something goes wrong the first time: it doesn't pop up, or the cover is wrong, or the linking panel looks wrong, or I linked to Dallas, Texas instead of Candy Island).

If you are getting that frustrated: stop. Take a break. Get up and unplug. Go fix a sandwich, chase the cat, watch some TV, or just something to take your mind off of it for a while. Then come back later and try again, and / or ask questions here.

There are some important things to keep in mind when you are messing with Python:

NEVER should you EVER repack the Python.pak file that is in your game install. Ever.

ALWAYS make a .pak file with your Age's name. THAT is what you will be packing and unpacking.

ALWAYS make a python file that is your "Dummy" python file for your Age. It will have the same name as your Age, but there won't be much in it. It will look like this:

[spoiler]
Code: Select all
from Plasma import *
from PlasmaTypes import *
class CandyIsland(ptResponder,):
    __module__ = __name__

    def __init__(self):
        ptResponder.__init__(self)
        self.id = 6000
        self.version = 1



    def OnFirstUpdate(self):
        pass


    def OnServerInitComplete(self):
        pass


    def OnNotify(self, state, id, events):
        pass


    def OnSDLNotify(self, VARname, SDLname, playerID, tag):
        pass


glue_cl = None
glue_inst = None
glue_params = None
glue_paramKeys = None
try:
    x = glue_verbose
except NameError:
    glue_verbose = 0

def glue_getClass():
    global glue_cl
    if (glue_cl == None):
        try:
            cl = eval(glue_name)
            if issubclass(cl, ptModifier):
                glue_cl = cl
            elif glue_verbose:
                print ('Class %s is not derived from modifier' % cl.__name__)
        except NameError:
            if glue_verbose:
                try:
                    print ('Could not find class %s' % glue_name)
                except NameError:
                    print 'Filename/classname not set!'
    return glue_cl



def glue_getInst():
    global glue_inst
    if (type(glue_inst) == type(None)):
        cl = glue_getClass()
        if (cl != None):
            glue_inst = cl()
    return glue_inst



def glue_delInst():
    global glue_inst
    global glue_cl
    global glue_paramKeys
    global glue_params
    if (type(glue_inst) != type(None)):
        del glue_inst
    glue_cl = None
    glue_params = None
    glue_paramKeys = None



def glue_getVersion():
    inst = glue_getInst()
    ver = inst.version
    glue_delInst()
    return ver



def glue_findAndAddAttribs(obj, glue_params):
    if isinstance(obj, ptAttribute):
        if glue_params.has_key(obj.id):
            if glue_verbose:
                print 'WARNING: Duplicate attribute ids!'
                print ('%s has id %d which is already defined in %s' % (obj.name,
                 obj.id,
                 glue_params[obj.id].name))
        else:
            glue_params[obj.id] = obj
    elif (type(obj) == type([])):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type({})):
        for o in obj.values():
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type(())):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)




def glue_getParamDict():
    global glue_paramKeys
    global glue_params
    if (type(glue_params) == type(None)):
        glue_params = {}
        gd = globals()
        for obj in gd.values():
            glue_findAndAddAttribs(obj, glue_params)

        glue_paramKeys = glue_params.keys()
        glue_paramKeys.sort()
        glue_paramKeys.reverse()
    return glue_params



def glue_getClassName():
    cl = glue_getClass()
    if (cl != None):
        return cl.__name__
    if glue_verbose:
        print ('Class not found in %s.py' % glue_name)
    return None



def glue_getBlockID():
    inst = glue_getInst()
    if (inst != None):
        return inst.id
    if glue_verbose:
        print ('Instance could not be created in %s.py' % glue_name)
    return None



def glue_getNumParams():
    pd = glue_getParamDict()
    if (pd != None):
        return len(pd)
    if glue_verbose:
        print ('No attributes found in %s.py' % glue_name)
    return 0



def glue_getParam(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getdef()
            else:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getdef()
            elif glue_verbose:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None



def glue_setParam(id, value):
    pd = glue_getParamDict()
    if (pd != None):
        if pd.has_key(id):
            try:
                pd[id].__setvalue__(value)
            except AttributeError:
                if isinstance(pd[id], ptAttributeList):
                    try:
                        if (type(pd[id].value) != type([])):
                            pd[id].value = []
                    except AttributeError:
                        pd[id].value = []
                    pd[id].value.append(value)
                else:
                    pd[id].value = value
        elif glue_verbose:
            print "setParam: can't find id=",
            print id
    else:
        print 'setParma: Something terribly has gone wrong. Head for the cover.'



def glue_isNamedAttribute(id):
    pd = glue_getParamDict()
    if (pd != None):
        try:
            if isinstance(pd[id], ptAttribNamedActivator):
                return 1
            if isinstance(pd[id], ptAttribNamedResponder):
                return 2
        except KeyError:
            if glue_verbose:
                print ('Could not find id=%d attribute' % id)
    return 0



def glue_isMultiModifier():
    inst = glue_getInst()
    if isinstance(inst, ptMultiModifier):
        return 1
    return 0



def glue_getVisInfo(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getVisInfo()
            else:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getVisInfo()
            elif glue_verbose:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None

[/spoiler]

Back at the top of it, you see where it says "class CandyIsland(ptResponder,):", you change it to be the name of you Age (so instead of CandyIsland, you'd put your Age name), and just below that you'll see where it says "self.id=6000", You need to put a unique number there (it's like a serial number). I always use the sequence number of my Age.

You MUST have that file in your .pak file. If you don't: Your linking books and journals WILL NOT WORK. You need it for other things too.

If you can remember those things, it will help you a lot (and keep you from having strange and wacky things going on in your game).
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Next

Return to Plasma Development

Who is online

Users browsing this forum: No registered users and 32 guests