Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 180 181 [182] 183 184 ... 243

Author Topic: DFHack 50.13-r1  (Read 810788 times)

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2715 on: November 22, 2020, 07:30:22 pm »

Those are the tiles that are specified in the raws for those gems. If those aren't the tiles you see in-game, are you using TWBT? We likely wouldn't be able to support tilesets that require TWBT in this particular screen, unfortunately.
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.

mross

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2716 on: November 22, 2020, 07:35:29 pm »

Those are the tiles that are specified in the raws for those gems. If those aren't the tiles you see in-game, are you using TWBT? We likely wouldn't be able to support tilesets that require TWBT in this particular screen, unfortunately.
Got it, thanks. I was wondering if they were like an indication of rarity or value or something.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2717 on: November 25, 2020, 08:18:42 am »

so went back and reworked some of my recruit scripts to now steal members from other sites and bring them to your fort.

Code: ('SnatchErase.lua') [Select]
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil then else
print ( de,oe.mission_report.title)
for si,te in pairs(df.global.world.world_data.sites) do
local Sito=te.id
if oe.site_id== Sito then
local SitePool=df.global.world.world_data.sites[si].unk_1.nemesis
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=SitePool[dfhack.random.new():random(#SitePool)],
stored_fat = forv.stored_fat,
unk_2c= forv.unk_2c,
unk_28= forv.unk_28,
unk_1= forv.unk_1,
unk_30= forv.unk_30,
unk_34= forv.unk_34})

for Del,ete in pairs(df.global.world.armies.all[e].members) do
for De,ee in pairs(SitePool) do
if ete.nemesis_id== ee then
SitePool:erase(De) 
end
end
end
end
end
end
end
end
end
so you run this script while your squad is off on a mission now this works if the squad is targeting a site, so far it doesn't work with searching for artifacts or going on messenger missions.
and you can repeatedly use the script so if you say see a 20 population site you could use this script 20 times and grab the whole population.

the folks you snatch will seek sanctuary so their labors will not work but they can take occupations ...also there's probably a dfhack solution for that labor assignment with a different script.

oh and here's Snatch(this one copies the member of the site to the army) and Recruit (grabs a random nemesis from the world this one works on any mission.) scripts in case anyone want those
 
Code: ('recruit.lua') [Select]
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil then else
print ( de,oe.mission_report.title)
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=df.global.world.nemesis.all[dfhack.random.new():random(#df.global.world.nemesis.all)].id,
stored_fat = forv.stored_fat,
unk_2c= forv.unk_2c,
unk_28= forv.unk_28,
unk_1= forv.unk_1,
unk_30= forv.unk_30,
unk_34= forv.unk_34})
end
end
end
end

Code: ('Snatch.lua') [Select]
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil then else
print ( de,oe.mission_report.title)
for si,te in pairs(df.global.world.world_data.sites) do
local Sito=te.id
if oe.site_id== Sito then
local SitePool=df.global.world.world_data.sites[si].unk_1.nemesis
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=SitePool[dfhack.random.new():random(#SitePool)],
stored_fat = forv.stored_fat,
unk_2c= forv.unk_2c,
unk_28= forv.unk_28,
unk_1= forv.unk_1,
unk_30= forv.unk_30,
unk_34= forv.unk_34})
end
end
end
end
end
end

so with this you could probably steal back children and babies from goblin snatchers, potentially steal the goblin snatchers, and the known famous members of the dark fortress including the leaders with this script or use recruit to grab a random nemesis having historical figure which might end up getting you an animal.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2718 on: November 25, 2020, 10:55:43 am »

Quote
Code: [Select]
unk_2c= forv.unk_2c,
unk_28= forv.unk_28,
unk_1= forv.unk_1,
unk_30= forv.unk_30,
unk_34= forv.unk_34})
Is there a particular reason you're assigning these fields and not the other "unk" fields? Do you know what they are? If you do, we should give them proper names.
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.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2719 on: November 26, 2020, 06:24:48 am »

Quote
Code: [Select]
unk_2c= forv.unk_2c,
unk_28= forv.unk_28,
unk_1= forv.unk_1,
unk_30= forv.unk_30,
unk_34= forv.unk_34})
Is there a particular reason you're assigning these fields and not the other "unk" fields? Do you know what they are? If you do, we should give them proper names.
uhh I don't really I just notice the numbers were filled in and figured why not match that with the rest of the members in the party so to avoid crashes or any weirdness.
I did had to filter out anon_1 in that set with unk_1 as I didn't know what fit in to anon_1 when it go renamed.

also I think the other unk_ fields are already set to 0 so I didn't really need to change them or apply copying of the first member of the army to the new members.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

Iä! RIAKTOR!

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2720 on: November 27, 2020, 06:12:30 pm »

