Kirel MOUL and Guild Shirts

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.

Kirel MOUL and Guild Shirts

Postby Sirius » Fri Dec 03, 2010 9:36 am

I am trying to have the Kirel guild shirt system on my offline CC.
I edited the xTakableClothing.py to have it working.

But it seems there is something strange, because it doesn't work, and when I check the "Python0.elf" file, I see this line:
KeyError: Age Global SDL for KirelMOUL does not exist!

I checked, my SDL file is here, the VeryVerySpecialPythonFileMod points to the good SDL file, I have the KirelMOUL Python file in my CC folder (I don't think it can cause a bug) ; but both in the non-converted Kirel file and the converted, the sceneobject "AgeSDLHook" is replaced by "kirelAgeSDLHook". I added a new sceneobject with the regular name, and added it to the scenenode, but still have the same error. Any ideas ?
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Kirel MOUL and Guild Shirts

Postby diafero » Mon Dec 06, 2010 10:52 am

Actually, the shirts should work after converting with Drizzle and installing the latest Offline KI. Without any further modification. Don't they?
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: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Kirel MOUL and Guild Shirts

Postby Sirius » Tue Dec 07, 2010 11:25 am

Oh, they are, don't worry ! That's not a problem with Drizzle.
I just want to have the shirt/guild system, that allows you to take only one of the T-shirts and only one link in Nexus.

But the only problem is that my SDL for KirelMOUL isn't found and it causes a problem with the python file, even if it shouldn't. That's not really amazing, my CC install is such a mess ! :lol: But that's still weird as everything should work fine, and the problem of the game is only to locate the SDL. I'll try again.

diafero wrote:Without any further modification.

Maybe I should simply stop tweaking every files... :roll:
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Kirel MOUL and Guild Shirts

Postby diafero » Tue Dec 07, 2010 12:54 pm

I did not mean Drizzle either (which does not have a direct in-game part), but the Offline KI. Two distinct projects by different authors, that do admittedly work hand-in-hand, so many confuse it :)

Now, for your issue... where is that code run? The most common pitfall for this is to access the age SDL in OnFirstUpdate, which will only work for python file mods of pages that are paged in after the age loading completed. For "normal" pages (i.e. no ",1" in the age file), SDL is not yet initialized in OnFirstUpdate. Such work has to be done in OnServerInitComplete (which, in turn, is not called at all for pages paged in later... yes, it's such a mess).
Also, another question: Why don't you just copy the original MOUL Python files for this? Or is that what you are attempting to do?
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: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Kirel MOUL and Guild Shirts

Postby Sirius » Wed Dec 08, 2010 6:32 am

I thought the SDL file was loaded by the PRP and not by the Age Python file. That's why I talked about Drizzle more than the Offline-Ki.

And I don't really like to copy/paste the MOULa file because sometimes there are some compatibility problem (xLocalisation) or CC options/OfflineKi bugfix. But I took some lines from MOULa to do it, of course.


Anyway, I found what was wrong thanks to you.
Here is a part of the log.

Show Spoiler


"ImportError: cannot import name UpdateRecentVisitors". That was the problem. I kept the neighborhood "def UpdateRecentVisitors" in "nb01EmgrPhase0.py", and the Offline KI changes the "def UpdateRecentVisitors" from KirelMOUL (to import the one of Bevin), AS WELL AS the "nb01EmgrPhase0.py". And as I have this error, the "KirelMOUL.py" is skipped, right ?

I modified the python file. Whooo-hooo, it works ! The imager and the SDL !
I still have a clothing problem, but it should be easy to fix. Some kind of "'ptSimpleStateVariable' object has no attribute 'getKey'".

Thanks Diafero ! :D
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Kirel MOUL and Guild Shirts

Postby diafero » Wed Dec 08, 2010 10:57 am

I thought the SDL file was loaded by the PRP and not by the Age Python file. That's why I talked about Drizzle more than the Offline-Ki.
The age SDL load is connected with that "VeryVerySpecialPythonFileMod" in some weird ways, including, but not limited to, black magic and unicorns. I figured it out enough to get age SDL state management working on Alcugs (which was not that much, just some weird IDs and flags that had to be just right). At any rate, "OnFirstUpdate" is triggered when the page was loaded completely - but the game loads the page *before* it requests their state from the server (since it needs to know how the page look like to apply it's state). After all pages are loaded, the client asks the server for the "initial age state", and the server replies with tons of messages, the first one containing the total number of sates. After the last one is received, OnServerInitComplete is triggered. For that reason, there is no age SDL when OnFirstUpdate runs.
If however you call PtPageInNodes within a python script, the page loading is done after that initial age state was sent, and the message sent to the server to get their state is slightly different. Most importantly, OnServerInitComplete will not be triggered again for the same age, so it will never be triggered at all for PythonFileMods associated with a dynamic page.

I mentioned Drizzle because you said it was not a Drizzle problem in reply to my original post, which however was about Python stuff ;-) . For SDL to work, Drizzle has to get the PRP converted correctly (including the renaming, I remember some weird problems in the beginning with age states of renamed ages being totally broken, but only when playing online...). However, Offline KI brings the actual KirelMOUL.sdl and KirelMOUL.py files, both of which are necessary to make SDL work.

Glad to see you got it figured out! Opening the log and searching for "Error" is the very first thing to do if your Python script does not what it is supposed to do :)
And yes, I modified the visitor loggers a lot, because neither the original POTS nor the MOUL one worked well enough in Alcugs. Not to mention that the same code could be found in like 4 different locations (for each age that had a logger), so I unified it to have one change fix them all :D
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: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Kirel MOUL and Guild Shirts

