Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 136 137 [138] 139 140 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1457109 times)

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2055 on: June 30, 2012, 12:52:12 am »

Mac build isn't working for me:

Code: [Select]
Last login: Fri Jun 29 21:11:28 on ttys000
/Users/home/Desktop/FrontierFortress/dfhack ; exit;
new-host-5:~ home$ /Users/home/Desktop/FrontierFortress/dfhack ; exit;
dyld: could not load inserted library: ./hack/libdfhack.dylib

/Users/home/Desktop/FrontierFortress/dfhack: line 15:   727 Trace/BPT trap          ./dwarfort.exe
logout

[Process completed]


Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2056 on: June 30, 2012, 02:28:09 am »

Would it be possible to write the 'quicksave' command with an argument that specifies a new folder name?  A couple times now I've had DF crash on saving and had to go back to a previous save.  It'd be nice to have a couple save "slots" in case one gets corrupt like that.  The vanilla program does this somehow with one of the init backup options, but it'd be nice to have more control. :).
this, though this kinda means I need to jump out of 34.10 to use it. I wonder what slightly new content I should study. hmm maybe introducing magical slabs that if built will convert any one near it with the secret it has on it. kinda adding an adventure mode feature to fort mode.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2057 on: June 30, 2012, 03:15:58 am »

Would it be possible to write the 'quicksave' command with an argument that specifies a new folder name?  A couple times now I've had DF crash on saving and had to go back to a previous save.  It'd be nice to have a couple save "slots" in case one gets corrupt like that.  The vanilla program does this somehow with one of the init backup options, but it'd be nice to have more control. :).

No, it's not possible, otherwise it would've been done. Filename processing is completely hardcoded in the game. In fact, quicksave has to temporarily disable that backup option, because otherwise it overwrites the last backup too.

Well, you might be able to force it by overwriting the current opened savegame name temporarily, but it is dangerous. And unlikely to work at all, since there are raws and stuff that need to be copied over.
« Last Edit: June 30, 2012, 03:20:31 am by ag »
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2058 on: June 30, 2012, 07:23:38 am »

Mac build isn't working for me:

What os version, hardware, any other potentially relevant setup details?
Logged

uggi

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2059 on: June 30, 2012, 07:43:23 am »

No, it's not possible, otherwise it would've been done. Filename processing is completely hardcoded in the game. In fact, quicksave has to temporarily disable that backup option, because otherwise it overwrites the last backup too.

Can DFHack access the filesystem directly, i.e. check if files/directories exist and be able to rename them? I know it can export XML files, so I'm thinking this might work then:
1: the existing save directory is called "testfortress"
2: user wants to quicksave
3: DFHack first renames the existing save directory to "testfortress_backup_001" or similar, checking if previous backups exist and increasing the number
4: DFHack lets DF to save the game, I'm guessing DF automatically creates a new "testfortress" directory for it, if not then create it first
5: ?
6: profit!
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2060 on: June 30, 2012, 07:50:16 am »

Well, I suppose you could copy the current savegame dir contents elsewhere before telling DF to quicksave. Saving seems to be largely incremental, i.e. it only overwrites the files that need changing, so you can't move data.
Logged

Hesuchia

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2061 on: June 30, 2012, 11:50:01 am »

Heh yeah I've got lots of .rars in there. Takes a bit to pack though so I was just curious ;P.  Though a packed at "Best" compression makes the file smaller than when the game's default compression is on.   7z is even smaller :P.
Logged

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2062 on: June 30, 2012, 03:44:59 pm »

So there's explanations of how to use basic lua commands, but none on using the functions tailored to DF, like utils.insert_or_replace.  I'm trying to figure it out but I feel like I'm spinning my wheels here.  I see vjek use it in his make_legendary script as

utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')

So unit.status.current_soul.skills is vector, but I don't understand how to use the arguments item, field, and cmp here.  Is all of the stuff between the {} item, and 'id' the field?  Is cmp not required?

insert.table also doesn't work.  Says unit.syndromes.active is userdata, not a table.

This seems harder than it should be.  All I need is to add the info for a syndrome to the active syndromes list for the unit.
« Last Edit: June 30, 2012, 03:48:26 pm by Makbeth »
Logged
Diso Faintpuzzles was born in 120.  Although accounts vary it is universally agreed that Diso was chosen by fate as the vanguard of destiny.

In the early spring of 143 Diso began wandering the wilds.

In the early spring of 143 Diso starved to death in the Horn of Striking.

Hesuchia

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2063 on: June 30, 2012, 07:15:56 pm »

Yeah I've been working on your problem all day heh.  I do wish all this had more documentation and especially examples.  Scouring google yields a result now and then, but overall it's tough to understand for those with absolutely no C++ or lua background.

The unit.status.current_soul.skills vector contains sub-tables for different skills.  So if unit is dfhack.gui.getSelectedUnit() then unit.status.current_soul.skills[0] would be his first skill.  Each skill has subvalues of id, rating, experience, etc.

 Lua assigns tables apparently with { field = value, field = value, etc }. 

The insert_or_update function looks like it first tries to insert a value, but the insert function first searches to see if the field exists and, if it does, tells the insert_or_update to update the value in the field instead.

After about an hour of fiddling it looks like the cmp argument is nil in the make_legendary script.  The {} section are all part of the item argument. The 'id' is the field.  So in his case, the script searches a selected character to see if it has a certain 'id' number (which corresponds to a specific skill).  If it has it, then it changes the id to whatever skill number you input, puts a 'new' field in, and changes the rating field to 20.

In your case, I'm not sure what the subfields would be called, if any, since my dwarves don't have any syndromes at the moment. One very useful function is "printall(table)" though.  It's how I found all those sub-tables.  printall(unit.status.current_soul.skills) lists index numbers for whichever skill the particular dwarf has.   Then, printall(unit.status.current_soul.skills[0]) prints all the fields of that subtable (like id, rating, experience, etc.) 

Hopefully you can piece together which fields are important ;D.  And I was writing this post over the course of the day so hopefully it makes sense >.>

Edit: well, not sure about the 'new = true' field actually...can't binsearch for a boolean and if you change the true to 1 it says that 'new' is a function, so it's somethin :P. It looks like the "recursive table assignment" section has something to do with it but my brain already hurts.
« Last Edit: June 30, 2012, 07:30:02 pm by Hesuchia »
Logged

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2064 on: June 30, 2012, 08:02:08 pm »

Well, it's been a fun couple days, but now it's just taking too much time for too little benefit.  As fun as it was to pick up DF again for a few weeks, there are still way too many problems with dwarf and adventure mode, and it's stopped being enjoyable.  I was hoping to work around some of those problems with DFhack, but so far I've only figured out how to cheat, not to fix what's broken.  Thanks to those who did take the time to offer advice, I appreciate it.  Good luck with your own projects.
« Last Edit: June 30, 2012, 10:25:56 pm by Makbeth »
Logged
Diso Faintpuzzles was born in 120.  Although accounts vary it is universally agreed that Diso was chosen by fate as the vanguard of destiny.

In the early spring of 143 Diso began wandering the wilds.

In the early spring of 143 Diso starved to death in the Horn of Striking.

Stungun

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2065 on: July 01, 2012, 01:47:06 am »

Hey, I found something out and I figured I could be helpful. We don't have a list of the possible shapes for tiletypes, but it can accept a number as an argument; and this means if you input "paint sh 1", it'll accept that and you'll see that it changes its shape to "WALL". So you can use this to probe around and find the names of the constants it'll accept.

I've made a list of shapes and what it paints. But first, some notes:

Just using shape without defining a material (or sometimes, the material without defining the shape), CANNOT change a tile into something that the material can't be (for example, you can't turn floor fungus or soil floors into walls or boulders, and can't turn trees into walls made of wood). If you want to change floor fungus into a wall of solid rock, you'll need to both set the material and the shape in one go. Otherwise the tile simply won't change.
Also, the SPECIAL state will be preserved if possible (the SPECIAL state determines whether something is smoothed, furrowed, a river source, etc.). For example if you use a WALL shape on a smoothed FLOOR, it will turn into a smoothed WALL.
You can use -1 to reset any of the options. (e.g. paint sh -1 will remove the SHAPE setting)

Code: [Select]
0: EMPTY <Empty space; only works on tiles that are a form of empty space, e.g. a downwards ramp>
1: FLOOR <Cavern floor; this will effectively mine out wall tiles. This covers both smoothed and rough stone>
2: BOULDER <Creates a rock boulder, e.g. the kind you see on the surface and can only remove by smoothing; seems to set the tile as smoothed>
3: PEBBLES <Can turn stone into a floor tile named '(material) pebbles'
4: WALL <Turns stuff back into natural walls, can be smoothed or rough. Note that smoothed walls will not automatically connect with each other, and thus you can get pillars adjacent to each other>
5: FORTIFICATION <Turns something into a fortification, and sets the tile to a smoothed state>
6: STAIR_UP <Upward staircase, smooths tile>
7: STAIR_DOWN <Downward staircase>
8: STAIR_UPDOWN <Take a wild guess>
9: RAMP <An upwards ramp; does NOT change the tile above it>
10: RAMP_TOP <Downwards ramp; can only be used on empty space>
11: BROOK_BED <Only seems to work on water, appears to erase the water; I can't figure out what it does but I assume it has to do with brooks>
12: BROOK_TOP <Only seems to work on water again, can't figure this out, erases water>
13: TREE <Only works on vegitation, creates a tree out of the selected plant material, even shrubs! You can have wild strawberry "trees", not sure what happens if you cut one down though. The vegitation maintains its alive/dead state, so creating a tree out of a dead shrub may leave you with a "dead longland grass" tree, for example. This can be used to insta-grow saplings>
14: SAPLING <Vegitation only, turns it into a sapling of the given vegetable>
15: SHRUB <Turns vegitation into a shrub of itself, again it even works on trees>
16: ENDLESS_PIT <Creates a chasm out of empty space, just like the one in Arena Mode; amusingly, you can create one in midair several Z-levels above the ground, I guess it creates a wormhole or something... Combine this with the HFS material to create an eerie glowing pit!>