I need Catsplosion script analogue that can breed creatures of specie selected by cursor (like for full-heal). For breeding necro's experiments.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2721 on: November 29, 2020, 12:12:04 pm »

I need Catsplosion script analogue that can breed creatures of specie selected by cursor (like for full-heal). For breeding necro's experiments.

You could likely adapt catsplosion fairly easily - this section appears to be the code that creates/shortens pregnancies, and creating a script containing just the highlighted code, as well as the following line before it, should work:
Code: [Select]
female = dfhack.gui.getSelectedUnit()
Edit: you'll also need to remove the lines referencing variables with "total_" in their names.

A longer-term solution could be to add support for "catsplosion this", similar to "exterminate this" - it would be more complicated than the process I described above, but if that's something that would be useful, we could add support for it.
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.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2722 on: November 30, 2020, 11:28:15 am »

I need Catsplosion script analogue that can breed creatures of specie selected by cursor (like for full-heal). For breeding necro's experiments.

You could likely adapt catsplosion fairly easily - this section appears to be the code that creates/shortens pregnancies, and creating a script containing just the highlighted code, as well as the following line before it, should work:
Code: [Select]
female = dfhack.gui.getSelectedUnit()
Edit: you'll also need to remove the lines referencing variables with "total_" in their names.

A longer-term solution could be to add support for "catsplosion this", similar to "exterminate this" - it would be more complicated than the process I described above, but if that's something that would be useful, we could add support for it.
I remember warmist made an impregnate script that was basically this years back when dfusion existed and I think catsplosion was an adaptation of that script.



Code: [Select]
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end

function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end

function empregnate(unit)
    if unit==nil then
        unit=getCreatureAtPos(getxyz())
    end
    if unit==nil then
        error("Failed to empregnate. Unit not selected/valid")
    end
    if unit.curse then
        unit.curse.add_tags2.STERILE=false
    end
    local genes = unit.appearance.genes
    if unit.pregnancy_genes == nil then
        print("creating preg ptr.")
        if false then
            print(string.format("%x %x",df.sizeof(unit:_field("pregnancy_genes"))))
            return
        end
        unit.pregnancy_genes = { new = true, assign = genes }
    end
    local ngenes = unit.pregnancy_genes
    if #ngenes.appearance ~= #genes.appearance or #ngenes.colors ~= #genes.colors then
        print("Array sizes incorrect, fixing.")
        ngenes:assign(genes);
    end
    print("Setting preg timer.")
    unit.pregnancy_timer=10
    unit.pregnancy_caste=1
end
so here's my copy of this old script and the functions that make it work.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

CaptainArchmage

  • Bay Watcher
  • Profile Pic has Changed! Sorry for the Delay.
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2723 on: December 03, 2020, 09:01:10 am »

Is there any kind of DFHack script that allows an artifact to be undestroyed? I've just noted the bug where artifacts are destroyed when migrants bring them in i.e. as family heirlooms and wonder whether this can be fixed.
Logged
Given current events, I've altered my profile pic and I'm sorry it took so long to fix. If you find the old one on any of my accounts elsewhere on the internet, let me know by message (along with the specific site) and I'll fix. Can't link the revised avatar for some reason.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2724 on: December 13, 2020, 01:28:45 am »

Couple questions

1. I am looking into adding new features into the eventful plugin, but am wondering how reasonable that is, in particular a call to check for unit actions. Currently I use a script that uses a custom eventful call in my scripts that I got from one of Putnam's scripts but was thinking that it would be more elegant and more useful to other modders if it were to be added into the actual DFHack eventful plugin. I am currently looking at the plugins/lua/eventful.lua, plugins/eventful.cpp, and library/modules/EventManager.cpp for an idea of how I would go about this and I think I understand how the current calls are working, but my question is, before I do too much more work thinking about how to add new calls, is this something that can be done? From what I understand it is, but just wanted to make sure that there wasn't something I was missing that makes it not possible.

2. I want to update my old journal/detailed unit viewer to my new set of scripts. My previous iteration used the "In-game UI library" from the dfhack lua api page extensively. Just wanted to double check that that was still the "correct" way to add custom screens?

3. Is there a list somewhere of what people are working on for DFHack? I know everyone has there own set of scripts and such in lua and various mods, and can submit pull requests about anything they are working on, but I was wondering if there was a central list of things people are looking to add to the core DFHack repository, just in case there is something I think I would like to add, it would be nice to know if anyone else was working on it.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2725 on: December 13, 2020, 07:10:07 am »

Couple questions

1. I am looking into adding new features into the eventful plugin, but am wondering how reasonable that is, in particular a call to check for unit actions. Currently I use a script that uses a custom eventful call in my scripts that I got from one of Putnam's scripts but was thinking that it would be more elegant and more useful to other modders if it were to be added into the actual DFHack eventful plugin. I am currently looking at the plugins/lua/eventful.lua, plugins/eventful.cpp, and library/modules/EventManager.cpp for an idea of how I would go about this and I think I understand how the current calls are working, but my question is, before I do too much more work thinking about how to add new calls, is this something that can be done? From what I understand it is, but just wanted to make sure that there wasn't something I was missing that makes it not possible.

