Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 106 107 [108] 109 110 ... 360

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

MAurelius

  • Bay Watcher
  • Philosopher King
    • View Profile
    • Marcus Aurelius Let's Play
Re: DFHack 0.40.19-r1
« Reply #1605 on: December 06, 2014, 09:23:51 pm »

I'm probably doing something wrong but when I type in "remove-stress all" I get the following error:
 
Oh, it won't let me copy and past. Damn. Well, here's my attempt at transcribing:

error parsing arg 1: all
stack traceback:
[C]: in function 'error'
(filepath) utils.lua:607: in function 'processArgs'
(filepath) remove-stress.lua:13: in main chunk
<...tail calls...>

When I try just remove-stress it tells me to click a dwarf. I would prefer to not do that 200 times. :)

Thanks!
Logged

StagnantSoul

  • Bay Watcher
  • "Player has withdrawn from society!"
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1606 on: December 06, 2014, 09:25:52 pm »

Is elevate-physical gone in the new version?
Logged
Quote from: Cptn Kaladin Anrizlokum
I threw night creature blood into a night creature's heart and she pulled it out and bled to death.
Quote from: Eric Blank
Places to jibber madly at each other, got it
Quote from: NJW2000
If any of them are made of fire, throw stuff, run, and think non-flammable thoughts.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1607 on: December 06, 2014, 09:27:30 pm »

Heh, probably should have posted this earlier.
Code: [Select]
-- Allows ectobiology.

-- where doing it man

-- where MAKING THIS HAPEN

local function getCitizenList(lovers_only)
    local citizenTable={}
    if lovers_only then
        for k,u in ipairs(df.global.world.units.active) do
            if dfhack.units.isCitizen(u) and (u.relations.spouse_id~=-1 or u.relations.lover_id~=-1) then
                table.insert(citizenTable,{dfhack.TranslateName(dfhack.units.getVisibleName(u)),nil,u})
            end
        end
    else
        for k,u in ipairs(df.global.world.units.active) do
            if dfhack.units.isCitizen(u) then
                table.insert(citizenTable,{dfhack.TranslateName(dfhack.units.getVisibleName(u)),nil,u})
            end
        end
    end
    return citizenTable
end

local function getSpouseOrLover(unit)
    local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id)
    if lover_unit then
        return lover_unit.hist_figure_id
    else
        local hist_fig=df.historical_figure.find(unit.hist_figure_id)
        for k,v in ipairs(hist_fig.histfig_links) do
            if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then
                return v.target_hf
            end
        end
    end
end

local function getFemaleCasteWithSameMaxAge(unit)
    local curCaste=df.creature_raw.find(unit.race).caste[unit.caste]
    for k,caste in ipairs(df.creature_raw.find(unit.race).caste) do
        if caste.gender==0 and caste.misc.maxage_min==curCaste.misc.maxage_min and caste.misc.maxage_max==curCaste.misc.maxage_max then return k end
    end
end

local function ectobiologize(freeform)
    local script=require('gui.script')
    script.start(function()
    local citizens=getCitizenList(not freeform)
    if #citizens==0 then script.showMessage('Ectobiology',"Nobody is in a relationship! Best use freeform ectobiology.",COLOR_WHITE) return end
    if freeform then
        local ok1,name1,unit1_t=script.showListPrompt("Ectobiology","Choose first paradox ghost slime target.",COLOR_WHITE,citizens)
        local ok2,name2,unit2_t=script.showListPrompt("Ectobiology","Choose second paradox ghost slime target.",COLOR_WHITE,citizens)
        local unit1=unit1_t[3]
        local unit2=unit2_t[3]
        unit1.relations.pregnancy_timer=1
        unit1.relations.pregnancy_genes=unit1.appearance.genes:new()
        unit1.relations.pregnancy_spouse=unit2.hist_figure_id
        unit1.relations.pregnancy_caste=unit2.caste
        dfhack.run_script('modtools/add-syndrome','-syndrome','temp desterilize','-target',unit1.id)
        if unit1.sex==1 then
            local normal_caste=unit1.enemy.normal_caste
            unit1.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit1)
            script.sleep(1,'ticks')
            unit1.enemy.normal_caste=normal_caste
        end
    else
        local ok,name,unit_t=script.showListPrompt("Ectobiology","Choose first genetic material giver.",COLOR_WHITE,citizens)
        local unit=unit_t[3]
        local lover=getSpouseOrLover(unit)
        unit.relations.pregnancy_timer=1
        unit.relations.pregnancy_genes=unit.appearance.genes:new()
        unit.relations.pregnancy_spouse=lover
        unit.relations.pregnancy_caste=df.historical_figure.find(lover).caste
        dfhack.run_script('modtools/add-syndrome','-syndrome','temp desterilize','-target',unit.id)
        if unit.sex==1 then
            local normal_caste=unit.enemy.normal_caste
            unit.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit)
            script.sleep(1,'ticks')
            unit.enemy.normal_caste=normal_caste
        end
    end
    end)
end
local utils=require('utils')

validArgs = validArgs or utils.invert({
 'freeform'
})

local args = utils.processArgs({...}, validArgs)

ectobiologize(args.freeform)

Run the script and it'll show you a list of every unit with a lover/spouse, regardless of the unit's sex or the lover's. Select a unit and the unit will immediately have a baby with the lover as the "father", again regardless of the unit's sex or the lover's. The game really works well with it, too.

It's called "ectobiology.lua" because I made it for Fortbent, but it would probably do well otherwise named.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1608 on: December 06, 2014, 09:37:28 pm »

Is elevate-physical gone in the new version?
That's never been included in the DFHack repo - it's one of Vjek's scripts.
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.

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1609 on: December 06, 2014, 09:39:35 pm »

You still want some kind of reaction product, otherwise the reaction takes no time and generates no experience.

This is not a problem.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1610 on: December 06, 2014, 09:56:17 pm »

Hmmm, is it necessary to use libpng12 when building this with stonesense, or could it be done with a more up to date library?

Code: [Select]
libpng12.so.0: wrong ELF class: ELFCLASS64
Can't load plugin /path/to/df19/hack/plugins/stonesense.plug.so

That's a heck of a thing.
« Last Edit: December 06, 2014, 09:58:18 pm by Max™ »
Logged

SlicedAndDiced

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1611 on: December 07, 2014, 02:18:17 am »

I am having trouble using the "changeitem" function in adventure mode.  I highlight the item using "l" and it even says "here we have a XXXXXX" but when i type  in the Command "changeitem q 5", it says the following "No item is selected"

Am i doing something wrong here?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1612 on: December 07, 2014, 02:22:53 am »

Press the button to actually go into the item's screen, it's only selected if you do that.

SlicedAndDiced

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1613 on: December 07, 2014, 02:31:26 am »

Press the button to actually go into the item's screen, it's only selected if you do that.
so when i have it highlighted and go to the menu where you can see it's weight and etc. Already tried it not working

Ok this time i went to item screen it didn't work, when I put the command "changeitem q 5:" but if you put add "here" in it works.
So like "changeitem here q 5"

thankyou
« Last Edit: December 07, 2014, 02:43:45 am by SlicedAndDiced »
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1614 on: December 07, 2014, 12:42:17 pm »

I'm not sure if this is possible, but I've seen a LOT of people get confused by the stuck-Alt-key issue and complain in the Starter Pack thread.

When DFHack's hotkey infrastructure hears an Alt-up event, can it stuff an Alt-up event into DF's window?  Since Alt itself doesn't do anything, false-positives (Alt-Tabbing in from Dwarf Therapist or a web browser) shouldn't do any harm.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1615 on: December 07, 2014, 01:51:41 pm »

Are you sure this is caused by DFHack? I know it's noticeable with DFHack keybindings, but could you see if it occurs with vanilla DF?
I don't believe this has anything to do with the SDL version, although you could try upgrading to 1.2.15. It may be a conflict with other utilities, a problem with how DFHack handles keybindings, or a problem with DF itself. Speaking of this, could you (or anyone else on Windows) try to reproduce it without any utilities and post your findings in the report?
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.

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1616 on: December 07, 2014, 04:39:51 pm »

Are you sure this is caused by DFHack? I know it's noticeable with DFHack keybindings, but could you see if it occurs with vanilla DF?

I've played for quite a bit in 4.19 without DFHack and built quite a few statues. It's not yet tried to build an Alt-s Slab by mistake yet.
Also using Alt-s to build slabs doesn't ever seem to make the Alt key 'stick'. I'm also Alt-tabbing a lot to Dwarf Therapist with no obvious problems. Installing DFHack causes problems (solved by tapping Alt once) almost immediately.

I guess that's not very helpful, apart from to say Alt seems to 'stick' at random without ever actually having to press it and hasn't yet occurred in several hours of 4.19 vanilla play. Does anyone have a definite way to make it happen yet?
Logged

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1617 on: December 07, 2014, 06:34:16 pm »

Is elevate-physical gone in the new version?
I'm going to be testing all my scripts with the current (40.19) df/dfhack this week, and updating the wiki page to reflect any changes.  They might work perfectly at the moment, they might burn down your house, not sure yet. :)

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1618 on: December 07, 2014, 07:36:26 pm »

