Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 249 250 [251] 252 253 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1459057 times)

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3750 on: May 17, 2013, 02:59:00 pm »

hmm... is plugin for sorting gem list by material value possible?

Look at the gem stockpile list. Then open up inorganic_stone_gem.txt. What you should notice is that the list is arranged in the exact same order that they are in the file. Just shuffle them around to your liking and voilą.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #3751 on: May 17, 2013, 04:27:54 pm »

It probably wouldn't be too difficult to write a script to do it - it would just require iterating across all inorganics, filtering out which ones are gems, and further filtering their "category" according to their value.
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.

drayath

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3752 on: May 17, 2013, 06:52:24 pm »

A quick helper script for cleaning up fired ammo.
Useful both for map cleaning, and destroying fired ammo so that workflow will replace it.
Sets all ammo in stack sizes of 1 for dumping and unforbids it. Use 'autodump'/'autodump destroy' afterwards to move/destroy marked ammo.

nb/ If you are using a mod that create a single unit of some special ammo type, this will also get marked for dumping.

Spoiler (click to show/hide)
Logged
Drayath's Gem Splitting Workshop - Split large gems and gem trinkets into numbers of small gems.
Drayath's Seed Brewery - Convert bags of spare seeds into useful booze.

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3753 on: May 17, 2013, 07:48:28 pm »

Is there anything in this that we can use to force them to put an injured dwarf back in bed or diagnose one?
Logged

drayath

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3754 on: May 17, 2013, 09:47:14 pm »

crossmr, try the following script. Marks the selected dwarf (main game or unit list) as needing diagnosis and requiring someone to carry them to hospital.

This should force re-diagnosis of an injury and get dwarf to a valid bed, it does nothing special to force an injured dwarf to stay in bed.


Spoiler (click to show/hide)
Logged
Drayath's Gem Splitting Workshop - Split large gems and gem trinkets into numbers of small gems.
Drayath's Seed Brewery - Convert bags of spare seeds into useful booze.

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3755 on: May 18, 2013, 12:49:29 am »

crossmr, try the following script. Marks the selected dwarf (main game or unit list) as needing diagnosis and requiring someone to carry them to hospital.

This should force re-diagnosis of an injury and get dwarf to a valid bed, it does nothing special to force an injured dwarf to stay in bed.


Spoiler (click to show/hide)

I've never used a script before... is there a guide somewhere on how to set this up?
Logged

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3756 on: May 18, 2013, 01:12:06 am »

well I created an injureddwarffix.rb file and pasted that text into it, and selected the dwarf in game, when I try to call the script i just says error loading script. No idea if I'm doing it right though.
Logged

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3757 on: May 18, 2013, 01:16:19 am »

Urist Da Vinci: I once tried adding poisonous giant mushrooms to the first cavern. You cant distinguish them from the other giant mushroom trees, but when felled they generated an evaporating log that had a slightly-harmful syndrome attached.

In short, cutting mushrooms in the caverns had a little danger attached to it.

The problem I encountered is that the wagon, any wooden embark item, and any wooden caravan item has a chance to consist of this wood. The caravan appears on the map, the wood evaporates, caravans is affected and turns around. Or you wagon deconstructs at embark, same for barrels holding your booze.

Question: Can your script remove this specific wood from a civs embark/trading, so that I can add poisonous mushrooms back into the caverns?

Yep. The following script will allow you to SEE what wood that the player's civ can bring:
Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)

for k,v in pairs(my_entity.resources.organic.wood.mat_type) do
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
print(sText)

if (sText==nil) then
--print("nil")
else
--print("OK")
print(sText.plant.id)
end
end

FAKEEDIT: It's a bit more complicated.
Can't just purge the wood type - that only prevents them from bringing logs (and the embark wagon itself), training weapons, trap components, toys, instruments, and tools. Presumably also wood armor for elves.

Have to also seperately find and drop the wood from the crafts, barrels, buckets, splints, and crutches. Will take a few more minutes to code.

EDIT:

Remove the dreaded CEDAR trees from all spots that I could find in the resources of all civs in the world! Do a text replace if you want to target another tree type. Run the script before embark if you don't want a 2% chance of the embark wagon exploding in poison gas.
Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y

k=0
while k < #my_entity.resources.organic.wood.mat_index do
v=my_entity.resources.organic.wood.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.crafts.mat_index do
v=my_entity.resources.misc_mat.crafts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.barrels.mat_index do
v=my_entity.resources.misc_mat.barrels.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.wood2.mat_index do
v=my_entity.resources.misc_mat.wood2.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k])
if (sText==nil) then
--LIQUID wood2
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.cages.mat_index do
v=my_entity.resources.misc_mat.cages.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k])
if (sText==nil) then
--LIQUID cages
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end


end
« Last Edit: May 18, 2013, 01:48:52 am by Urist Da Vinci »
Logged

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3758 on: May 18, 2013, 03:59:38 am »

As it was, 8 months after he was last worked on, someone finally put him back in a bed and he got his dressing, but he still needs 6 immobilizations.
would still like to know how to make this script work though.
Logged

scriver

  • Bay Watcher
  • City streets ain't got much pity
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3759 on: May 18, 2013, 05:23:48 am »

or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
Logged
Love, scriver~

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3760 on: May 18, 2013, 06:29:45 am »

or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
It's in the next release of it (i think).

drayath

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3761 on: May 18, 2013, 10:30:00 am »

Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Logged
Drayath's Gem Splitting Workshop - Split large gems and gem trinkets into numbers of small gems.
Drayath's Seed Brewery - Convert bags of spare seeds into useful booze.

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3762 on: May 18, 2013, 10:45:59 am »

Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.
« Last Edit: May 18, 2013, 10:51:59 am by crossmr »
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3763 on: May 18, 2013, 06:16:39 pm »

Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.

The script command isn't what you use to run ruby or lua scripts.  It's confusing, I know.  script is only for running console commands in a kind of batch mode.

To run a ruby or lua script, put the script in the hack/scripts/ directory (I think you've done this) and just type the script name, without the .rb or .lua extension.

So just type medic at the dfhack command prompt.
Logged

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3764 on: May 18, 2013, 06:56:40 pm »

Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.

The script command isn't what you use to run ruby or lua scripts.  It's confusing, I know.  script is only for running console commands in a kind of batch mode.

To run a ruby or lua script, put the script in the hack/scripts/ directory (I think you've done this) and just type the script name, without the .rb or .lua extension.

So just type medic at the dfhack command prompt.

That's a good start. Is there a way to force them to get treated?
That dwarf is too injured to do anything.. He's got red body parts, he actually has open wounds.. but when I mark him needing a doctor, he just runs out of the hospital (as fast as he can hobble)

I also had a migrant show up, at the edge of the map, with no red body parts, but having sustained major injury, with a bruised lower spine. He blinks all the time and moves extremely slow.. I tagged him for needing a medic but nada...
okay well I tagged him multiple times and this time he stayed in bed and got diagnosed for cleaning..but they don't seem to want to do anything about the smashed open bones.
Logged
Pages: 1 ... 249 250 [251] 252 253 ... 373