Plasma Python API

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

Re: Plasma Python API

Postby Agenotfound » Tue Apr 13, 2010 4:02 pm

it seems that the pyhton code released by chogon with the KI max file contains a description of every python function that might help to fix the gaps !
Image
User avatar
Agenotfound
 
Posts: 189
Joined: Mon Jun 29, 2009 7:15 am

Re: Plasma Python API

Postby Tsar Hoikas » Tue Apr 13, 2010 4:12 pm

It's the same thing.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby Agenotfound » Tue Apr 13, 2010 4:27 pm

what do you mean? the files are the same or the descriptions are the same ?
Image
User avatar
Agenotfound
 
Posts: 189
Joined: Mon Jun 29, 2009 7:15 am

Re: Plasma Python API

Postby Tsar Hoikas » Tue Apr 13, 2010 4:43 pm

The descriptions are the same. They are called docstrings, and that is what dir() returns when called on python functions/classes/etc
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby Agenotfound » Tue Apr 13, 2010 4:55 pm

what I meant was that there is now a written description (in english) of the functions.

I know we are not supposed to post code from Cyan here but as they released it ... (edit my post if this is still wrong..)

this is what we had until now

(first lines of Plasma.py)
Code: Select all
# emacs-mode: -*- python-*-

def PtAcceptInviteInGame(friendName, inviteKey):
    pass


def PtAmCCR():
    pass


def PtAtTimeCallback(selfkey, time, id):
    pass


def PtAttachObject(child, parent):
    pass


def PtAvatarEnterAFK():
    pass


def PtAvatarEnterLookingAtKI():
    pass


first line of Chogon's Plasma.py
Code: Select all
def PtAcceptInviteInGame(friendName,inviteKey):
    """Sends a VaultTask to the server to perform the invite"""
    pass

def PtAmCCR():
    """Returns true if local player is a CCR"""
    pass

def PtAtTimeCallback(selfkey,time,id):
    """This will create a timer callback that will call OnTimer when complete
- 'selfkey' is the ptKey of the PythonFile component
- 'time' is how much time from now (in seconds) to call back
- 'id' is an integer id that will be returned in the OnTimer call"""
    pass

def PtAttachObject(child,parent):
    """Attach child to parent based on ptKey or ptSceneobject
- childKey is the ptKey or ptSceneobject of the one being attached
- parentKey is the ptKey or ptSceneobject of the one being attached to
(both arguments must be ptKeys or ptSceneobjects, you cannot mix types)"""
    pass

def PtAvatarEnterAFK():
    """Tells the local avatar to enter AwayFromKeyboard idle loop (netpropagated)"""
    pass


so I was thinking this could help fill the gaps that remains concerning the exact use of some functions.
Image
User avatar
Agenotfound
 
Posts: 189
Joined: Mon Jun 29, 2009 7:15 am

Re: Plasma Python API

Postby Tsar Hoikas » Tue Apr 13, 2010 5:25 pm

You're missing my point. The wiki page and the new Plasma.py file contain the same information (the gaps you speak of are already filled); the wiki page is much more compact however. Except for MOUL specific functions, but those are not applicable at this point.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby Grogyan » Wed Apr 14, 2010 12:09 am

I think what he was meaning is that the comments for the source code are there as opposed to there being no comments when decompiling the code from the pak.

Not that there is anything you didn't know already.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Plasma Python API

Postby Tsar Hoikas » Wed Apr 14, 2010 3:42 am

Those are pretty much useless, especially when most of them say "hack, hack hack." I'd rather see more max files; we've never had those before, unlike the python.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby diafero » Wed Apr 14, 2010 1:27 pm

Well, I still like to see the comments :)

And true, the docstrings in the Plasma.py file are exactly the same information as what is on the wiki, except that the wiki is for POTS, while the code Cyan published is for MOUL.
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: Plasma Python API

Postby Zrax » Wed Apr 14, 2010 6:13 pm

Chacal wrote:Good job. Very clear.
I always wondered how "Function: PtAvatarSpawnNext() - Send the avatar to the next spawn point " works. How does it know what the "next" spawn point is? Does it keep a pointer to the last point you spawned at?


Yes, it keeps a global variable that gets incremented and wrapped back to zero if you run over the last spawn point... Hence why it's possible for PtAvatarSpawnNext to start at a spawn point other than the first if used in two different ages subsequently ;)
User avatar
Zrax
 
Posts: 206
Joined: Fri Sep 28, 2007 5:19 pm
Location: Waist-deep in a conecano

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 7 guests