+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Adv. Dupe Python library / CD adv. dupe generator

  1. #1
    Wirererer sk89q's Avatar
    Join Date
    Sep 2009
    Posts
    270

    Default Adv. Dupe Python library / CD adv. dupe generator

    I wrote a Python library to parse and write Adv. Dupe files.

    Here it is:
    sk89q's pyadvdupe at master - GitHub

    If you have setuptools, you can also do easy_install pyadvdupe.

    And here's a sample file to generate CD adv. dupe files:
    (Note: I haven't actually tested the following code, as the CD ray angers me, but it should work.)
    Code:
    import advdupe
    from advdupe.types import LuaTable, Vector, Angle, Player
    
    radius = 10
    precision = 4
    data = {
        # Sector.Track.Stack
        '1.1.0': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
        '5.3.0': [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
    }
    
    # ====================================
    
    # Build the data array
    out = {
        'IRadius': radius,
        'Precision': precision,
        'DiskMemory': {}
    }
    index = 0
    for i in data:
        out['DiskMemory'][i] = index
        out['DiskData%d' % index] = data[i]
        index = index + 1
    
    # Build the adv. dupe file
    doc = advdupe.AdvDupeDocument()
    doc.entities = \
        {1: {'Class': 'gmod_wire_cd_disk',
             'EntityMods': {'WireDupeInfo': out},
             'LocalAngle': Angle(0, 0, 0),
             'LocalPos': Vector(0, 0, 10),
             'Model': 'models/venompapa/wirecd_medium.mdl',
             'PhysicsObjects': {0: {'Frozen': True,
                                    'LocalAngle': Angle(0, 0, 0),
                                    'LocalPos': Vector(0, 0, 10)}},
             'Skin': 1}}
    
    # Output!
    print doc.dumps()
    Output:
    Code:
    [Info]
    Type:AdvDupe File
    Creator:"pyAdvDupe"
    Date:11/01/09
    Description:"none"
    Entities:1
    Constraints:0
    [More Information]
    FileVersion:0.84
    AdvDupeVersion:1.85
    AdvDupeToolVersion:1.9
    AdvDupeSharedVersion:1.72
    SerialiserVersion:1.4
    WireVersion:1722
    Time:09:55 PM
    Head:0,0,0
    HoldAngle:0,0,0
    HoldPos:0,0,0
    StartPos:0,0,0
    [Save]
    Entities:00000008{N:0=T:00000009;}00000009{Y:12=B:t;Y:10=V:0,0,10;Y:13=A:0,0,0;}H00000001{N:1=T:00000002;}00000002{Y:1=T:00000003;Y:10=V:0,0,10;Y:11=T:00000008;Y:13=A:0,0,0;Y:14=N:1;Y:15=Y:16;Y:17=Y:18;}00000003{Y:2=T:00000004;}00000004{Y:3=T:00000005;Y:6=N:10;Y:7=T:00000006;Y:8=N:4;Y:9=T:00000007;}00000005{Y:4=N:0;Y:5=N:1;}00000006{N:0=N:0;N:1=N:1;N:2=N:2;N:3=N:3;N:4=N:4;N:5=N:5;N:6=N:6;N:7=N:7;N:8=N:8;N:9=N:9;}00000007{N:0=N:10;N:1=N:11;N:2=N:12;N:3=N:13;N:4=N:14;N:5=N:15;N:6=N:16;N:7=N:17;N:8=N:18;N:9=N:19;}
    Constraints:H00000001{;}
    [Dict]
    1:"EntityMods"
    2:"WireDupeInfo"
    3:"DiskMemory"
    4:"1.1.0"
    5:"5.3.0"
    6:"IRadius"
    7:"DiskData0"
    8:"Precision"
    9:"DiskData1"
    10:"LocalPos"
    11:"PhysicsObjects"
    12:"Frozen"
    13:"LocalAngle"
    14:"Skin"
    15:"Model"
    16:"models/venompapa/wirecd_medium.mdl"
    17:"Class"
    18:"gmod_wire_cd_disk"
    Saved:2
    Last edited by sk89q; 11-02-2009 at 11:18 AM.
    Tabbed Prop Spawn Menu
    My Website, KAF's Anime Music



    Build: F6 quick save, PewPew, interactive tutorial system, custom tools
    Wire: UWSVN, High Speed Snapshot Viewer, EGPv3, bunch of Wiremod fixes
    E2: Prop Core, Constraint Core, Entity Core, holoModelAny(), applyPlayerForce(), etc.
    We have modified and rewritten a number of our addons.

  2. #2
    Official Bastard of Wire Jat Goodwin's Avatar
    Join Date
    Aug 2008
    Location
    Colorado Springs
    Posts
    2,771

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    mmmm, delicious python....

    Actually I might be able to use this in my current project.
    Ö͎̗̫̙̝̹͓̤̙́ͣͤ̈́̋̽̋͜f̺̦̠̻̜̼̮͓̖́̓̄̿̓̌̓̍̔f̵̳̻̜̹̤̱̊͒ͤ͌ ̅ͭͮ̾͟i̗͖̎͗̇ͯ̈̀̌̽c̯̮̉ͮ̾͟͡i̵̺̻̠̘̤̫͕ͯͭ̅͊ͤͦͧa̷͇̖̲ͥ͗ͪ̎ͤ ̽̾ͫl̶̈́̉̉͂̿̎ͯͥ̐҉̗͙̦̻̪ ̪̻͕̗̝͈̘͓ͬ̋̕͟B͚̲̍͢ā̸̪͔͖̟ͫͨ͜͝s͈͔͔͖͇͍̗͛ͯ̑̂͟t̮̤̬̩̅ͧ̎͑͗ ̃̕͟a̸̧̻̖̘̞̪̲͈͕̲͊ͭͪ͆̉r̯̩̮̬̥̤̗̙̃͌̑͊͢͞ď̠̦̲̥͢͡ ̵̶̢̱̲̺͈̘̳͕ͤͅo̯̞̙̦͖̪̽ͩ͊ͅf̵̦͈̣͙̰̎͋̿́ͅ ̛͕̹̫̰̱̾̓ͪ̌̽̊͘͡W̨̬̲̤̖̽̿͛ͨ͛̃̎͐̏i̛̼̳̝̺̝̭͙͋̑͑ͬ͠ṙ̼͔̪ͯͨͭ ̕e̸̗͕̰̒̃ͩͬ̾͆́ͅͅ

    I Require More Minions! Join us on the IRC !
    List of Reasons to idle on the IRC: Wire QDB

  3. #3
    I think I think too much -HP-'s Avatar
    Join Date
    Feb 2009
    Location
    Behind you with a very sharp knife.
    Posts
    2,466

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Quote Originally Posted by Jat Goodwin View Post
    mmmm, delicious python....

    Actually I might be able to use this in my current project.
    Current project?

    Project = learn moar python
    Why = work for ccp

    amirite?

  4. #4
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Quote Originally Posted by Jat Goodwin View Post
    mmmm, delicious python....

    Actually I might be able to use this in my current project.
    Hmm. I seem to be incapable of having an original idea...


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  5. #5
    Wire Sofaking Vbitz's Avatar
    Join Date
    Feb 2009
    Location
    NZ
    Posts
    685

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    can you have it write things like e2 and wire contraptions
    Questions, Comments and Concerns about any of
    my posts can be directed to my website which is at
    http://vbitz.wordpress.com on the comments post

    Quote Originally Posted by Bull View Post
    As example Jat Goodwin is "the official bastard of wiremod", but that isn't true.. He's very cute and huggable like a little puppy.

  6. #6
    Wirererer sk89q's Avatar
    Join Date
    Sep 2009
    Posts
    270

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Yes. It can write everything, as all the data is there. The hard part is figuring out the format, but you can glean that off from reading the Lua files, or less preferably, opening saved adv. dupe files containing an example of what you want.
    Tabbed Prop Spawn Menu
    My Website, KAF's Anime Music



    Build: F6 quick save, PewPew, interactive tutorial system, custom tools
    Wire: UWSVN, High Speed Snapshot Viewer, EGPv3, bunch of Wiremod fixes
    E2: Prop Core, Constraint Core, Entity Core, holoModelAny(), applyPlayerForce(), etc.
    We have modified and rewritten a number of our addons.

  7. #7
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Is it same as adv dup or better?


    May I suggest (original suggestion by ZP)

    1. create prop
    2. store mass to array. set every prop weight to 50,000
    3. create constraints
    4. apply original weight from array
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  8. #8
    Wirererer sk89q's Avatar
    Join Date
    Sep 2009
    Posts
    270

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    It doesn't replace Adv. Dupe. It only can read/write Adv. Dupe files.

    For most tasks, you could just code an STool to do it. This is more for importing data from outside Gmod into the game through adv. dupe files, or perhaps generating objects on the fly from outside Gmod.

    Edit: On another note, I just noticed Schilcote's less than one week old thread about the adv. dupe format. Haha, I find that kind of funny.
    Tabbed Prop Spawn Menu
    My Website, KAF's Anime Music



    Build: F6 quick save, PewPew, interactive tutorial system, custom tools
    Wire: UWSVN, High Speed Snapshot Viewer, EGPv3, bunch of Wiremod fixes
    E2: Prop Core, Constraint Core, Entity Core, holoModelAny(), applyPlayerForce(), etc.
    We have modified and rewritten a number of our addons.

  9. #9
    Wire Sofaking emspike's Avatar
    Join Date
    Feb 2008
    Posts
    911

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Quote Originally Posted by sk89q View Post
    On another note, I just noticed Schilcote's less than one week old thread about the adv. dupe format. Haha, I find that kind of funny.
    And you sir have ninja'd the WIP I talked about in said thread. Except mine wasn't scripted.

    EDIT: Seems I misread the post at first. Mine doesn't write them. It edits existing ones.

  10. #10
    Wirererer sk89q's Avatar
    Join Date
    Sep 2009
    Posts
    270

    Default Re: Adv. Dupe Python library / CD adv. dupe generator

    Mine does both.
    Tabbed Prop Spawn Menu
    My Website, KAF's Anime Music



    Build: F6 quick save, PewPew, interactive tutorial system, custom tools
    Wire: UWSVN, High Speed Snapshot Viewer, EGPv3, bunch of Wiremod fixes
    E2: Prop Core, Constraint Core, Entity Core, holoModelAny(), applyPlayerForce(), etc.
    We have modified and rewritten a number of our addons.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Adv dupe help
    By megadeath141 in forum Wiremod General Chat
    Replies: 0
    Last Post: 08-07-2009, 12:00 AM
  2. E2 Dupe Help
    By xr34p3rx in forum Expression 2 Discussion & Help
    Replies: 7
    Last Post: 06-29-2009, 04:47 AM
  3. There is a Bug with Adv Dupe
    By Lol-Nade in forum Installation and Malfunctions Support
    Replies: 10
    Last Post: 06-22-2009, 01:25 PM
  4. adv.dupe help
    By 1xinfusion in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 08-02-2007, 06:07 PM
  5. Adv Dupe Gone?
    By Tricky in forum Bug Reports Archive
    Replies: 2
    Last Post: 05-21-2007, 02:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots