Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: Urist McTeellox on January 15, 2014, 04:56:31 pm

Title: DFHack Script Collection
Post by: Urist McTeellox on January 15, 2014, 04:56:31 pm
DFHack Script Collection

Here are a list of additional scripts for DFHack. Please add any you know about to this list:



This top-post is generated automatically!  You can edit it in markdown format (https://github.com/pjf/masterwork-dwarf-fortress/wiki/DFHack-Script-Collection) if you think it's missing something.  Be bold with your edits, they're easy to undo!
Title: Re: DFHack Script Collection
Post by: Urist McTeellox on January 15, 2014, 04:56:51 pm
Hi everyone,

Meph nudged me and said it would be great to have a post that keeps track of all the third-party DFHack scripts. And it would be even better if anyone could edit that post to make sure it stay up to date.

As it happens, I have the ability to turn wiki pages into automatically updating phpBB forum posts. So in a couple of minutes this top-post is going to be replaced with wiki content.  In the meantime, you can edit the wiki-page used to generate it here (https://github.com/pjf/masterwork-dwarf-fortress/wiki/DFHack-Script-Collection).

I'll also duplicate this information in the second post, so it doesn't get lost. There'll also be a short discussion on how you and do this yourself (all the tools are open source), but only after I've had a coffee. :)

Many thanks,

~ T
Title: Re: DFHack Script Collection
Post by: milo christiansen on January 15, 2014, 04:58:02 pm
AWSOME! I'll add my announce script right now...
Title: Re: DFHack Script Collection
Post by: Meph on January 15, 2014, 05:16:06 pm
Just as a completion, I will leave this here as well. Its also an announcement script. Its way inferior to milos, since this one has hardcoded announcements in the script, and needs an inorganic/interaction to call it. milo christiansen version adds the announcements into the inorganics/interactions directly, which takes out one work step.

Spoiler: Announcement.lua (click to show/hide)
Spoiler: Announcement Readme (click to show/hide)
Title: Re: DFHack Script Collection
Post by: milo christiansen on January 15, 2014, 05:29:58 pm
Why don't you take a look at my script :)
The messages are specified in the raws rather than in the script, so adding new messages is MUCH easier, plus it writes to the gamelog...

(Actually it's not all my script, I made the first version then... (I forget who, one of the DFHack experts) polished up my lua a little, then I made further edits until it was perfect.)
Title: Re: DFHack Script Collection
Post by: Putnam on January 15, 2014, 11:17:50 pm
I decided to be bold and add all of mine.
Title: Re: DFHack Script Collection
Post by: Boltgun on January 16, 2014, 05:24:12 am
I went bolder in my a few scripts of mine.
Title: Re: DFHack Script Collection
Post by: Warmist on January 16, 2014, 06:07:18 am
natural skills should be incorporated into spawn unit script really because afaik it's the only source of units not having natural skills set.
Title: Re: DFHack Script Collection
Post by: Boltgun on January 16, 2014, 06:24:04 am
natural skills should be incorporated into spawn unit script really because afaik it's the only source of units not having natural skills set.

Transformations also cause that, I originally wrote because I was using trueTransform in my mod. However it is true that spawnunit can use this. I'll have a look.
Title: Re: DFHack Script Collection
Post by: expwnent on January 16, 2014, 11:19:30 am
Posting to watch.
Title: Re: DFHack Script Collection
Post by: Putnam on January 16, 2014, 02:44:08 pm
I'm damn impressed by that AI so far, btw.
Title: Re: DFHack Script Collection
Post by: fricy on January 16, 2014, 03:46:24 pm
ptw
Title: Re: DFHack Script Collection
Post by: Meph on January 17, 2014, 03:00:53 pm
dwarves.rb - type "dwarves #" at the embark selector/map before you embark. It will raise your starting dwarves to the number you entered.

Code: [Select]
# patch start dwarf count

nr = $script_args[0].to_i

raise 'too low' if nr < 7

addr = df.get_global_address('start_dwarf_count')
df.memory_patch(addr, [nr].pack('L'))

points.lua - type "points #" at the embark selector/map before you embark. It will raise your embark points to that number.
Code: [Select]
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)
Title: Re: DFHack Script Collection
Post by: Roses on January 18, 2014, 03:57:26 pm
Added a link to my set of scripts.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on January 19, 2014, 12:58:31 pm
I'll add mine as they come out.  I might update occasionally though.
Added constructCreature to start.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on January 21, 2014, 12:15:46 pm
Added a physically damaging slam interaction (that can explode targets at high enough power) and an exile script that lets you instruct creatures to leave the map (warning: 'exile member all' and 'exile any all' will instantly end your fortress).
Title: Re: DFHack Script Collection
Post by: Warmist on January 22, 2014, 12:38:01 pm
Added spawn unit script. Should probably split it into lib+script so that other scripts could easily (i.e. with require('hack.scripts.spawn-unit')) use it.
Title: Re: DFHack Script Collection
Post by: Urist Mc Dwarf on January 25, 2014, 04:20:17 pm
Question, how do I get a script to work? i've downloaded and placed into my scripts folder hackWish, but it doesn't show up in DFhack and when I try to run it it doesn't work.
Title: Re: DFHack Script Collection
Post by: Putnam on January 25, 2014, 04:22:52 pm
What kind of file is it?
Title: Re: DFHack Script Collection
Post by: Urist Mc Dwarf on January 25, 2014, 04:31:36 pm
TAR
Title: Re: DFHack Script Collection
Post by: Putnam on January 25, 2014, 04:49:54 pm
You need to extract that with 7zip or what-have-you and put it into a .lua file.

Or you could just make a new .lua file called hackWish.lua, place it in the scripts folder, open it with notepad and paste all the contents in.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on February 02, 2014, 06:44:43 pm
Added a spell that creates a pit under the target leading straight to the Underworld.  Instant death by splatting, glowing pit, or being eaten by demons.  It does not typically trigger a demon invasion unless you happen to pierce the center of an adamantine vein or demonic fortress.

EDIT: Updated the hfspit spell.  It now automatically walls off water and magma pools to prevent framerate damage.  There are also parameters for size of the pit, whether or not it has walls leading all the way down (to keep flying cave-dwellers from using it to path to the surface), and an option to add a stairway (adding a stairway is a bad idea, as it will allow demons to path to the surface even if you don't trigger an actual invasion.)
Title: Re: DFHack Script Collection
Post by: Warmist on February 08, 2014, 04:09:10 pm
Updated unitspawn to create nemesis (in non-crashy way).
Title: Re: DFHack Script Collection
Post by: IndigoFenix on February 10, 2014, 12:14:01 pm
Warmist, I'm trying to make a script based on rip-heart, but the body part created can't be picked up or interacted with normally.  Did you ever figure out why and how to fix it?
Title: Re: DFHack Script Collection
Post by: Warmist on February 10, 2014, 12:53:24 pm
Warmist, I'm trying to make a script based on rip-heart, but the body part created can't be picked up or interacted with normally.  Did you ever figure out why and how to fix it?
Ah forgot to set a flag in tile.
Edit:Nope thats not it... not sure why does it make unpickable heart...
Edit2: fixed it: i forgot to categorize item after creation.
Title: Re: DFHack Script Collection
Post by: smjjames on February 10, 2014, 02:07:51 pm
The heal unit script can be used to resurrect adventurers right? I asked someone who mentioned about resurrecting their adventurer and they mentioned this script.
Title: Re: DFHack Script Collection
Post by: Meph on February 10, 2014, 02:35:53 pm
Updated unitspawn to create nemesis (in non-crashy way).
:o
Title: Re: DFHack Script Collection
Post by: Warmist on February 11, 2014, 12:22:14 am
Updated unitspawn to create nemesis (in non-crashy way).
:o
Also updated it for spawned units to work as nobles: though only if your race is same as theirs.
Title: Re: DFHack Script Collection
Post by: Putnam on February 11, 2014, 01:32:45 am
I'm currently in the process of updating hackwish to (optionally) only allow stockpilable items to be made and (again, optionally) have even stricter requirements so that only items that can technically be made in-game can be made (say, only allowing weapons to be made of ITEMS_WEAPON materials).

I may also integrate it with spawnUnit if you try to make a pet, but that would be far more complex and would also kinda require spawnunit to be a lua library.

WIP:

Code: [Select]
-- Allows for script-based wishing.

function getCreatureID(creatureRaw)
    return df.global.world.creatures.list_creature[creatureRaw.caste[0].index]
end

function createItem(mat,itemType,quality,pos)
    local item=df[df.item_type.attrs[itemType[1]].classname]:new() --incredible
    item.id=df.global.item_next_id
    df.global.world.items.all:insert('#',item)
    df.global.item_next_id=df.global.item_next_id+1
    item:setSubtype(itemType[2])
    item:setMaterial(mat[1])
    item:setMaterialIndex(mat[2])
    item:categorize(true)
    item.flags.removed=true
    item:setSharpness(1,0)
    item:setQuality(quality-1)
    dfhack.items.moveToGround(item,{x=pos.x,y=pos.y,z=pos.z})
end
 
function qualityTable()
    return {{'None'},
    {'-Well-crafted-'},
    {'+Finely-crafted+'},
    {'*Superior*'},
    {string.char(240)..'Exceptional'..string.char(240)},
    {string.char(15)..'Masterwork'..string.char(15)}
    }
end
 
local script=require('gui/script')
 
function showItemPrompt(text,item_filter,hide_none)
    require('gui.materials').ItemTypeDialog{
        prompt=text,
        item_filter=item_filter,
        hide_none=hide_none,
        on_select=script.mkresume(true),
        on_cancel=script.mkresume(false),
        on_close=script.qresume(nil)
    }:show()
   
    return script.wait()
end

function showMaterialPrompt(title, prompt, filter, inorganic, creature, plant) --the one included with DFHack doesn't have a filter or the inorganic, creature, plant things available
    require('gui.materials').MaterialDialog{
        frame_title = title,
        prompt = prompt,
        mat_filter = filter,
        use_inorganic = inorganic,
        use_creature = creature,
        use_plant = plant,
        on_select = script.mkresume(true),
        on_cancel = script.mkresume(false),
        on_close = script.qresume(nil)
    }:show()

    return script.wait()
end

function getMatFilter(itemtype)
        local itemTypes={
            SEEDS=function(mat,parent,typ,idx)
                return mat.flags.SEED_MAT
            end,
            PLANT=function(mat,parent,typ,idx)
                return mat.flags.STRUCTURAL_PLANT_MAT
            end,
            LEAVES=function(mat,parent,typ,idx)
                return mat.flags.LEAF_MAT
            end,
            MEAT=function(mat,parent,typ,idx)
                return mat.flags.MEAT
            end,
            CHEESE=function(mat,parent,typ,idx)
                return (mat.flags.CHEESE_PLANT or mat.flags.CHEESE_CREATURE)
            end,
            LIQUID_MISC=function(mat,parent,typ,idx)
                return (mat.flags.LIQUID_MISC_PLANT or mat.flags.LIQUID_MISC_CREATURE or mat.flags.LIQUID_MISC_OTHER)
            end,
            POWDER_MISC=function(mat,parent,typ,idx)
                return (mat.flags.POWDER_MISC_PLANT or mat.flags.POWDER_MISC_CREATURE)
            end,
            DRINK=function(mat,parent,typ,idx)
                return (mat.flags.ALCOHOL_PLANT or mat.flags.ALCOHOL_CREATURE)
            end,
            GLOB=function(mat,parent,typ,idx)
                return (mat.flags.STOCKPILE_GLOB)
            end,
            WOOD=function(mat,parent,typ,idx)
                return (mat.flags.WOOD)
            end,
            THREAD=function(mat,parent,typ,idx)
                return (mat.flags.THREAD_PLANT)
            end,
            LEATHER=function(mat,parent,typ,idx)
                return (mat.flags.LEATHER)
            end
        }
        return itemTypes[df.item_type[itemtype]] or getRestrictiveMatFilter(itemtype)
end

function getRestrictiveMatFilter(itemType)
    if not args.veryRestrictive then return nil else
    local itemTypes={
            WEAPON=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_WEAPON or mat.flags.ITEMS_WEAPON_RANGED)
            end,
            AMMO=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_AMMO)
            end,
            ARMOR=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_ARMOR)
            end,
            SHOES,SHIELD,HELM,GLOVES=ARMOR,ARMOR,ARMOR,ARMOR,
            INSTRUMENT=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_HARD)
            end,
            GOBLET,FLASK,TOY,RING,CROWN,SCEPTER,FIGURINE=INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,
            AMULET=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_SOFT or mat.flags.ITEMS_HARD)
            end,
            EARRING,BRACELET=AMULET,AMULET,
            ROCK=function(mat,parent,typ,idx)
                return (mat.flags.IS_STONE)
            end,
            BOULDER=ROCK,
            BAR=function(mat,parent,typ,idx)
                return (mat.flags.IS_METAL or mat.flags.SOAP or mat.id==COAL)
            end
        }
    return itemTypes[df.item_type[itemtype]]
    end