2. I want to update my old journal/detailed unit viewer to my new set of scripts. My previous iteration used the "In-game UI library" from the dfhack lua api page extensively. Just wanted to double check that that was still the "correct" way to add custom screens?

3. Is there a list somewhere of what people are working on for DFHack? I know everyone has there own set of scripts and such in lua and various mods, and can submit pull requests about anything they are working on, but I was wondering if there was a central list of things people are looking to add to the core DFHack repository, just in case there is something I think I would like to add, it would be nice to know if anyone else was working on it.

1. IIRC this would be probably added to evenmanager and then to eventful. EventManager has the infrastructure for "every n ticks check this thing" which would be the way to go with this. Eventful itself adds vmethod based callbacks. Though if it's some ease of use script thing it may even live in eventful.lua.

2. Yup. Use as far as possible in inheritance. IIRC usually widgets?

3. I think usual convention is [WIP] marked pull-req in github.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2726 on: December 14, 2020, 12:35:37 am »

Couple questions

1. I am looking into adding new features into the eventful plugin, but am wondering how reasonable that is, in particular a call to check for unit actions. Currently I use a script that uses a custom eventful call in my scripts that I got from one of Putnam's scripts but was thinking that it would be more elegant and more useful to other modders if it were to be added into the actual DFHack eventful plugin. I am currently looking at the plugins/lua/eventful.lua, plugins/eventful.cpp, and library/modules/EventManager.cpp for an idea of how I would go about this and I think I understand how the current calls are working, but my question is, before I do too much more work thinking about how to add new calls, is this something that can be done? From what I understand it is, but just wanted to make sure that there wasn't something I was missing that makes it not possible.

2. I want to update my old journal/detailed unit viewer to my new set of scripts. My previous iteration used the "In-game UI library" from the dfhack lua api page extensively. Just wanted to double check that that was still the "correct" way to add custom screens?

3. Is there a list somewhere of what people are working on for DFHack? I know everyone has there own set of scripts and such in lua and various mods, and can submit pull requests about anything they are working on, but I was wondering if there was a central list of things people are looking to add to the core DFHack repository, just in case there is something I think I would like to add, it would be nice to know if anyone else was working on it.

1. IIRC this would be probably added to evenmanager and then to eventful. EventManager has the infrastructure for "every n ticks check this thing" which would be the way to go with this. Eventful itself adds vmethod based callbacks. Though if it's some ease of use script thing it may even live in eventful.lua.

2. Yup. Use as far as possible in inheritance. IIRC usually widgets?

3. I think usual convention is [WIP] marked pull-req in github.

1. Hmm, the more I think about it, the more I'm not sure if it is something that should go in the C++ or in the lua side of things. It would be nice to put it in the C++ so that it works like all the other eventful things, but I suppose if it gets put into the lua eventful side of things it would work for other users just the same. I'm not sure, I guess I will need to think about it some more.

2. Yep, lots of widgets. It does what I want it to do, so I'm glad it's still that way. Don't have to change much then.

3. That works great. I got a little confused because I was looking under the df-structures git repo and only saw like two pull requests. But now I realize that each repo under the DFHack account has it's own list of pull requests. On a side note, has it always been that way? I thought I remembered them being in a single repo.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2727 on: December 14, 2020, 06:26:02 am »

Ah another thought i had relation to 1st question: it might be useful to implement the core in c++ just because of performance as it would be probably walking over many units and checking their actions each tick as action are shortlived and need to be as up-to-date as possible.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2728 on: December 14, 2020, 10:31:02 am »

Check the modtools folder in sparking. I already got an on-action event in Lua which is "fast enough", though I have been thinking avout moving it to C++.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.04-r3
« Reply #2729 on: December 14, 2020, 11:44:49 am »

3. That works great. I got a little confused because I was looking under the df-structures git repo and only saw like two pull requests. But now I realize that each repo under the DFHack account has it's own list of pull requests. On a side note, has it always been that way? I thought I remembered them being in a single repo.

"df-structures" has been its own repo since structure definitions were implemented in XML (around 2011). "scripts" was split out in 2016, and has issues disabled, since it usually makes more sense to report them in the "dfhack" repo anyway. PRs always need to be made in the repo containing the code being modified, though.

I loosely keep track of issues/PRs with projects, to make it a bit easier to see what issues/PRs were addressed in a release, but they need to be manually added currently: https://github.com/orgs/DFHack/projects/
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.
Pages: 1 ... 180 181 [182] 183 184 ... 243