Code: [Select]
-- lets babies be adopted by couples with no infants.

local function getSpouseOrLover(unit)
    local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id)
    if lover_unit then
        return lover_unit.hist_figure_id
    else
        local hist_fig=df.historical_figure.find(unit.hist_figure_id)
        for k,v in ipairs(hist_fig.histfig_links) do
            if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then
                return v.target_hf
            end
        end
    end
    return false
end

local function getNumberOfChildren(unit)
    local children=0
    for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
        if df.histfig_hf_link_childst:is_instance(v) then children=children+1 end
    end
    return children
end

local function figureIsAlive(hist_figure)
    return hist_figure.died_year==-1
end

local function unitIsChild(unit)
    return df.global.cur_year-unit.relations.birth_year<12
end

local function unitIsOrphan(unit)
    if unitIsChild(unit) then
        local fatherIsAlive,motherIsAlive=false,false
        for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
            if df.histfig_hf_link_motherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then motherIsAlive=true end
            elseif df.histfig_hf_link_fatherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then fatherIsAlive=true end           
            end
        end
        return (fatherIsAlive or motherIsAlive)
    end
    return false
end

local function adopt(baby,couple)
    local mother,father=false,false
    if df.historical_figure.find(couple.unit).sex==0 then
        mother=couple.unit
        father=couple.lover --yeah, the "father" will be female if the unit's lover is female, but the game will correctly display both as "mother"
    else
        father=couple.unit
        mother=couple.lover --similar to the above, the "mother" will be male if the unit's lover is male, but they'll both be "father" pretty elegantly.
    end
    local mother_fig=df.historical_figure.find(mother)
    local father_fig=df.historical_figure.find(father)
    local baby_hist_fig=df.historical_figure.find(baby.hist_figure_id)
    for k,v in ipairs(baby_hist_fig.histfig_links) do
        if df.histfig_hf_link_motherst:is_instance(v) then
            v.target_hf=mother --yeah, adoption will remove any relation other than genetics between biological parents and children.
        elseif df.histfig_hf_link_fatherst:is_instance(v) then
            v.target_hf=father
        end
    end
    mother_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    father_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    baby.relations.mother_id=mother_fig.unit_id
    baby.relations.father_id=father_fig.unit_id
    local message = dfhack.TranslateName(mother_fig.name) .. ' and ' .. dfhack.TranslateName(father_fig.name) .. ' have adopted ' .. dfhack.TranslateName(dfhack.units.getVisibleName(baby)) .. '.'
    dfhack.gui.showAnnouncement(message)
    dfhack.gui.writeToGamelog(message) --too lazy to use makeAnnouncement right now
end

local function findBabiesWithNoParents()
    local couples_histfig={}
    local orphans={}
    for k,unit in ipairs(df.global.world.units.active) do
        if dfhack.units.isCitizen(unit) then
            local spouseOrLover=getSpouseOrLover(unit)
            if spouseOrLover then
                couples_histfig[unit.hist_figure_id]=couples_histfig[unit.hist_figure_id] or {children=getNumberOfChildren(unit),lover=spouseOrLover,unit=unit.hist_figure_id}
                couples_histfig[spouseOrLover]=true --this weird sequence of crap makes it so that 1. I can easily cull redundant units and 2. I can still sort the table
            elseif unitIsOrphan(unit) then
                table.insert(orphans,unit)
            end
        end
    end
    local couples={}
    for k in pairs(couples_histfig) do
        if couples[k]==true then couples[k]=nil end --not doing this will make an error show up when sorting the couples table due to true.children being nonsense
    end
    for k,v in pairs(couples_histfig) do
        table.insert(couples,v) --makes the keys of the couples table be 1,2,3 etc. instead of being all over the place as histfigs
    end
    table.sort(couples,function(a,b) return a.children<b.children end)
    if #orphans>1 then
        for k,orphan in ipairs(orphans) do
            adopt(orphan,math.ceil(couples[k]/2))
        end
    end
end

require('repeat-util').scheduleUnlessAlreadyScheduled('Orphan Adoption Service',1,'days',findBabiesWithNoParents)

Adoption! It takes childless parents and gives them parents from couples.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.19-r1
« Reply #1619 on: December 08, 2014, 12:25:56 am »

Now that is a hell of a thing, good job!

Still can't figure out why stonesense wants libpng12, or why I can only find 64 bit versions of it when stonesense apparently wants a 32 bit version...
Logged
Pages: 1 ... 106 107 [108] 109 110 ... 360