end
 
function hackWish(posOrUnit)
    local pos = df.unit:is_instance(posOrUnit) and posOrUnit.pos or posOrUnit
    script.start(function()
--        local amountok, amount
        local matFilter
        local itemok,itemtype,itemsubtype=showItemPrompt('What item do you want?',nil,true)
        if not args.noMatRestriction then
            matFilter=getMatFilter(itemtype)
        end --for stockpiling reasons
        local matok,mattype,matindex=showMaterialPrompt('Wish','And what material should it be made of?',matFilter)
        local qualityok,quality=script.showListPrompt('Wish','What quality should it be?',COLOR_LIGHTGREEN,qualityTable())
--        repeat amountok,amount=script.showInputPrompt('Wish','How many do you want? (numbers only!)',COLOR_LIGHTGREEN) until tonumber(amount)
        if mattype and itemtype then
--            for i=1,tonumber(amount) do
            createItem({mattype,matindex},{itemtype,itemsubtype},quality,pos)
--            end
        end
    end)
end
 
args={...}

for k,v in ipairs(args) do
    if v=='all' then args.noMatRestriction=true end
    if v=='startup' then args.startup=true end
    if v=='restrict' then args.veryRestrictive=true end
    if v=='unit' then unitNum=args[k+1] end
end
 
eventful=require('plugins.eventful')
 
print(args.veryRestrictive)
 
if not args.startup then
    local posOrUnit=#args<1 and dfhack.gui.getSelectedUnit(true) and dfhack.gui.getSelectedUnit(true) or not unitNum and df.global.cursor or unitNum and df.unit.find(unitNum) or {x=args[1],y=args[2],z=args[3]}
    hackWish(posOrUnit)
else
    eventful.onReactionComplete.hackWishP=function(reaction,unit,input_items,input_reagents,output_items,call_native)
        if not reaction.code:find('DFHACK_WISH') then return nil end
        hackWish(unit)
    end
end
Title: Re: DFHack Script Collection
Post by: IndigoFenix on February 14, 2014, 08:39:28 am
Updated construct-creature to allow itemcorpses made of the material used to create the creature.
Title: Re: DFHack Script Collection
Post by: milo christiansen on March 10, 2014, 11:42:16 am
Why isn't this a sticky?
Title: Re: DFHack Script Collection
Post by: troy49er3 on March 10, 2014, 06:45:00 pm
I'm currently in the process of updating hackwish to (optionally) only allow stockpilable items to be made and (again, optionally) have even stricter requirements so that only items that can technically be made in-game can be made (say, only allowing weapons to be made of ITEMS_WEAPON materials).

