Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 6 7 [8] 9 10 ... 361

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

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #105 on: June 27, 2014, 07:41:26 am »


Serious questions to dfhack people:  how hard would it be to have a single Onload.init in the same place as dfhack.init? 
You can probably do it fairly easily by calling "script onload.init" whenever a region loads.
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.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #106 on: June 27, 2014, 07:52:22 am »

What I'm after would basically fake having a single simple file; if you mean a save from an older pack I already reset dfhack.init by default so that any new items will usually make it through.  There's no perfect solutions, so I try to make the default work for the minimum-effort newbie.  It seems to work out pretty well for most :)

You can probably do it fairly easily by calling "script onload.init" whenever a region loads.
I'll look into this if I have a day free sometime, but that might not happen for a while. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #107 on: June 27, 2014, 08:11:30 am »

This should work in dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then dfhack.run_command('script onload.init') end end
If you want output to be displayed, use this instead:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then print((dfhack.run_command('script onload.init'))) end end
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.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #108 on: June 27, 2014, 08:19:12 am »

And by substituting the filename I can use a separate non-conflicting single file, yes? Thanks!
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #109 on: June 27, 2014, 08:21:19 am »

That script is referring to "onload.init" in the main DF folder (not a region folder), although the name doesn't make a difference.
« Last Edit: June 27, 2014, 08:24:11 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.

indyofcomo

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #110 on: June 27, 2014, 08:44:06 am »

What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #111 on: June 27, 2014, 06:06:53 pm »

I had thought of the first, and I plan to do this eventually - but it's a real pain, with way more special cases than I want to consider.  The second could work - I'd have to check how selectively the windows GUI copies those folders over.  On the other hand, it makes all the issues with propagating settings even worse if I want to use it for more that always-on bugfixing. 

Serious questions to dfhack people:  how hard would it be to have a single Onload.init in the same place as dfhack.init? 

This would be a huge plus for my setup in the Starter Pack.  If keeping the current function is desired, it could be overridden when an in-save-folder init file is found.

Not that hard, but Lethosor's solution is better. You can do it with dfhack.init as is.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #112 on: June 27, 2014, 06:07:38 pm »

One more: I tried running the blooddel command to test if it works, and it won't delete blood barrels from an already arrived caravan. Is it intended behaviour? Is it only effective on future caravans?

Yes, only future caravans.
Logged

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #113 on: June 27, 2014, 08:14:33 pm »

One more: I tried running the blooddel command to test if it works, and it won't delete blood barrels from an already arrived caravan. Is it intended behaviour? Is it only effective on future caravans?

Yes, only future caravans.

Correct. The script removes bloods etc. from the list of extracts that a civ can bring. This will also prevent you from embarking with or requesting blood barrels. Items that already exist on the map are not affected. The script only needs to be run once per world, as the change appears to be saved in the world data.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #114 on: June 27, 2014, 09:35:09 pm »

What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
If you mean the item/material tokens, they can be found at http://dwarffortresswiki.org/index.php/DF2012:Item_token and http://dwarffortresswiki.org/index.php/DF2012:Material_token, respectively. The createitem page may also be useful.
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.

Japa

  • Bay Watcher
  • Spoopy time!
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #115 on: June 27, 2014, 11:36:59 pm »

Alternately use the much more friendly workflow GUI script.

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #116 on: June 28, 2014, 02:03:59 pm »

This should work in dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then dfhack.run_command('script onload.init') end end
What is the syntax, if I want to run a script at embark/after embark. Will the script only act on the active world, or any saves?

What is an "embark offset patch"?  Because I'm getting an "embark offset patch not found" when trying to use "embark anywhere" or "embark nano".
Yeah, the embark script does that, use the embark-tools instead: enable embark-tools in the console, then you get a GUI option.

What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
Use this as a base, copypaste into dfhack, or add to dfhack.init or onload.init.

Riemann

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #117 on: June 28, 2014, 05:43:14 pm »

Hey all, I've learned me some Ruby in the last couple days and am working on a DFHack script. Could use some help:

I have a reference to a Unit object and want to get the string name for that units Profession.

been poking at this for a while and I cannot figure out the syntax for working with the classes that contain things that kind of look like Enums (such as Profession)


this is what I have so far
Code: [Select]
def OutputDorfInfo(dorf)
    str = "#{dorf.name}" if dorf.name.has_name

    if dorf.custom_profession != ""
        str << " the #{dorf.custom_profession}"
    else
        str << dorf.profession.inspect()
    end

    str << " member of the militia squad #{dorf.military.squad_tg.name}" if dorf.military.squad_id != -1

    str << ". \nBorn in the year #{dorf.relations.birth_year}."

    if dorf.relations.spouse_id != -1
        str << "\nMarried to #{dorf.relations.spouse_tg.name}."
    end

    if dorf.relations.lover_id != -1
        str << "\nLover of #{dorf.relations.lover_tg.name}."
    end

    artifactName = dorf.status.artifact_name.to_s()
    if artifactName && artifactName.length > 0
        str << "\nCreator of the artifact #{artifactName}."
    end
   
    puts str
end


dorfs = DFHack.unit_citizens

dorfs.each { |d|
    OutputDorfInfo(d)
    puts ""
}
Logged

Riemann

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #118 on: June 28, 2014, 06:20:17 pm »

Found it!

the syntax I was looking for is DFHack::Profession::Caption[dorf.profession]
Logged

Riemann

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #119 on: June 28, 2014, 10:52:42 pm »

Does anyone know of how to generate the physical description of a dorf in Ruby?
Logged
Pages: 1 ... 6 7 [8] 9 10 ... 361