Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 285 286 [287] 288 289 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1083380 times)

zenos14

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4290 on: May 14, 2016, 12:44:12 am »

What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

I think workflow is entirely replaced with the new job controls; the new controls have even more flexibility (eg multiple conditions) than workflow did.

One thing I really want though is workflow's (or the stockpile jobs's ability) to do stuff like "Keep making X until you have Y items of Z quality"
The new version doesn't seem to have it, unless I missed something
You could enforce it by linking the job to a workshop which is limited to the corresponding minimum skill.
...Well now I feel like an idiot, thanks for the tip though
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4291 on: May 14, 2016, 04:35:20 am »

It would help, but it wouldn't quite achieve the same functionality.
Logged

zenos14

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4292 on: May 14, 2016, 06:35:03 pm »

Another question,
Region-pops list POND says I still have 1125 turtles left in my map, but I just got the message that there is nothing left to fish
Am I misunderstanding that Region-pops is supposed to show you the surviving population of creatures your map has access to?
Are vermin handled differently or something?
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.42.06-r1
« Reply #4293 on: May 14, 2016, 11:28:53 pm »

Hey guys, I had a script for dfhack that I used to clear soil with. You run it from a workshop, and it creates an "open space" next to the workshop, and a 3x3 space underground. It only removes soil that way, no rock.

It worked fine, but when I try it with 42.06 -r1 it crashes the game.

Code: [Select]
    local pos=position or copyall(df.global.cursor)
    if pos.x==-30000 then
        qerror("Select a location")
    end
local x = 0
local y = 0
for x=pos.x-3,pos.x+3,1 do
for y=pos.y-3,pos.y+3,1 do
z=pos.z-1
while true do
local block = dfhack.maps.getTileBlock(x,y,z)
if block then
--print(x..","..y)
block.tiletype[x%16][y%16]=32
--z = z-1
else
--z = z+1
block = dfhack.maps.getTileBlock(x,y,z)
block.tiletype[x%16][y%16]=42
break
end

end
end
end

Any help with updating it?
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4294 on: May 15, 2016, 07:22:27 am »

What are 32 and 42 supposed to be? You should be using df.tiletype.NAME instead, because the raw numbers can change between releases.
« Last Edit: May 15, 2016, 07:26:04 am by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4295 on: May 15, 2016, 12:25:07 pm »

What are 32 and 42 supposed to be? You should be using df.tiletype.NAME instead, because the raw numbers can change between releases.
Would very low-numbered jobs be likely to be in this group?  I have a script that watches for job completions from 3 to 7 inclusive (basically digging out a tile), and I was hoping it would just continue working in 0.43.  I suppose if jobs have a name attribute I can do it the right way.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4296 on: May 15, 2016, 12:45:47 pm »

They do - look at df.job_type. I don't know if they've changed, though.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4297 on: May 15, 2016, 12:48:48 pm »

They do - look at df.job_type. I don't know if they've changed, though.
Thanks!  It would have been a pain to chase down that bug if something did change.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4298 on: May 16, 2016, 05:53:01 pm »

How would I get something to go off on autosave? checking for df.global.ui.main.autosave_request every tick doesn't work.

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4299 on: May 16, 2016, 10:21:41 pm »

How would I get something to go off on autosave? checking for df.global.ui.main.autosave_request every tick doesn't work.

I did it by interposing df::historical_figure's write_to_file vmethod (not the real vmethod name, I forget the real one). I haven't committed it yet.

As I said in the other thread, I already have a working system that makes DFHack use json instead of histfigs across the board, and also has a hook that occurs just as the game begins saving while guaranteeing that if the game is exiting the hook fires before any game objects are deallocated. I just have to make json a shared library instead of a static library and make it still compile because I'm a perfectionist and I don't want 16 copies of the same code in memory even if it's not terribly much memory. And then make sure it compiles on Linux and OSX (especially OSX because it does linking in a weird way I don't understand).

It works correctly with autosaves and autosave backups, and is backwards compatible with persist-table, and makes persistent data in C++ about as easy as using persist-table in lua.
« Last Edit: May 16, 2016, 10:23:56 pm by expwnent »
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4300 on: May 17, 2016, 05:44:14 am »

Hi all.

Found an issue with create-unit.lua.

EDIT: The problem is that I have an older version of create-unit in my Starter Pack.  I'm going to re-download and see if I messed it up, or the Pack reverted for some reason.

EDIT2: It's PE's pack, I'll let him know.
« Last Edit: May 17, 2016, 06:12:27 am by Dirst »
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4301 on: May 17, 2016, 09:56:57 am »

Okay this time an actual question.

I'm working on create-unit, and what instability I'm finding appears tied to world populations.  The current version of the script fakes a world population using world map position (1,1), index 1, depth 0. 

First, it turns out to be more stable if I use depth -1, and I have no idea why.

Second, I can pop out a whole new population with lpop=df.local_population:new() complete with its own blank-slate world_population record under lpop.population, but I am at a loss where to attach it.