I may also integrate it with spawnUnit if you try to make a pet, but that would be far more complex and would also kinda require spawnunit to be a lua library.

WIP:

Code: [Select]
-- Allows for script-based wishing.

function getCreatureID(creatureRaw)
    return df.global.world.creatures.list_creature[creatureRaw.caste[0].index]
end

function createItem(mat,itemType,quality,pos)
    local item=df[df.item_type.attrs[itemType[1]].classname]:new() --incredible
    item.id=df.global.item_next_id
    df.global.world.items.all:insert('#',item)
    df.global.item_next_id=df.global.item_next_id+1
    item:setSubtype(itemType[2])
    item:setMaterial(mat[1])
    item:setMaterialIndex(mat[2])
    item:categorize(true)
    item.flags.removed=true
    item:setSharpness(1,0)
    item:setQuality(quality-1)
    dfhack.items.moveToGround(item,{x=pos.x,y=pos.y,z=pos.z})
end
 
function qualityTable()
    return {{'None'},
    {'-Well-crafted-'},
    {'+Finely-crafted+'},
    {'*Superior*'},
    {string.char(240)..'Exceptional'..string.char(240)},
    {string.char(15)..'Masterwork'..string.char(15)}
    }
end
 
local script=require('gui/script')
 
function showItemPrompt(text,item_filter,hide_none)
    require('gui.materials').ItemTypeDialog{
        prompt=text,
        item_filter=item_filter,
        hide_none=hide_none,
        on_select=script.mkresume(true),
        on_cancel=script.mkresume(false),
        on_close=script.qresume(nil)
    }:show()
   
    return script.wait()
end

