Bay 12 Games Forum

Please login or register.

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

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

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2055 on: January 26, 2015, 02:01:52 pm »

You could try fix/item-occupancy
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.

Jairl

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2056 on: January 26, 2015, 05:09:52 pm »

I still don't understand what causes it, it seems to only affect 2 particular tiles (in the surrounding area); but, for future reference, I hob-cobbled this together. Question though, why can't I call member functions using OOP notation rather than the physical notation. (I mean, I know the actual member function does include an argument to pass the member, but shouldn't lua handle this?)

local m = dfhack.gui.getSelectedBuilding()
local q = m.getMaxBuildStage(m)
m.setBuildStage(m,q)
m.flags.exists = 1
m.flags.in_update = 1

actually, now that I look closer, it isn't fully initialized still.... ugg.
« Last Edit: January 26, 2015, 05:17:06 pm by Jairl »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2058 on: January 26, 2015, 05:42:53 pm »

Also, m:setBuildStage(q) after that.

Baffler

  • Bay Watcher
  • Caveat Lector.
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2059 on: January 26, 2015, 10:13:31 pm »

Is there any way to change a dwarf's orientation? I'm trying to build a fort through natural births instead of immigration. Combined with age I only have 1 eligible couple out of 30 dwarves.
Logged
Quote from: Helgoland
Even if you found a suitable opening, I doubt it would prove all too satisfying. And it might leave some nasty wounds, depending on the moral high ground's geology.
Location subject to periodic change.
Baffler likes silver, walnut trees, the color green, tanzanite, and dogs for their loyalty. When possible he prefers to consume beef, iced tea, and cornbread. He absolutely detests ticks.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2060 on: January 26, 2015, 10:14:53 pm »

Yeah, check out gaydar and see how it finds orientation. It can be changed with a few flips of the boolean.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2061 on: January 26, 2015, 10:36:00 pm »

How do I run a command on map load?  I want to put something like lua: dfhack.onStateChange.SC_MAP_LOADED("script commands.txt") in dfhack.init, but I have no idea what the correct command would be - or if there's a filename that would work.
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2062 on: January 26, 2015, 11:04:46 pm »

Code: [Select]
dfhack.onStateChange.whatever=function(code)
    if code==SC_MAP_LOADED then
        dfhack.run_command('deramp') --you can replace 'deramp' with whatever
    end
end

And put that in an init.d/whatever.lua file.
« Last Edit: January 27, 2015, 12:55:00 am by Putnam »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2063 on: January 27, 2015, 12:31:20 am »

I'm pretty sure you need "function " at the beginning of the first line.
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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2064 on: January 27, 2015, 12:55:09 am »

Yep, fixed.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2065 on: January 27, 2015, 05:10:22 am »

The bit about adventurer is that they are technically an army, but the game doesn't make a priority like the travel system before,
so now it's an flag set on a lone single army lost in a sea of growing troops. with enough poking and head scratching you could have it set up where all the moving 'armies' are following your adventurer. or join the adventurer's group.

the idea of armies moving around while your in fort mode means there's a chance for fort mode to go borderless, and allow the player to 'scroll' from one site to another.
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.40.24-r1
« Reply #2066 on: January 27, 2015, 05:36:04 am »

the idea of armies moving around while your in fort mode means there's a chance for fort mode to go borderless, and allow the player to 'scroll' from one site to another.

... What. Make it so.
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2067 on: January 27, 2015, 03:17:04 pm »

I am trying to bring back summoning using spawnunit, finding a 0.40x version from Rumrusher. It's all fine when I run it, the creature even appear in the animal screen, sometimes. (I need to locate this screen  but nvm).

However if I save and reload, the creature becomes hostile despite belonging to the civilization. I tried comparing it with a normal pet using gm-editor but I could not figure what's different. The civ_id is right, population is set to -1 as expected.

Here's the script, it's pretty much the same that Rumrusher posted:
https://gist.github.com/Devduweb/9299841e7169445f8cce

I tried commenting the nemesis creation call but the result is the same. Any idea of how I can make sure that df remember the creature being friendly? Thanks.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r1
« Reply #2068 on: January 27, 2015, 03:43:30 pm »

spawnunit still has a few issues, like the one you said. Thank you for testing it, but it may take a while to fix. I'll include it in the main library once it's fully functional.
Logged

catten

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #2069 on: January 27, 2015, 04:37:35 pm »

Is it possible to get the exact material of a tile from a lua script?

Anyone? I asked before elsewhere and was ignored there too (a long time ago), could I at least get a yes or no?

I'm not sure if it is possible to get exact material (it should be, but I'm not aware how to do it). I do have a script that changes a tile to a specific inorganic (but it has some issues recognizing ramps and open grass and etc...)

The relevant code is
Code: [Select]
function findMineralEv(block,inorganic) -- Taken from Warmist's constructor.lua
 for k,v in pairs(block.block_events) do
  if df.block_square_event_mineralst:is_instance(v) and v.inorganic_mat==inorganic then
   return v
  end
 end
end
function set_vein(x,y,z,mat) -- Taken from Warmist's constructor.lua
    local b=dfhack.maps.ensureTileBlock(x,y,z)
    local ev=findMineralEv(b,mat.index)
    if ev==nil then
        ev=df.block_square_event_mineralst:new()
        ev.inorganic_mat=mat.index
        ev.flags.vein=true
        b.block_events:insert("#",ev)
    end
    dfhack.maps.setTileAssignment(ev.tile_bitmask,math.fmod(x,16),math.fmod(y,16),true)
end
function changeType(x,y,z,material,dur)
 local mat
 if material ~= 'clear' then
  mat = dfhack.matinfo.find(material)
  set_vein(x,y,z,mat)
 else
  clear_vein(x,y,z)
 end
end
You'll notice that the heart of it comes from Warmist, so he would probably be a better person to ask than me.

I've been using something similar, but ran into a problem: some tiles have more than one mineral event, and when that happens I can't tell reliably which event is the real one. For example, in one case I encountered a tile with both Red Tourmaline and Bituminous Coal mineral events, in that order, and the game rendered it as coal; another tile had both Jet and Bituminous Coal, in that order, but this time the game rendered it as jet.

How does the game decide which of several mineral events is the "real" one?

Update: I've looked at several examples now, and so far it looks like the highest-numbered material token wins. The examples above are explained by the fact that Red Tourmaline is 108, Bituminous Coal is 207, and Jet is 217.
« Last Edit: January 27, 2015, 06:28:55 pm by catten »
Logged
Pages: 1 ... 136 137 [138] 139 140 ... 360