World sites, including the active site, have an .animals array of world_population records, but not every site has these arrays populated.  And in particular I don't see any array elements for the active site despite having wild animals wandering around.  When I peek inside one of those wild animals, it has a world_population record under .animal.population, but there's no obvious way to see how it relates to any particular site's local populations... or if it does at all.

Also, each world_population record has a world-map position and an index that increments when a new type of animal spawns naturally.  I don't see any "next index" attribute, and #df.global.world.world_data.active_site[0].animals does not match what I'm seeing on actual units.

Does anyone know how these local and world populations are linked together?
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4302 on: May 17, 2016, 11:05:10 pm »

Okay, I've made a bit of progress on these population links, but mostly for units that are associated with an official "map feature" (such as a river, cavern layer, or deep special tube).  "Not from a map feature" has its own population indexes that I can't find.  Caves might be a third system.

When it comes to the steep DF learning curve, things go deeper than just the UI.  It's turtles scaling learning cliffs all the way down.

We start with a unit u that is associated with some map feature.  You can get its associated region, feature and index (datatype world_population_ref) from

u.animal.population.
  region_x
  region_y
  feature_idx
  cave_id
  population_idx


That feature_idx should appear once as a value in the df.global.world.features.feature_local_idx array.*  You want the index f_i that has feature_idx as its value.  You'll also need the population index directly from the unit.

df.global.world.features.map_features[f_i].feature.population[u.animal.population.population_idx] will have a world_population record for your creature.

So far so good.  We could certainly augment create-unit.lua to append a new item into this feature's population list (with a bit of complication when a feature spans more than one depth level).  The real problem is that there is a flat array in df.global.world.populations of local_population records, each of which has a world_population_ref in it.  I have no idea how that list gets built, where its next_index hides, if feature-associated critters belong there, etc.  No combination of flags on create-unit seems to push its creature onto df.global.world.populations, but I've confirmed that any non-feature-related naturally occurring critters on the map are there.  I can't find anything that stores the associated index in the df.global.world.populations array.

Some arrays in DF's innards are self-maintaining, others need a global variable to hold the next index.  Appending a record onto df.global.world.populations can be done when spawning non-feature-related critters, but it seems like something somewhere ought to point to that record.  (In any case, the list should be scanned in case the spawned creature should be part of an existing population.)

Note that the spawned creature behaves just fine if the region_x and region_y are on the map, even with -1 for the population_idx.  A creature spawned with the marauder tag generated its own MarauderMill idle activity, attained a name when it killed someone, and everything.  I just don't know if a dangling population_idx of -1 is going to cause problems later.


* Items with a -1 here will have a valid entry in the .feature_global_idx array instead.  In this case I think you're looking for u.animal.population.cave_id as the value, but I didn't get a chance to verify that.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.42.06-r1
« Reply #4303 on: May 17, 2016, 11:35:38 pm »

I tried making a pop-up window with a little story in it, but I could not figure out the line-break. Then I made 5 pop-ups instead, but when the script runs now, the first time it runs, the pop-up has no text. If I run the script again, it does. Could anyone give it a bit... refinement?

Code: [Select]
local dlg = require ('gui.dialogs')
local dlg2 = require ('gui.dialogs')
local dlg3 = require ('gui.dialogs')
local dlg4 = require ('gui.dialogs')
local dlg5 = require ('gui.dialogs')

dlg5.showMessage("A chance encounter", msg5, color, nil)
msg5=("You decide to give the dwarves a proper burial; least they haunt you for using their equipment.")

dlg4.showMessage("A chance encounter", msg4, color, nil)
msg4=("The wagon now yours, you claim your price. The dead have no need for it; you on the other hand...")

dlg3.showMessage("A chance encounter", msg3, color, nil)
msg3=("The goods in the wagon seem intact; curiously enough 7 coffins are among the assorted items.")

dlg2.showMessage("A chance encounter", msg2, color, nil)
msg2=("With no attacker in sight and no trail to follow, you carefully decide to have a closer look.")

dlg.showMessage("A chance encounter", msg, color, nil)
msg=("You come upon a group of dead dwarves, horribly mauled, laying next to their abandoned wagon.")
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4304 on: May 17, 2016, 11:52:58 pm »

Hoo boy. Okay, I can see what you mean by "not a programmer" lol. It's not that egregious, only about as bad as most raw modders I see starting out, which is to say better than most people start out programming lol.

1. You only need one dlg. You're making 5 copies of the exact same thing here. dlg is the library, not the dialogue--each call of showMessage() creates a new dialogue.

2. Any variables need to be declared before  they're used. I think you have the right idea with putting the dialogues in reverse order, yeah--that way they'll be shown to the player in the correct order. Still, msg needs to be declared before dlg.showMessage uses it.

3. color needs to be a proper variable. I think you can just replace it with COLOR_WHITE and be fine.
Pages: 1 ... 285 286 [287] 288 289 ... 360