Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 290 291 [292] 293 294 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1456279 times)

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4365 on: August 05, 2013, 06:41:59 pm »

OK, log-region updated – thanks again. 

Spoiler: new edition (click to show/hide)

Outputs: 
Quote
*** STARTING NEW GAME ***
** Loading Fortress **
Loaded region2, Boldoltar (The Cyclopean Land) at coordinates (139,155)
 Loaded the fortress Sazirust (Bridgebreach), colonized by the group Idithmestthos (The Systemic Citadel) of the civilization Endok Limar (The Attic of Wealths).
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4366 on: August 05, 2013, 11:08:22 pm »

I also found this script while reading through custom ones that have been posted:
Code: [Select]
MEDIC.RB. Mark unit as requiring a medic.

# 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

As far as I understand it you look at a dwarf with 'k', then run the script, and the job-priority for diagnosis and rescue go up. So if an injured dwarf is lying, ignored, on a battlefield, or the chief medical dwarf is for some reason not diagnosing a patient in the hospital, then this script will help?

To sum it up:
#1: Can a script be automatically run once the embark screen/map opens?
#2: Can this script open a small pop-up that accepts a number as entry, for the startdwarf.rb script?
#3: Could someone please be so kind (if #1 has a yes as answer), to change the script to target all civs, instead of just the players civ?
#4: Can the above-shown scripts be altered to show/erase available creatures/pets?
#5: Does anyone have experience with the medic.rb script and could give a short readme for it?

I think that script just adds a job, I don't believe it actually increases the job's priority... although that would be a great thing...

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #4367 on: August 08, 2013, 11:40:08 am »

I just had a completely random idea, but please tell me this is possible: Weather Rain/Snow/Clear controls the weather. Weather Interactions control which material is rained, or appears as cloud of mist/fog.

Can this be combined? Can a plugin/script call a specific weather interaction, or simulate one by making it rain blood... or sludge... or beer... sulfur...?

In short: Can the custom weather interactions be started by a script, disregarding which biome they usually appear in? That would be awesome.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

catvanbrian

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4368 on: August 08, 2013, 04:11:36 pm »

how do you create a creature in arena mode ( that can be aseesed with mode set
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4369 on: August 08, 2013, 04:14:51 pm »

Aseesed?

catvanbrian

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4370 on: August 08, 2013, 04:22:51 pm »

« Last Edit: August 08, 2013, 04:25:04 pm by catvanbrian »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4371 on: August 08, 2013, 04:25:48 pm »

Oh, accessed.

Suds Zimmerman

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4372 on: August 08, 2013, 11:23:23 pm »

Is it possible to remove reactions from workshops at the individual workshop level (i.e. bone polishing workshop 1 stripped of all reactions whilst all others can still be operated normally.) Failing that, is it possible to spawn and despawn workshops? Preferably whilst keeping their preferences intact. (Storing and loading them, perhaps?) For clarity's sake, I'm talking about custom workshops only.
Logged
You don't need a weatherman to know which way the wind blows
DORFAMUNDA - NECROMUNDA DF MOD

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4373 on: August 09, 2013, 09:29:12 am »

Hi, I would like to give a skill to a creature that does not have it.

If the creature has learnt it (at least dabbling), I can access it all right with unit.status.current_soul.skills[skill].

But if the creature never had the skill, it is not there. Judging from the bindings I need to create this structure here and inject it to the above vector but I could not figure how.

Is it possible to create an instance of this structure? I tried unit.unit_skill.new() without success (unit_skill undefined).

here's an example of what I am trying to do from the fixMakeown lua script :
new_nemesis = df.nemesis_record:new()
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4374 on: August 09, 2013, 09:58:59 am »

Is there an array that holds the fortress jobs. does the order affect the priority

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #4375 on: August 09, 2013, 10:03:03 am »

Boltgun, here is the make_legendary.lua script. It can add skills to any dwarf, so the solution you are looking for is probably in the code. Hope it helps.

Code: [Select]
-- This script will modify skills, or a single skill, of a unit
-- usage is:  target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 3, 20130123, for DF(hack) 34.11 r2
-- Praise Armok!

function make_legendary(skillname)
local skillnamenoun,skillnum
unit=dfhack.gui.getSelectedUnit()

if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end

if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')
print (unit.name.first_name.." is now a Legendary "..skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end

function PrintSkillList()
local i
for i=0, 115 do
print("'"..df.job_skill.attrs[i].caption.."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])

end
print ("Provide the UPPER CASE argument, for example: PROCESSPLANTS rather than Threshing")
end

function BreathOfArmok()
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end
local i
utils = require 'utils'
for i=0, 115 do
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
print ("The breath of Armok has engulfed "..unit.name.first_name)
end

function LegendaryByClass(skilltype)
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

utils = require 'utils'
local i
local skillclass
for i=0, 115 do
skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if skilltype == skillclass then
print ("Skill "..df.job_skill.attrs[i].caption.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
end
end

function PrintSkillClassList()
local i
for i=0, 8 do
print(df.job_skill_class[i])
end
print ("Provide one of these arguments, and all skills of that type will be made Legendary")
print ("For example: Medical will make all medical skills legendary")
end

--main script operation starts here
----
local opt = ...
local skillname

if opt then
if opt=="list" then
PrintSkillList()
return
end
if opt=="classes" then
PrintSkillClassList()
return
end
if opt=="all" then
BreathOfArmok()
return
end
if opt=="Normal" or opt=="Medical" or opt=="Personal" or opt=="Social" or opt=="Cultural" or opt=="MilitaryWeapon" or opt=="MilitaryAttack" or opt=="MilitaryDefense" or opt=="MilitaryMisc" then
LegendaryByClass(opt)
return
end
skillname = opt
else
print ("No skillname supplied.  Pass argument 'list' to see a list, 'classes' to show skill classes, or use 'all' if you want it all!")
return
end

make_legendary(skillname)

And:
Quote
I just had a completely random idea, but please tell me this is possible: Weather Rain/Snow/Clear controls the weather. Weather Interactions control which material is rained, or appears as cloud of mist/fog.

Can this be combined? Can a plugin/script call a specific weather interaction, or simulate one by making it rain blood... or sludge... or beer... sulfur...?

In short: Can the custom weather interactions be started by a script, disregarding which biome they usually appear in? That would be awesome.
« Last Edit: August 09, 2013, 10:05:25 am by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4376 on: August 09, 2013, 10:04:31 am »

Hi, I would like to give a skill to a creature that does not have it.

If the creature has learnt it (at least dabbling), I can access it all right with unit.status.current_soul.skills[skill].

But if the creature never had the skill, it is not there. Judging from the bindings I need to create this structure here and inject it to the above vector but I could not figure how.

Is it possible to create an instance of this structure? I tried unit.unit_skill.new() without success (unit_skill undefined).

here's an example of what I am trying to do from the fixMakeown lua script :
new_nemesis = df.nemesis_record:new()

It's df.unit_skill:new().

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4377 on: August 09, 2013, 12:48:18 pm »

It's df.unit_skill:new().

Thank you. This did not work in ruby so I guess I will stick to Luanda.
Logged

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4378 on: August 09, 2013, 09:01:19 pm »

Is there an array that holds the fortress jobs. does the order affect the priority

df.global.world.job_list

It's a doubly linked list you can traverse like this

job = df.global.world.job_list
while job do
  print(job.item.id)  -- or whatever
  job = job.next
end

job.prev lets you go backwards.

All jobs seem to be LIFO.  Maybe someone else has done more testing on this.  New jobs are added to the end of the list.  You could try to relink a job to the end to see if it gets done faster.

Under trivia, wall construction jobs are added top to bottom, left to right.  So a 2x2 wall constructed will be built in the order. 
Code: [Select]
42
31
The reverse of the jobs creation order.
Logged

falconne

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4379 on: August 09, 2013, 09:46:55 pm »

df.global.world.job_list

It's a doubly linked list you can traverse like this

job = df.global.world.job_list
while job do
  print(job.item.id)  -- or whatever
  job = job.next
end

job.prev lets you go backwards.

All jobs seem to be LIFO.  Maybe someone else has done more testing on this.  New jobs are added to the end of the list.  You could try to relink a job to the end to see if it gets done faster.

A while back I wanted to create a job priority plugin, so the first thing I tried was rearranging the jobs in that list to put the high priority ones at the end. That didn't work... the way the job assignment seemed to work was that when a dwarf finished their current job, they next look for the (spatially) closest available job they can do. I only did a limited test though; I might have missed something.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.
Pages: 1 ... 290 291 [292] 293 294 ... 373