Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 32 33 [34] 35 36 ... 360

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

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #495 on: August 20, 2014, 04:06:17 am »

Yeah, legacy won't work at all with it.
Logged

breadman

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #496 on: August 20, 2014, 01:20:24 pm »

A little question about stockpiles and lua.

As I can see in stockflow.lua - stockpile is a bunch of tiles with special flags.
So, if I want to get all items in selected stockpile - I must flow through all "df.global.world.items.all" and compare their position/on_ground with coords of my stockpile' tiles?
There's no easiest way?

There are more optimized ways than the method stockflow uses, but I haven't found an easier one.  Granted, stockflow is also interested in how many spaces are available for new items; most stockpile applications would be happy with a simple list of stored items.

For example, autotrade.cpp goes through a list of IN_PLAY items and checks each one against a list of stockpiles it cares about.  But that check involves comparing the item's coordinates with the stockpile's extents.  It also omits checking the stockpile settings, where stockflow makes a token attempt to ignore stone at the very least.

It should also be possible to to speed things up even more by checking the items vector of each overlapping 16x16 map block, but that requires some calculations.  It may well be worthwhile to add a function that does so to DFHack, where it can become the obvious way to check stockpile contents.  Doing so as an iterator would be ideal, but requires a bit more C++ hackery than I'm familiar with.

There is an unnamed vmethod in df.buildings.xml, and several in df.items.xml; perhaps one of them might be helpful.  Unfortunately, there are also vmethods that sound related, but aren't: stockpile.getFreeCapacity, stockpile.canStoreItem, item.getStockpile, item.isAssignedToStockpile, item.isAssignedToThisStockpile, item.getStockpile2, and probably others.

No, you're right, the layout changed.  In .34, the Done line was always on line 23, and the links started some number of lines from the bottom and worked their way up.  Yes, that means that even the default interface had collisions for certain screen sizes, and stockflow was well positioned up near the main menu.

Now in .40, the Done line is always near the bottom, and the links start just below the main menu and work their way down, paging before they would hit the Done line.  Nicer overall, but subtle enough that you don't notice the difference unless something else is being drawn on top.

... which means it is overwritten by dfhack now:
j: no job selected

overwrites the second link

Yes, that's exactly what pull request #290 fixes.  I'm hoping to see it in the next DFHack release, which might be a bit due to the new fields in 0.40.09 making alignment tricky again.

Until then, feel free to disable stockflow when you need to see the overwritten link(s).
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

kr0pper

  • Bay Watcher
  • Coding is fun!
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #497 on: August 20, 2014, 05:02:47 pm »

most stockpile applications would be happy with a simple list of stored items.

I'm a newbie in c++, so lua is my way.
For example, need to create "cut gems" jobs in linked workshop according stored rough gems in stockpile.

There's a some ways I tested:
1. check stockpile's settings and iterate items in df.global.world.items.other.[TYPE]
2. iterate items from highest to lower id
3. cache items, and use an EventManager.onItemCreated for update cache

checking the items vector of each overlapping 16x16 map block, but that requires some calculations

Interesting. Via dfhack.maps.getTileBlock(coords).items ?
And find items via df.item.find(X) ? I'll try it.

There is an unnamed vmethod in df.buildings.xml
How to call a numbered vmethod in lua? All vmethods in *.h are protected.




ADDED:

checking the items vector of each overlapping 16x16 map block, but that requires some calculations


Brilliant!

A little change in hack/lua/plugins/stockflow.lua.
For test, I replaced function findItemsAtTile by this:

Code: [Select]
function findItemsAtTile2(x, y, z)
local found = {}
local items = dfhack.maps.getTileBlock(x, y, z).items
for _, item_id in ipairs(items) do
local item = df.item.find(item_id)
if item.pos.x == x and item.pos.y == y and
item.pos.z == z and item.flags.on_ground then
found[#found+1] = item
end
end
return found
end

and run check_pile(stockpile, true)

Was: 101 sec.
Now:  1 sec.

Much better now 8)
« Last Edit: August 20, 2014, 05:56:47 pm by kr0pper »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #498 on: August 20, 2014, 06:55:21 pm »

expwnent: Before you do extra work, I will try with registration and see how it goes. You mentioned a script a while ago that automatically reads out raws and creates the correct syntax? That would be fine, no need for you to port stuff before I at least have tested the new system. If you and Roses say its amazing, who am I to not us it. ;)

It should be named something obvious in modtools. It might be slightly wrong, but it should be close enough that you can tweak it or just find/replace the things that are wrong so that they're right. Unless I fixed it and forgot about it. I remember having some doubts.
Logged

shaver

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #499 on: August 20, 2014, 07:09:27 pm »

