Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 283 284 [285] 286 287 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1456229 times)

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4260 on: July 19, 2013, 06:58:15 am »

Cross-post from plugins suggestions, since I think this would be really quick: 

Would anyone be up for whipping up a script like soundsense-season, to add information to the gamelog on load that can identify the world?  I'm thinking of something like "Loaded RegionX, [dwarfname] [translatedname]".   

There's a nice little utility called Story Maker which could take advantage of something like this in the next version, but it would also be nice for flavor and tracking activity across different forts manually.  It would also potentially allow someone to build a plugin that lets DF show gamelog info from previous sessions, which could be nice for people who play in short bursts.
we have the ability to hijack the announcement tab and add anything you want...or well warmist does.
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

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4261 on: July 20, 2013, 05:30:19 am »

we have the ability to hijack the announcement tab and add anything you want...or well warmist does.

Well, yeah - I can tell that from looking at soundsense-season. 

I just need someone to actually do it - I have no idea what variables to plug in, or I could probably just modify a copy of  soundsense-season to do it.  (I lie, even with that I still have no idea about lua or scripting at all, so some help would be lovely.)
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4262 on: July 20, 2013, 02:01:25 pm »

I am attempting to produce a surface geology map by reading the highest non-soil rock layers from df.global.world.world_data.  Quietust has helpfully suggested getting the region index from region_map(x)(y), but I've hit a wall here.  I cannot figure out how to use the coordinates here.  Parentheses do not work, and every reference I can find to reading 2D data from Lua writes it as
Code: [Select]
printall(data[x][y])This doesn't work either. 

I have had limited success using
Code: [Select]
printall(region_map[x])which has 129 valid values for x.  From the temperature and elevation data I can read from it, these are the northernmost region tiles from west to east.  That's great, but I'd really like to know how to adjust the y values. 
Code: [Select]
printall(region_map[x][y]) does not work, nor do any of the permutations I've tried, such as
Code: [Select]
printall(region_map[x,y])
printall(region_map[x],[y])
printall(region_map[[x][y]])
and so on.

I'm fairly new to Lua, though I've had some experience in Python, and my attempts to find descriptions of the correct syntax all point to
Code: [Select]
printall(region_map[x][y])which doesn't work.  Could anyone point me in the right direction please?
« Last Edit: July 20, 2013, 02:06:25 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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4263 on: July 20, 2013, 02:07:16 pm »

Code: [Select]
I am attempting to produce a surface geology map by reading the highest non-soil rock layers from df.global.world.world_data.
Quietust has helpfully suggested getting the region index from region_map(x)(y), but I've hit a wall here.
I cannot figure out how to use the coordinates here.
Parentheses do not work, and every reference I can find to reading 2D data from Lua writes it as "printall(data[x][y])".  This doesn't work either. 

I have had limited success using printall(region_map[x]), which has 129 valid values for x.
From the temperature and elevation data I can read from it, these are the northernmost region tiles from west to east.
That's great, but I'd really like to know how to adjust the y values.
printall(region_map[x][y]) does not work, nor do any of the permutations I've tried, such as printall(region_map[x,y]), printall(region_map[x],[y]), printall(region_map[[x][y]]), and so on.

I'm fairly new to Lua, though I've had some experience in Python, and my attempts to find descriptions of the correct syntax all point to printall(region_map[x][y]), which doesn't work.  Could anyone point me in the right direction please?

Use code tags, otherwise you get this
  • [y] thing.


But yeah, it should be
Code: [Select]
printall(region_map[x][y]) If you're getting an error, post it. Try this code out:

Code: [Select]
for k,region_map_x in ipairs(region_map) do
    for kk,region_map_y in ipairs(region_map_x) do
        printall(region_map_y)
    end
end

Depending on what you're trying to do, that should work.

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4264 on: July 20, 2013, 02:24:48 pm »

First, I create the variable region_map

Code: [Select]
[lua]# region_map=df.global.world.world_data.region_map


I test out the first value; seems to be a freezing ocean.  The ice cap is in the northern part of this world.

Code: [Select]
[lua]# printall(region_map[0])
unk_0                    = 146750001
sites                    = <vector<world_site*>: 0x1e9890fc>
flags                    = <BitArray<>: 0x1e98910c>
elevation                = 50
wetness                  = 88
vegetation               = 0
temperature              = -27
evilness                 = 58
hilliness                = 91
unk_2c                   = 91
savagery                 = 18
unk_30                   = 3
unk_32                   = 0
unk_34                   = 0
unk_36                   = 0
unk_38                   = 0
unk_3a                   = 4400
saltiness                = 100
unk_3e                   = <coord: 0x1e989132>
unk_44                   = <coord: 0x1e989138>
unk_4a                   = <coord: 0x1e98913e>
region_id                = 0
landmass_id              = -1
geo_index                = 166



