Python's Limits

Discussion in 'General Modification' started by Shiningted, Oct 18, 2005.

Remove all ads!
  1. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    I guess this question is mainly for Agetian, but I am posting it here since other people may be interested or may have answers. :)

    I am wondering the abilities of Python for file handling and such. For instance, say I wanted to move a file from somewhere to somewhere else in-game - move a jpg into a game folder to change the appearance of a map, for example - could Python do that? I wouldn't have thought so but some of ed.py's powers have got me thinking...

    Btw, no answering with workarounds, I can think of those :Being_a_s
     
  2. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    ToEE includes Python 2.2 with built-in libraries. All standard libraries are omitted, but I think some of them can be plugged in from the regular Python v2.2 package. The *built-in* capacity of Python (that is directly accessible from ToEE) has complete file management capacity, including the possibility to create, delete, modify (in both text and binary modes), and move files. If you want you can check out 'ed.py' - it has tons of examples of working with files in Python (as implemented in ToEE). If you have any specific questions, feel free to PM or e-mail me.

    As for changing the map appearance... well, Python could handle moving the JPEGs -- the trick is that you'll have to reload the map. The change will be seen the next time a map is restarted (maybe this will require a complete game restart, but I doubt it).

    - Agetian
     
  3. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    Well that would be accomplished by cutting to a movie of course... one minute there is a certain building on the main map, then there is a BINK of a fire, then there is a smoking ruin on the map, complete with sectored smoke.

    I know we could do it by having two look-alike maps, but this way you could make multiple changes to the main map depending on game-play.

    Of course we would have to delete the changes before starting a new game, but that can be done by a starting script, especially if KotB ships as a .dat file... thats something to worry about months from now.

    Thanks Agetian! :thumbsup:
     
  4. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    It's an off-topic note, but I thought it to be important enough to get posted here: Toffee could handle KotB as a .dat file, but the trick is - you still (no matter whether you use/don't use Toffee) won't be able to put all those files that belong to the "data" folder into a module-based .dat file and make them work.

    Therefore, you will still have to make it a combination of a module-based .dat file, and a "data.KotB" (or whatever you call it). Toffee will detect such a module as a custom module with a pre-installed data file. This basically means it won't have to install a .dat file for your module, AND it will see everything else (in "data" and all) correctly. I *think* you will also need to supply an empty "modules/KotB" folder for that as well, but I'm not sure atm (don't remember how Toffee handles it - it's been a while since I coded :p EDIT: Just worked a little bit on Toffee, and - yes, it will need an empty "modules/KotB" folder, it will serve as an override for the .dat file, if needed)

    Anyway, if you need any tips on implementing KotB as a module with preinstalled data file (as I described above) that will be compliant with Toffee, let me know (whenever you think the time has come for it, given your "that's something to worry about months from now" comment :))

    - Agetian
     
    Last edited: Oct 19, 2005
Our Host!