Curious, though I'm probably not the only person to be curious in this way: have people considered asking Toady for him to give the debug symbols for each build to the dfhack team? If he doesn't object to the work then he wouldn't divulge much. A tool could be written to even strip out everything but the structure definitions (so no function names, f.e.) to restrict it further. (I think so, at least. For Linux and OS X it's definitely possible, windows could be trickier, but the structure defs should be the same or determinable given the information there.)
Logged

Satlan_Leng

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #500 on: August 20, 2014, 07:17:52 pm »

How long till the update for 40.09? Got my taste of DFhack with 40.08 but dwarfs that wouldn't marry killed the fortress(migrants stopped due to dead civ, king and all dwarfs single in fortress, no babies)
Logged

Eko

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #501 on: August 20, 2014, 07:23:45 pm »

palu, Meph -

Thanks for your suggestions.  I still think I want to explore a binary patch or something to enable building over water similar to how building over magma is handled right now.  I'll build out the workshops and test using the hermit needs water for now, though.  I really want a way to build over an AIR, EMPTY tile, but it invalidates the building area.  If I can change that, then with the outdoor only script and a small change to test for water, that would work too.

Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.40.08-r2
« Reply #502 on: August 20, 2014, 07:50:36 pm »

There is an unnamed vmethod in df.buildings.xml
How to call a numbered vmethod in lua? All vmethods in *.h are protected.
If vmethods are unnamed, then it means we don't know what they do (and, in some cases, what parameters they take), so attempting to call them could just make DF crash. Experimenting with unnamed vmethods from DFHack is also completely pointless - if you want to figure out what it does and how it's used, you disassemble the entire game (e.g. in IDA Pro) and then analyze the vmethod code directly (and, if possible, track down and identify the places that call it).

Besides, there's no reason why Toady would put a stockpile-specific operation in a virtual method available within the base class - he'd put it as a non-virtual method directly within stockpile itself (which I'm pretty sure is what he's already doing).
« Last Edit: August 20, 2014, 07:58:13 pm by Quietust »
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.

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #503 on: August 20, 2014, 11:14:40 pm »

Meph: Let me know if you have trouble with the conversion script. It's probably a lot easier for me to tweak it than for you to manually do 500 registrations or however many there are.
Logged

PotatoHaulerBlu

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #504 on: August 20, 2014, 11:26:03 pm »

keep up the good work perhaps work on the overlay problems too because it is fun to have. anyway good work
Logged

Euius

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #505 on: August 21, 2014, 01:50:37 am »

So I've identified  those annoying (to me, anyways) leaf/fruit circles under trees as spatter structures in block_events, but deleting the structures (with erase()) does nothing, they're still quite visible.

Where else might these be defined?
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.40.08-r2
« Reply #506 on: August 21, 2014, 03:47:26 am »

Meph: Let me know if you have trouble with the conversion script. It's probably a lot easier for me to tweak it than for you to manually do 500 registrations or however many there are.
I am on vacation. ;) Beginning next month with it, I'll let you know.
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 :::

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #507 on: August 21, 2014, 11:39:22 am »

learn something about armies well the adventurer is a floating array in a pool of it unlike before where it was set to 0. this means the adventurer will swap around in the army list if you keep moving.
kinda means any travel mode script has to search for the adventurer every time the player moves

in good news here have a experimental script that allows you to dive through the 3 layers of the travel menu
Code: [Select]
http://pastebin.com/RCqzsd1Z
so far it does nothing for players since you can't fast travel unless there is a tunnel... and I haven't figure out how to give players access to travel freely... or spawn tunnels or build roads.
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

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.40.08-r2
« Reply #508 on: August 21, 2014, 02:00:45 pm »

So I've identified  those annoying (to me, anyways) leaf/fruit circles under trees as spatter structures in block_events, but deleting the structures (with erase()) does nothing, they're still quite visible.

Where else might these be defined?
They aren't defined anywhere else - if you remove them from map_block.block_events[], they should disappear.

The next version of DFHack will have an option to remove them with the "clean map" command.
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.

Shuuya

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.40.08-r2
« Reply #509 on: August 21, 2014, 03:12:20 pm »

I'm having problems using stonesense. I installed DFHack 40_08 over DF Starter Pack 40_08 and when I open stonesense, it crashes my game.
Here is the crash thing.
Spoiler (click to show/hide)
EDIT: Just for further clarification, I believe that since it's that specific dll file, it has to do with my graphics card. I have an ATi Mobility Radeon x1400, which is pretty out of date and only supports OpenGL 2.0
« Last Edit: August 21, 2014, 03:15:05 pm by Shuuya »
Logged
Pages: 1 ... 32 33 [34] 35 36 ... 360