Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 299 300 [301] 302 303 ... 360

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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4500 on: July 15, 2016, 01:51:44 am »

If that returns a tile, then it's obviously not what's being asked for, which is world coordinates.

The problem with that is that world coordinates are rather inconsistent; there are three granularities in the various structures. An old attempt at recreating siege forcing that may be around on my gist explains it

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4501 on: July 15, 2016, 08:24:13 am »

Yeah, there's also the problem where the xyz for your unit position seems to get updated for where you are on the map and which screen chunk you loaded last.

I can teleport myself around with gm-editor in travel mode pretty reliably, but it just drops you on a given embark tile, no way to specify from the travel map which local tile you want to drop on. Though I'm curious where the campstruction interface stuff was, I didn't play on a version with dfhack long enough that I remembered to poke around and look through it, but it does add a specific level of position exactness which I don't think existed in adventurer mode before.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4502 on: July 15, 2016, 10:39:29 am »

Sorry I couldn't find what you were talking about, Putnam.  All I know about world-scale coordinates is from trying to work out animal populations.  A fort is nominally located at

df.global.world.world_data.active_site[0].pos.x
df.global.world.world_data.active_site[0].pos.y


but I don't know if that's the top-left embark square, or what.

Edit: Milo also had something here, but it seems to identify the tile's biome ID rather than its "global coordinates."
« Last Edit: July 15, 2016, 01:07:21 pm 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

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4503 on: July 15, 2016, 01:18:03 pm »

Frankly I have no idea how that code works anymore. It was poorly understood black magic when I wrote it, and I have since forgotten anything I figured out... It doesn't seem to have anything that would be of use to identifying your fort location though.

The easy way to find a spot as an adventurer is to export the info from legends mode first, then look the site up in a legends browser.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4504 on: July 16, 2016, 05:00:34 pm »

Hmm, well the first granularity in world coordinates is pretty easy to figure out, the map block gotten from dfhack.maps.getTileBlock(coords) has a region_pos.x and region_pos.y that coorespond with the x and y location on the big world map. Next I think you can check the df.global.world.map.region_x and df.global.world.map.region_y for the second granularity. And then the local x,y,z for the final step.

But a single point can have multiple combinations of the second and third groups in adventure mode. It appears there is some sort of map overlap depending on the previous movement, so that doesn't really work. There is a region_offset table in the map_block, it has 9 numbers in it, but I have no idea what the numbers represent. You would think it wouldn't be so difficult to determine an exact location. I mean, how does the game know where an item is when it isn't on a map?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4505 on: July 16, 2016, 05:57:42 pm »

The items store it and a pointer to the map blocks I think.

The uh, column index and row index I think are where I figured out how to screw around with directly designating squares for tasks, and there is a lot of data in there, I think it was under map, but it might have been map_extra?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4506 on: July 19, 2016, 02:37:39 pm »

Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.
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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4507 on: July 19, 2016, 04:43:54 pm »

Isn't there a specific history event for that?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4508 on: July 19, 2016, 09:55:10 pm »

Isn't there a specific history event for that?
Okay... does anyone know a simplish way in Lua to check for a specific historical event? :)
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

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: DFHack 0.43.03-r1
« Reply #4509 on: July 19, 2016, 10:17:37 pm »

Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

Won't excavated_tiles in entity.activity_stats do?

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4510 on: July 19, 2016, 10:39:14 pm »

Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

Won't excavated_tiles in entity.activity_stats do?
I'm only counting tiles from 24 layer stones that could have spawned a creature, but if this turns out to be intractable I might bump up the grace period and just let soil count towards it.  Thanks for the great fallback idea.
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

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4511 on: July 20, 2016, 02:14:53 am »

Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

There's no builtin way to do it but that sounds interesting.

I think iterating through all history once on load is probably your safest bet. Check if the fort was founded at the current time. It might trigger multiple times if you save without advancing at least one frame then reload though, so be careful about that corner case. You may or may not want it to retrigger when that happens.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4512 on: July 20, 2016, 02:20:19 am »

Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

There's no builtin way to do it but that sounds interesting.

I think iterating through all history once on load is probably your safest bet. Check if the fort was founded at the current time. It might trigger multiple times if you save without advancing at least one frame then reload though, so be careful about that corner case. You may or may not want it to retrigger when that happens.
Operationally it is just resetting a counter to zero, so if the trigger is found it can just break.  Would be a lot faster to go backwards if I can work that out.  In this particular case, though, maybe even checking that excavated tiles is zero would do the trick.  Yes, you can do a lot before digging anything, but this is a counter for certain kinds of digging... No harm resetting a zero back to zero.

Thanks everyone, I'll throw some stuff at the wall and see what sticks.

Edit: about using the first dwarf's unit ID as a fortress ID, savescumming would not actually be a problem, but having that guy die would be.
« Last Edit: July 20, 2016, 02:23:08 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

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4513 on: July 20, 2016, 02:34:54 am »

Are excavated tiles set to zero on a reclaim?

What do you mean by "go backwards"?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #4514 on: July 20, 2016, 09:32:36 am »

Are excavated tiles set to zero on a reclaim?

What do you mean by "go backwards"?
Just meant going from most recent backward toward earliest.  And I'll have to check about resetting on a reclaim.
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
Pages: 1 ... 299 300 [301] 302 303 ... 360