function showMaterialPrompt(title, prompt, filter, inorganic, creature, plant) --the one included with DFHack doesn't have a filter or the inorganic, creature, plant things available
    require('gui.materials').MaterialDialog{
        frame_title = title,
        prompt = prompt,
        mat_filter = filter,
        use_inorganic = inorganic,
        use_creature = creature,
        use_plant = plant,
        on_select = script.mkresume(true),
        on_cancel = script.mkresume(false),
        on_close = script.qresume(nil)
    }:show()

    return script.wait()
end

function getMatFilter(itemtype)
        local itemTypes={
            SEEDS=function(mat,parent,typ,idx)
                return mat.flags.SEED_MAT
            end,
            PLANT=function(mat,parent,typ,idx)
                return mat.flags.STRUCTURAL_PLANT_MAT
            end,
            LEAVES=function(mat,parent,typ,idx)
                return mat.flags.LEAF_MAT
            end,
            MEAT=function(mat,parent,typ,idx)
                return mat.flags.MEAT
            end,
            CHEESE=function(mat,parent,typ,idx)
                return (mat.flags.CHEESE_PLANT or mat.flags.CHEESE_CREATURE)
            end,
            LIQUID_MISC=function(mat,parent,typ,idx)
                return (mat.flags.LIQUID_MISC_PLANT or mat.flags.LIQUID_MISC_CREATURE or mat.flags.LIQUID_MISC_OTHER)
            end,
            POWDER_MISC=function(mat,parent,typ,idx)
                return (mat.flags.POWDER_MISC_PLANT or mat.flags.POWDER_MISC_CREATURE)
            end,
            DRINK=function(mat,parent,typ,idx)
                return (mat.flags.ALCOHOL_PLANT or mat.flags.ALCOHOL_CREATURE)
            end,
            GLOB=function(mat,parent,typ,idx)
                return (mat.flags.STOCKPILE_GLOB)
            end,
            WOOD=function(mat,parent,typ,idx)
                return (mat.flags.WOOD)
            end,
            THREAD=function(mat,parent,typ,idx)
                return (mat.flags.THREAD_PLANT)
            end,
            LEATHER=function(mat,parent,typ,idx)
                return (mat.flags.LEATHER)
            end
        }
        return itemTypes[df.item_type[itemtype]] or getRestrictiveMatFilter(itemtype)
end

function getRestrictiveMatFilter(itemType)
    if not args.veryRestrictive then return nil else
    local itemTypes={
            WEAPON=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_WEAPON or mat.flags.ITEMS_WEAPON_RANGED)
            end,
            AMMO=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_AMMO)
            end,
            ARMOR=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_ARMOR)
            end,
            SHOES,SHIELD,HELM,GLOVES=ARMOR,ARMOR,ARMOR,ARMOR,
            INSTRUMENT=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_HARD)
            end,
            GOBLET,FLASK,TOY,RING,CROWN,SCEPTER,FIGURINE=INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,
            AMULET=function(mat,parent,typ,idx)
                return (mat.flags.ITEMS_SOFT or mat.flags.ITEMS_HARD)
            end,
            EARRING,BRACELET=AMULET,AMULET,
            ROCK=function(mat,parent,typ,idx)
                return (mat.flags.IS_STONE)
            end,
            BOULDER=ROCK,
            BAR=function(mat,parent,typ,idx)
                return (mat.flags.IS_METAL or mat.flags.SOAP or mat.id==COAL)
            end
        }
    return itemTypes[df.item_type[itemtype]]
    end
end
 
function hackWish(posOrUnit)
    local pos = df.unit:is_instance(posOrUnit) and posOrUnit.pos or posOrUnit
    script.start(function()
--        local amountok, amount
        local matFilter
        local itemok,itemtype,itemsubtype=showItemPrompt('What item do you want?',nil,true)
        if not args.noMatRestriction then
            matFilter=getMatFilter(itemtype)
        end --for stockpiling reasons
        local matok,mattype,matindex=showMaterialPrompt('Wish','And what material should it be made of?',matFilter)
        local qualityok,quality=script.showListPrompt('Wish','What quality should it be?',COLOR_LIGHTGREEN,qualityTable())
--        repeat amountok,amount=script.showInputPrompt('Wish','How many do you want? (numbers only!)',COLOR_LIGHTGREEN) until tonumber(amount)
        if mattype and itemtype then
--            for i=1,tonumber(amount) do
            createItem({mattype,matindex},{itemtype,itemsubtype},quality,pos)
--            end
        end
    end)
end
 
args={...}