The 27th tile from the west edge on the north edge of the map is a terrifying volcanic island. Checking x=26 gives us:

Code: [Select]
[lua]# printall(region_map[26])
unk_0                    = 140500002
sites                    = <vector<world_site*>: 0x206cf094>
flags                    = <BitArray<>: 0x206cf0a4>
elevation                = 102
wetness                  = 100
vegetation               = 8
temperature              = -29
evilness                 = 93
hilliness                = 68
unk_2c                   = 100
savagery                 = 92
unk_30                   = 3
unk_32                   = 0
unk_34                   = 0
unk_36                   = 0
unk_38                   = 0
unk_3a                   = 5000
saltiness                = 66
unk_3e                   = <coord: 0x206cf0ca>
unk_44                   = <coord: 0x206cf0d0>
unk_4a                   = <coord: 0x206cf0d6>
region_id                = 1
landmass_id              = 0
geo_index                = 268




So that basically confirms that it's reading the top row.  Good so far, but when I try to read tiles off rows other than the top:

Code: [Select]
[lua]# printall(region_map[26][26])
(interactive):1: Cannot read field world_data.T_region_map.26: not found.
stack traceback:
        [C]: in function '__index'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>

Not sure what's going on there.

Another thing that concerns me is that these are region tiles, not local tiles.  The entire tile is reported as being a volcanic island, even though the northwest corner is frozen ocean on the local map.
« Last Edit: July 20, 2013, 02:30:47 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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4265 on: July 20, 2013, 02:28:37 pm »

Well, there is no [26][26] or even [26][0] for that matter. You'd see 0, 1, 2, 3 etc. if those existed, but those aren't there. There are probably rows that aren't the top if you just... kinda... make the number bigger.

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4266 on: July 20, 2013, 02:32:53 pm »

That was one of the things I tried earlier; the index values stop at 128; trying to print region_map[129] gives a blank result.

Trying to print region_map[600] crashed DF.  Started thinking maybe it was related to the cursor position on the embark map, so I moved to the mid latitudes, started over with redefining region_map, and got the exact same results for region_map[26].

« Last Edit: July 20, 2013, 02:38:33 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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4267 on: July 21, 2013, 03:18:48 am »

I know this seems an odd question, but is there a way to pass arguments and view the DFHack console through a network?

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4268 on: July 21, 2013, 03:46:55 am »

I know this seems an odd question, but is there a way to pass arguments and view the DFHack console through a network?
Remote shell, Ssh or telnet, and dfhack-run.exe.

Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4269 on: July 21, 2013, 04:10:08 am »

DFHack-run works fine for connecting to the DFHack console, however, it does not have the ability to connect over a network, and this is intentional, as a security feature. If you want that ability, you need to modify the source to allow connections to and from other computers.
Logged

Hommit

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4270 on: July 21, 2013, 03:08:19 pm »

DFHack-run works fine for connecting to the DFHack console, however, it does not have the ability to connect over a network, and this is intentional, as a security feature. If you want that ability, you need to modify the source to allow connections to and from other computers.
connect to cmd/bash/whatever shell and dfhack-run through that?
Logged

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4271 on: July 22, 2013, 01:09:36 am »

Hi Japa, I have a question for you.

What is the deal with df.global.world.world_data.region_map?  Is it an array of region tiles or local tiles?  Is it an array at all?  It doesn't seem to respond to printall in the same way as a normal array, but it does list different entries if you use a printall command with indices from 0 to 128.

Is there a way, using dfhack, to read all 2064x2064 local tiles (for a medium world) for their topmost rock layers, or do you actually have to visit them like in isoworld?  How big a deal would it be to try to set up something like isoworld to show a surface geology map if that's the case?
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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4272 on: July 22, 2013, 01:14:02 am »

No, it responds to printall in the exact way it does with a normal table. It's just that it seems you're expecting it to be a set of tables in its tables, which it isn't.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4273 on: July 22, 2013, 01:30:13 am »

Why are you asking me? I have no idea about anything lua related.
Logged

Makbeth

  • Bay Watcher
  • His lower body is melted.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4274 on: July 22, 2013, 01:35:06 am »

I guess the problem is I don't understand how tables work in Lua then.  Thanks for the quick replies.
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.
Pages: 1 ... 283 284 [285] 286 287 ... 373