Object Functions and Attributes

Discussion in 'General Modification' started by Firestrand, Apr 2, 2005.

Remove all ads!
  1. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    I am sorry if this is repeated informaiton, but I haven't seen it anywhere else so far.

    OK, on the console get a handle on the object of your choice. I picked a character. So I did:
    Code:
    a = game.party[0]
    now a points to the first character in the party. So I want to know what attributes and functions are available. So we use dir():
    Code:
    dir(a)
    Now the text gets screwy on my console, so I decided to also write this to a file for viewing later, this is done via:
    Code:
    outFile = open("Character_Attributes.txt","w")
    print >> outFile, dir(a)
    outFile.close()
    The file ends up in your "C:\Program Files\Atari\Temple of Elemental Evil\modules\ToEE" directory.

    I found this method educational, there were a few things I hadn't seen before in the character's structure. But I have also never looked that closely at the characters before. I hope this helps everyone else out there.

    This should work on any object you can get a handle on.
    Just remember, it returns the methods of the object, and any inherited methods from the objects parents.

    Let me know if you find an object it doesn't work on.

    -Firestrand
     
  2. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Again, THANK YOU for the file I/O functions. That helps a lot. I very painstakingly went through all this piece by piece, and documented the pyObjHandle, pyGame, and pySpell objects. That would have been MUCH easier had i not had to work around that ugly console-wrapping problem.

    -- dulcaoin
     
  3. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    I'm probably getting something wrong, but for me the dir() function returns only the methods for the supplied object, not the attributes. I tried to document the PyObjHandle, PyGame, etc. too, but failed. For example, if I do the dir() thing for game.party[0] I get the methods like "reflex_save_and_damage", "perform_touch_attack" etc. but I don't get the properties such as "rotation", "height", and so on.
    Any ideas?
    - Agetian
     
  4. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    Sorry about that. You are correct, it only returns a list of methods.
    I have been unable to find a way to return a list of properties for a given class, anyone else have an idea?

    -Firestrand
     
  5. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    I've only been able to do it through trial-and-error, using likely-looking strings from the temple.dll dump.

    area, get_size() ?, location, loots, map, radius, rotation, type, I have 'spell' down as a maybe (not sure what that's about)

    I forgot, I also deciphered PyCheats (ha, it's empty, so this was easy) and PyQuestArray.

    -- dulcaoin
     
  6. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    Hmmm... Take a look at the string dump from PE Explorer I posted for the temple.dll here

    I think the important thing to look at, like Dulcaoin suggested, are between the begin and end lines. Like 'obj_f_begin' and 'obj_f_end'.

    These give you an idea of what is being stored on serialization, and an idea of some of the data structures.

    -Firestrand
     
  7. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    All right, here is the next set of files.
    The first is the modules available through toee.* so when you import toee this is what you get access too. It is a prettly long list of constants and functions. For instance I didn't know that 'race_svirfneblin' existed in the game. (I actually had to google it to find out what it was)

    Important thing to remember, these are hard coded game constants and functions, so any spelling errors here need to be duplicated in protos and any scripts that use them.

    Some intersting constants are there, like a sorting type of 'SORT_TARGET_LIST_BY_HIT_DICE_THEN_DIST', which could be useful.

    Take a look, and if you should figure out a previously unknown function call and arguments post it.
     

    Attached Files:

  8. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Firestrand,

    You'll get best results by cross referencing the commands list against .dlg and .py files in order to see arg counts and usage; and of course HERE is a most important reference.

    -- dulcaoin
     
  9. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,743
    Likes Received:
    374
    You don't have Fiend Folio memorised? ;-) Love that race... But then, my favourites are the snyads, so what does that say about me?
     
  10. ben34

    ben34 Member

    Joined:
    Feb 22, 2008
    Messages:
    81
    Likes Received:
    0
    Firestrand, I have been following your work on stat modifications using the console and need more help. I was hoping you might give a detailed step by step set of instructions on weather or not modifying your phisical attributes is possible and if so specific step by step instructions from begining to the end so I don't get lost you know because console programing can be very fruitless if not done exzact! In other words leaving out crucial details (even though you may know) can be very devistating to the listener trying to make the code funtion properly. Now I am not sure how far along you are and mabey you yourself are not finished developing and testing this set of coding, I don't know?
     
Our Host!