for k,v in ipairs(args) do
    if v=='all' then args.noMatRestriction=true end
    if v=='startup' then args.startup=true end
    if v=='restrict' then args.veryRestrictive=true end
    if v=='unit' then unitNum=args[k+1] end
end
 
eventful=require('plugins.eventful')
 
print(args.veryRestrictive)
 
if not args.startup then
    local posOrUnit=#args<1 and dfhack.gui.getSelectedUnit(true) and dfhack.gui.getSelectedUnit(true) or not unitNum and df.global.cursor or unitNum and df.unit.find(unitNum) or {x=args[1],y=args[2],z=args[3]}
    hackWish(posOrUnit)
else
    eventful.onReactionComplete.hackWishP=function(reaction,unit,input_items,input_reagents,output_items,call_native)
        if not reaction.code:find('DFHACK_WISH') then return nil end
        hackWish(unit)
    end
end


Hey Putman, I cannot seem to get this work at all. Everytime I type in hackish it throws an error at me. Error loading module  GUI/Script and other stuff. Its suppose to be in the scripts folder right? Is there a way to send some sort of log so you can have a better look at it?  Btw thanks for all your stuff you do. Your awesome man 
Title: Re: DFHack Script Collection
Post by: Putnam on March 10, 2014, 07:52:16 pm
r3 has a missing close paren in the script file, so you'll probably want to use it with r4.
Title: Re: DFHack Script Collection
Post by: troy49er3 on March 10, 2014, 08:07:53 pm
Thanks a bunch, I'll try that.
Title: Re: DFHack Script Collection
Post by: troy49er3 on March 10, 2014, 08:40:01 pm
r3 has a missing close paren in the script file, so you'll probably want to use it with r4.

I tried r4 and still getting the same error. this is what Im getting

