mmmm, delicious python....
Actually I might be able to use this in my current project.![]()
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.)
Output: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()
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 10: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.


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
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.
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
AWAY FOR 1~2 MONTHS!
Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
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.
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.
Bookmarks