And here's a list of materials, which can allow you to set things specifically and for example, turn a rock wall into a wooden tree or empty space. Some notes first.

It doesn't seem possible to define a specific material; whatever world you're using appears to have the materials of any given location on the map hardcoded, e.g. based on the veins and stone layers. So you can't just create admantine out of thin air, but you can use this to replenish mined-out veins. (paint sh WALL, paint m MINERAL)

Code: [Select]
0: AIR [Used for downward ramps, EMPTY, chasms, and so forth.]
1: SOIL [Silt Loam, etc. Seems to turn dead floor fungus into furrowed silt loam]
2: STONE
3: FEATURE [Admantine veins; you can't use this to create admantine just anywhere, if you attempt to, it will show up as 'unknown material'. It can only be used thus where an admantine vein is present]
4: LAVA_STONE [Creates obsidian, independent of the layer stone]
5: MINERAL [If it's part of a vein of non-layer stone (e.g. microcline), it'll turn the stone into that mineral, otherwise it'll just turn it into the layer's stone]
6: FROZEN_LIQUID [Creates ice, but it won't freeze water...]
7: CONSTRUCTION [Doesn't seem to work, but if used on floor fungus, creates "Muddy  Floor" (Yes, the material is blank and that's two spaces)]
8: GRASS_LIGHT [Allows you to make grassy floors (or fungal floors in caverns)]
9: GRASS_DARK [Same, except the tile is colored darker than GRASS_LIGHT]
10: GRASS_DRY [Same as above, except it says "Dry (grass type)"]
11: GRASS_DEAD [Same as above, except dead]
12: PLANT [Only used for trees and shrubs]
13: HFS [Creates 'glowing floors', walls turn into 'glowing barriers'. Use this with the CHASM shape for an Eerie Glowing Pit.]
14: CAMPFIRE [Creates campfires out of floor tiles; described as 'ashes']
15: FIRE [Creates burning floor tiles; described as 'ashes']
16: ASHES [Creates ashes, which have the same icon as spent arrows]
17: MAGMA [Semi-molten rock and magma flows]
18: DRIFTWOOD [turns the ground into 'driftwood', which has the same tile as bars]
19: POOL [Creates murky pools]
20: BROOK [Only placeable on water, seems to replace it with Brook tiles... I think now that this is what the BROOK_TOP shape is for]
21: RIVER [Creates waterfalls and rivers; it created 'waterfall' tiles when I used them on mossy cavern floors, 'river' when I used them in underground cavern lakes]

The following SPECIAL values can be used:

Code: [Select]
0: NORMAL <Nothing special about this. You can use this to unsmooth stone though>
1: RIVER_SOURCE
2: WATERFALL
3: SMOOTH <Works on walls and floors, determines whether it's smoothed or not>
4: FURROWED <Makes a floor furrowed, e.g. after you build and then later remove a paved road>
5: WET
6: DEAD <My guess: Controls whether trees and shrubs are dead or not>
7: WORN_1
8: WORN_2
9: WORN_3
10: TRACK

Not sure what all of them do, but this is at least a good list of values you can use.

Other information: If you turn walls into empty space and it leads into unexplored territory, that unexplored territory will only be revealed when the map is updated (e.g. you dig out a tile somewhere nearby).

I hope this information is helpful, and hasn't already been posted somewhere.

Knowing how this tool works is vital if you accidentally use liquids with the of (obsidian floor), set on block mode, and wind up accidentally paving over your magma smelter's magma-hole... like I did. That said, have fun rewriting your world.
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2066 on: July 01, 2012, 02:11:17 am »

We don't have a list of the possible shapes for tiletypes

https://github.com/peterix/df-structures/blob/master/df.tile-types.xml

Edit: well, not sure about the 'new = true' field actually...can't binsearch for a boolean and if you change the true to 1 it says that 'new' is a function, so it's somethin :P. It looks like the "recursive table assignment" section has something to do with it but my brain already hurts.

What that new does is allow vector:insert('#',{new=true,...}) to allocate a new C++ object to insert into the vector. Otherwise it signals an error, so as to avoid unanticipated silent memory leaks.
« Last Edit: July 01, 2012, 02:30:37 am by ag »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r1
« Reply #2067 on: July 01, 2012, 08:16:14 am »

Protip: in tiletypes, you can type "help shape", "help mat", "help special", "help variant", etc. to get a full list of all valid types.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Hesuchia

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2068 on: July 01, 2012, 01:57:09 pm »

One thing I've been trying to figure out. Is it possible to print out the value of a string at a pointer through Lua? When I was working on the syndromes problem, I got to a point where scouring through sub-tables led me to syn_immune_class. When I printed that out, it was a bunch of <string> vectors, but I couldn't print a value.  Of course, opening Cheat Engine (so useful for debugging) and going to one of the pointers gave me the string [GENERAL_POISON] so I know the value's there. Just wanted to know if there's a native way in the Lua wrapper to pull the value of the pointer from C without having to open another CPU/memory intensive program.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2069 on: July 01, 2012, 03:26:44 pm »

I would try the "print" and "printall" commands.
Logged
Pages: 1 ... 136 137 [138] 139 140 ... 373