(http://i.imgur.com/nX99S9r.png?1)
Title: Re: DFHack Script Collection
Post by: Putnam on March 10, 2014, 08:45:10 pm
DFHack r4, not LNP.
Title: Re: DFHack Script Collection
Post by: troy49er3 on March 10, 2014, 08:48:09 pm
I did get it. From here http://dffd.wimbli.com/file.php?id=8068 I just copied all the files from it over to my existing dfhack file
Title: Re: DFHack Script Collection
Post by: Putnam on March 10, 2014, 08:49:16 pm
Did you replace every file correctly?
Title: Re: DFHack Script Collection
Post by: troy49er3 on March 10, 2014, 09:00:00 pm
LOL apparently not. I just recopied and pasted and now its working fine :o. Thanks for your help and all these awesome mods btw. Your awesome man.
Title: Re: DFHack Script Collection
Post by: Meph on March 11, 2014, 05:55:20 am
Why isn't this a sticky?
I wrote Toady a message, lets see if he agrees with making this a stickied thread or not.
Title: Re: DFHack Script Collection
Post by: Bo-Rufus CMVII on March 11, 2014, 11:31:59 pm
I added a few scripts to the bottom of the list, with links to posts that have the code and describe them more fully.
Title: Re: DFHack Script Collection
Post by: Meph on March 12, 2014, 06:07:11 am
Toady said no to the sticky, because the first thread can be edited by anyone, opening grounds for spammers and trolls. Just wamted to let you guys know. He said that it would be different if someone governs the thread, as in : approves of suggested changes to the first post, but he will see how the forum discussion goes and how many people are pro/contra stickying this thread.
Title: Re: DFHack Script Collection
Post by: Bo-Rufus CMVII on March 15, 2014, 04:49:05 am
Added show-speeds.

This is a very substantial revision of what I posted a week or two ago, now providing information on encumbrance and jobs that may be slowing Urist down.

Screenshot below; code at http://www.bay12forums.com/smf/index.php?topic=136748.msg5045463#msg5045463 (http://www.bay12forums.com/smf/index.php?topic=136748.msg5045463#msg5045463).

Some of the code is problematic (see internal comments); let me know if you spot something that needs fixing.

(http://i.imgur.com/RzgNaYB.png)
Title: Re: DFHack Script Collection
Post by: Urist McTeellox on March 15, 2014, 06:01:30 am
Toady said no to the sticky, because the first thread can be edited by anyone, opening grounds for spammers and trolls. Just wamted to let you guys know. He said that it would be different if someone governs the thread, as in : approves of suggested changes to the first post, but he will see how the forum discussion goes and how many people are pro/contra stickying this thread.

For what it's worth, I still have to press a button to trigger the top-post update (which I usually do when I see anyone post), so spammers are unlikely to get much in the way of instant gratification.

I think the actual risk of spammers is very low; needing to register a github account to update a markdown wiki to spam a DF board is a lot of work for a very specialised target. In the case that we ever do see spam, I can tweak my update procedures to show me the actual changes before committing them. (Really just a matter of adding a few more git commands to the current release code (https://github.com/pjf/masterwork-dwarf-fortress/blob/gold/maint-bin/update-top-posts.pl)).

~ T
Title: Re: DFHack Script Collection
Post by: palu on March 16, 2014, 08:33:14 pm
Why not make a poll? And for the record, I think it should be stickied.
Title: Re: DFHack Script Collection
Post by: Bo-Rufus CMVII on March 18, 2014, 03:38:37 am
FYI, I just posted another very substantial update to the show-speeds script, with more tools to help you analyze encumbrance.

Screenshots and code at the link (http://www.bay12forums.com/smf/index.php?topic=136748.0). (The screenshot above is stale.)
Title: Re: DFHack Script Collection
Post by: Nopenope on March 19, 2014, 02:29:10 pm
I think there are many, many scripts not in this list that people have posted in the DFHack thread (http://www.bay12forums.com/smf/index.php?topic=91166), and a couple more that are on people's gists.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on March 28, 2014, 08:05:56 am
Updated construct-creature to allow organic materials, so you can now make wooden robots or Frankenstein Monsters from patched-together corpses.
Also, constructed creatures are now added to the pet list properly, so you can train or adopt them.
Title: Re: DFHack Script Collection
Post by: Urist Da Vinci on April 01, 2014, 10:18:40 pm
Could someone add this to the list for me?

http://www.bay12forums.com/smf/index.php?topic=137332.0

butcher.lua - displays most butchering results from a living creature
butcheritem.lua - displays most butchering results from a corpse or body part

Thanks!
Title: Re: DFHack Script Collection
Post by: Bo-Rufus CMVII on April 01, 2014, 10:30:45 pm
You are able to add it yourself.  There's a link in the first post that takes you to a wiki page, and you just edit it to add your stuff to the list.  ("Be bold", it says.)  Then the list in the first post is updated with what you've added to the list.
Title: Re: DFHack Script Collection
Post by: jomen on April 26, 2014, 05:26:49 am
Hi ,

I'm wondering how to mod the raw files to add a Slave Caste for using the Take-slave script. Someone know how to do ?
Title: Re: DFHack Script Collection
Post by: Meph on April 26, 2014, 10:30:14 am
Hi ,

I'm wondering how to mod the raw files to add a Slave Caste for using the Take-slave script. Someone know how to do ?
This is not the place to ask. Try the dfhack thread, or ask Boltgun, he made a custom script for such things.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on May 26, 2014, 10:13:51 am
Added add-exp, a stand-alone version of a script I've been using for a while and seems to be in reasonable demand.  It adds a set amount of experience in a particular skill to a particular unit, leveling them up if and only if they pass the natural level-up threshold.  Good for reactions that are supposed to train skills gradually.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on June 28, 2014, 01:18:09 pm
Huh.  Just noticed that add-exp hasn't appeared on the front post for some reason, even though it is in the github page.
Title: Re: DFHack Script Collection
Post by: lethosor on June 28, 2014, 01:45:55 pm
Huh.  Just noticed that add-exp hasn't appeared on the front post for some reason, even though it is in the github page.
Quote from: Front post
Last Edit: April 27, 2014, 10:51:57 pm by Urist McTeellox
It's possible that the auto-updating script hasn't been running since then.
Title: Re: DFHack Script Collection
Post by: IndigoFenix on August 01, 2014, 04:06:40 am
Added timestream, a script that multiplies the rate of calendar time by the specified value.
Title: Re: DFHack Script Collection
Post by: TheOnlySolitaire on August 21, 2014, 03:20:47 pm
Are these scripts up to date for dfhack 40.08 r1 + r2?

Is spawnunit at the least up to date?

I used the search bar but couldn't find any relevant thread for it that relates to 40.x...

Title: Re: DFHack Script Collection
Post by: Dirst on August 21, 2014, 03:30:14 pm
Are these scripts up to date for dfhack 40.08 r1 + r2?

Is spawnunit at the least up to date?

I used the search bar but couldn't find any relevant thread for it that relates to 40.x...
I adapted a spawn-unit script (http://www.bay12forums.com/smf/index.php?topic=139553.msg5578409;topicseen#msg5578409) from 0.34r4 and it worked, but it needed to update a couple of the unk properties to real names (for 0.34r5 or 0.40r2).  I couldn't get the soul traits to work, but that might be because I was spawning animals (and I'm not sure if DF animals have souls).
Title: Re: DFHack Script Collection
Post by: nuker22110 on August 28, 2014, 07:05:19 pm
hello, unfortunately i believe the dwarves and points scripts are not working. what i did was copy and paste and existing lua/rb file in 0.40.8 and paste in the code. i tried it during embark and it didnt work. would anyone be kind enough to help me? i lack the necessary skills to fix it myself
Title: Re: DFHack Script Collection
Post by: Meph on August 28, 2014, 07:15:34 pm
During embark? You have to use it on the embark selector, the map. Before you press 'e' to pick your group and items.
Title: Re: DFHack Script Collection
Post by: lethosor on August 28, 2014, 08:24:35 pm
The "dwarves" script is exactly the same as startdwarf (https://github.com/DFHack/dfhack/blob/master/scripts/startdwarf.rb) (included with DFHack), which requires the "start_dwarf_count" offset to be available. It's not available in 0.40.08, so that script won't work at all.
Title: Re: DFHack Script Collection
Post by: Meph on August 28, 2014, 08:39:57 pm
Oh, does that mean its no longer possible to control how large your embark group is in 40.x ?
Title: Re: DFHack Script Collection
Post by: lethosor on August 28, 2014, 08:58:15 pm
The necessary offsets are available for 0.40.10 on all platforms - it used to be a matter of finding them manually, which is why they're not available in 0.40.08, but jjyg has written a script to find them automatically, so they should be available in future DFHack releases for 0.40.xx.
Title: Re: DFHack Script Collection
Post by: Meph on August 28, 2014, 09:01:23 pm
Thats good news. :)

Putnam told me that Force Event, the script he wrote that triggers migrants, caravans and sieges, might most likely not be possible in 40.x, because the creatures that arrive at your fort have to actually move across the map. Do you know something about that as well?

I rely rather heavily on that specific script, it would be sad to see it go... this, and spawnunit.
Title: Re: DFHack Script Collection
Post by: expwnent on August 29, 2014, 12:58:47 am
It won't be possible to trigger invaders with that script anymore, because invaders are done differently internally in DF. Warmist is still working on updating spawnunit.
Title: Re: DFHack Script Collection
Post by: nuker22110 on August 29, 2014, 03:35:33 am
Thank you for your quick reply meph. It seems that slam doesnt work either, throws a bunch of errors in dfhack.
Title: Re: DFHack Script Collection
Post by: Meph on August 29, 2014, 03:48:48 am
It won't be possible to trigger invaders with that script anymore, because invaders are done differently internally in DF. Warmist is still working on updating spawnunit.
Ok, sieges are not that important. But do you know about caravans or migrants? These still possible?

Slam not really important as well, at least for me.
Title: Re: DFHack Script Collection
Post by: nuker22110 on August 29, 2014, 03:56:36 am
Thats fine sir. Would you happen to know how to make putnam's hackwish script work too? thank you in advance
Title: Re: DFHack Script Collection
Post by: expwnent on August 29, 2014, 04:06:04 am
Meph: Yes, all of the others should still work.
Title: Re: DFHack Script Collection
Post by: Meph on August 29, 2014, 04:11:35 am
Meph: Yes, all of the others should still work.
Excellent news. :)
Title: Re: DFHack Script Collection
Post by: lethosor on August 29, 2014, 08:50:02 am
It looks like start_dwarf_count is only available on OS X for 0.40.10-r1, but you can find the other two here (https://github.com/DFHack/df-structures/commit/b259a55e9ee9f1aa162af39757cfacc4bcf88527) (for Windows and Linux, in that order).
Title: Re: DFHack Script Collection
Post by: Nopenope on September 07, 2014, 12:56:23 am
The list is outdated; some scripts have been included in the main repo and are superfluous/deprecated here (like moddablegods), and many are simply missing (like scripts from people's gists such as IndigoFenix's druidism or Warmist's emigration, or lethosor's scripts, or twbt). Not to mention scripts that haven't been updated yet and might or might not work etc. If we knew which ones are deprecated or compatible with current DF/dfhack it'd be easier to be bold with edits.