Postby Sirius » Wed Dec 08, 2010 12:57 pm

Ok, thanks !
That's right the way SDL files are loaded is not really obvious...
diafero wrote:If however you call PtPageInNodes within a python script, the page loading is done after that initial age state was sent, and the message sent to the server to get their state is slightly different. Most importantly, OnServerInitComplete will not be triggered again for the same age, so it will never be triggered at all for PythonFileMods associated with a dynamic page.

Yes, played a lot with /loadpage and the Hood Garrison sub Age.

diafero wrote:Glad to see you got it figured out! Opening the log and searching for "Error" is the very first thing to do if your Python script does not what it is supposed to do :)

Hehe - that was the first time I used it. Will be a lot better for next Python modifs.
Just a problem with this right now:
Code: Select all
varKey = varnode.getKey()
varName = varKey.getName()
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Kirel MOUL and Guild Shirts

Postby diafero » Wed Dec 08, 2010 2:16 pm

What kind of problem?
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: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Kirel MOUL and Guild Shirts

Postby Sirius » Thu Dec 23, 2010 10:26 am

Sorry, didn't see your last post :) but now I have to answer it either... sorry for bringing back this thread.

So, when I click on the shirt, nothing happens. I don't wear it and it isn't added to my closet. For the Nexus... Well, I should better not talk about it as I can't even make it work as in MOUL.

The log:
Code: Select all
Tint 1 is (1.0,1.0,1.0)
Tint 2 is (1.0,1.0,1.0)
xTakableClothing: getAvatarClosetFolder Type = 22
xTakableClothing: getAvatarClosetFolder Child Node Count = 2
xTakableClothing: Child Node Node ID
xTakableClothing: getStateDataRecord().getName(): clothingItem
Traceback (most recent call last):
File "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\tmp495.tmp\xTakableClothing.py", line 322, in OnNotify
File "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\tmp495.tmp\xTakableClothing.py", line 254, in IRemoveOtherGuildShirt
AttributeError: 'ptSimpleStateVariable' object has no attribute 'getKey'


The line 322 is just where the def IRemoveOtherGuildShirt is used.
Line 254: "varKey = varnode.getKey()"
The "varnode" corresponds to: "varnode = rec.findVar(var)", where "rec" is "rec = SDLNode.getStateDataRecord()", SDLNode is "SDLNode = childNode.upcastToSDLNode()", "childNode = folderChild.getChild()" and I didn't found anything about "folderChild".
Here is the IRemoveOtherGuildShirts:
Code: Select all
        playerCNode = ptVault().getAvatarClosetFolder()
        print ('xTakableClothing: getAvatarClosetFolder Type = ' + str(playerCNode.getType()))
        print ('xTakableClothing: getAvatarClosetFolder Child Node Count = ' + str(playerCNode.getChildNodeCount()))
        if (playerCNode.getChildNodeCount() > 0):
            playerCNodeList = playerCNode.getChildNodeRefList()
            for folderChild in playerCNodeList:
                PtDebugPrint(('xTakableClothing: looking at child node ' + str(folderChild)), level=kDebugDumpLevel)
                childNode = folderChild.getChild()
                if (childNode != type(None)):
                    print 'xTakableClothing: Child Node Node ID'
                    SDLNode = childNode.upcastToSDLNode()
                    if (type(SDLNode) != type(None)):
                        rec = SDLNode.getStateDataRecord()
                        print ('xTakableClothing: getStateDataRecord().getName(): ' + str(rec.getName()))
                        SDLVarList = rec.getVarList()
                        for var in SDLVarList:
                            varnode = rec.findVar(var)
                            if varnode:
                                if (varnode.getType() == 4):
                                    varKey = varnode.getKey()
                                    varName = varKey.getName()
                                    print 'xTakableClothing: VarNode.getName(): ',
                                    print varName
                                    if ((varName.find('Torso_GuildBlue') != -1) or ((varName.find('Torso_GuildGreen') != -1) or ((varName.find('Torso_GuildRed') != -1) or ((varName.find('Torso_GuildYellow') != -1) or (varName.find('Torso_GuildWhite') != -1))))):
                                        print 'xTakableClothing: Found Other Guild Shirt. Deleting Old Guild Shirt.'
                                        if playerCNode.removeNode(childNode):
                                            print 'xTakableClothing: Delete was a success.'
                                        else:
                                            print 'xTakableClothing: Delete failed.'
                                        return

(The whole script can be found in Moula's xTakableClothing.py).

Do you know what is the problem ?
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Kirel MOUL and Guild Shirts

Postby diafero » Thu Dec 23, 2010 1:27 pm

It looks to me like this function got added in MOUL and does not exist in POTS. But, do I see that correctly that varKey is not used at all? In that case you can simply comment that line out.

Btw, folderChild is introduced by this line
Code: Select all
for folderChild in playerCNodeList:

Which means something like "iterate over all elements of playerCNodeList, and within the loop, call the current element folderChild". If this was an array, the Java code could be
Code: Select all
for (int i = 0; i < playerCNodeList.length; ++i) {
    folderChild = playerCNodeList[i];
    <loop code>
}
(sorry if this is even more confusing, I do not know how much programming knowledge you have :D ).
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: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Next

Return to Plasma Development

Who is online

Users browsing this forum: No registered users and 2 guests