Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 211 212 [213] 214 215 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 893853 times)

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r5
« Reply #3180 on: June 17, 2022, 11:19:01 pm »

I'm thrilled to announce the release of DFHack 0.47.05-r6

Download it from the github release page: https://github.com/DFHack/dfhack/releases/tag/0.47.05-r6

We have some great new visual tools in this release! gui/petitions gives you a scrollable list of your pending (or previous) petitions. Now you no longer have to remember what deity you just agreed to build a temple for : )


gui/quickfort is a brand new UI for Quickfort. You can preview how your blueprint will be applied in the live game map, position it interactively, and see whether the blueprint will be successfully applied before you apply it.


and gui/quantum is a point and click interface for setting up quantum stockpiles. It will even manage the minecarts for you!


Full changelog below:

Spoiler (click to show/hide)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3181 on: June 20, 2022, 04:55:06 am »



so exploring viewscreens some more led to realizing oh yeah I could probably get access to adv mode while in the middle of the world generating.

Code: (worldgenadv.lua) [Select]
--thanks warmist for the help on getCurViewscreen
local old_screen=dfhack.gui.getCurViewscreen()
local new_screen=df.viewscreen_setupadventurest:new()
old_screen.child=new_screen
new_screen.parent=old_screen
new_screen.page=2
for k,v in pairs(df.global.world.history.figures) do
if df.global.world.nemesis.all==nil then
df.global.world.nemesis.all:insert("#",{new=true,figure=df.global.world.history.figures[k]})
end
end
for ki,vi in pairs(df.global.world.nemesis.all) do
new_screen.nemesis_ids:insert("#",ki)
end

Code: (worldgenload.lua) [Select]
local old_screen=dfhack.gui.getCurViewscreen()
local new_screen=df.viewscreen_new_regionst:new()
old_screen.child=new_screen
new_screen.parent=old_screen
new_screen.worldgen_paused=true

so this stuff is a bit experimental but if you pause the game then run the worldgen adv script you could shuffle into playing a bunch of random folks from a list then after that if you want to set up adv party members you could use unretire anyone after that as that works once you run worldgen adv.
the second script lets you load back into the world generations that you paused prior note this only works if you were in the middle of generating a world than loading up a post generated world.
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

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3182 on: June 22, 2022, 07:09:12 pm »

When a new DF release comes out, DFHack devs need to spend time adapting to code and behavior changes. This means that we have to go through all our tools and make sure they still work! We need your help figuring out which are the most important DFHack tools to look at first when the Steam release comes out.

If you can, please help us by writing down the DFHack tools you depend on most in this (very short) survey: https://docs.google.com/forms/d/e/1FAIpQLSfXMmRZNi1Fyb5fOsa2W5RC_MTeu9IGucC-PRDLzkn_0r51Lw/viewform

This is the same survey we posted to Reddit (and the DF General Discussion forum here), so if you've already submitted something, thank you! and no need to submit again from here.

Feel free to comment in this thread, but please fill out the survey form too! Those are the responses that we're looking at.

I'll put out a more thorough analysis later, but here's a quick summary of the first 400 responses from Reddit and DF General Discussion:

Dwarf mode players outnumber Adventure mode players by 4:1 (probably no surprise here)

Fewer than 1 in 20 players use mods

The aspects of DFHack that people love the most are:

  • UI improvements
  • Bugfixes
  • Productivity tools
  • Information
  • Automation tools

The greatest requests of DFHack are for more GUI integration and better tool discoverability.

The top 20 DFHack tools that people named (or described accurately enough for me to guess the name) are:

  • manipulator
  • autolabor
  • reveal
  • embark-assistant
  • clean
  • autodump
  • prospect
  • autobutcher
  • workflow
  • fastdwarf
  • autonestbox
  • showmood
  • liquids
  • quickfort
  • autofarm
  • createitem
  • autochop
  • search
  • stocks
  • exportlegends

Note that manipulator got the votes for "Dwarf Therapist" since it was clear that many people were uncertain about the difference. Even if manipulator did not get those votes, though, it would still be in the top 20.
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3183 on: June 27, 2022, 12:40:34 pm »

The results are in!

I (myk) am one of the DFHack core developers. I created this survey in order to understand what DFHack's users appreciate and need most so we can set development priorities for the future. This survey allowed me to understand how strongly our users feel about particular pain points (spoiler: our users have a lot to say about GUI integration and documentation!).

Overall, there were 470 people who submitted responses. This is more than enough to get some real, statistically significant results. Thank you all for your help! It really means a lot to us!

Q1: "I Play:"
470 responses.



Q1 analysis and opinion
Almost everybody who uses DFHack plays at least fort mode. About a quarter of respondents also play adventure mode. A small percentage play with mods, and most are small personal mods the players themselves have created. Only Squamous's mods (The Long Night, Fall from Grace, etc.) and Masterwork have more than one respondent playing them.

From my point of view as a DFHack developer, this shows that tools that are useful in fort mode will have the most impact. However, adventure mode has a significant presence. Tools specifically for adventure mode will still be appreciated and used.

I note that mods do not have a huge presence right now. This could be because mods and tilesets -- especially the newer, more complete tilesets -- don't play well together, and people would rather keep their tileset than explore a mod that requires them to play in text mode. However, this all might change drastically once DF supports Steam Workshop and mods can be distributed via Steam. Watch this space!

Q2: "I use DFHack to:"
468 responses.



Q2 analysis and opinion
The top categories all have to do with productivity, toil reduction, and access to information. This is where people are most keenly aware of DFHack's benefits.

These categories are closely followed by bug fixing. Bugfixing happens in the background and is mostly invisible. I was surprised that there were this many people who were aware enough of the bugfixes that they selected this option, though I suspect if people knew the extent of DFHack's bugfixing, the number would be even higher.

Every aspect of DFHack has a significant number of users that care about it, though.

Q3: "What are the DFHack tools that you rely on most?"
306 responses.

There are more than 350 tools in DFHack (including individual bugfixes and tweaks), but only the top 20 are called out here.

Note that these are plugin/script names, not command names. For example, many people wrote `digv` as the tool they use, but it was consolidated in this graph with the other `dig` plugin commands. Also, many people seemed uncertain about what to call the `manipulator` plugin. Many just called it "Dwarf Therapist" or "that DT screen" or "labor spreadsheet". These were all consolidated into the `manipulator` category, even the ones that were clearly referring the the *real* external (non-DFHack) tool named Dwarf Therapist, with the rationale being that "a tool that does labor assignment is important to our users".



Q3 analysis and opinion
This is a poll of perception, not actual records of usage, so we must remember that these are not necessarily the most valuable tools, but rather the most valued tools. All the tools listed here are definitely high-value, but the list is not guaranteed to be exhaustive. We will be using the rankings here to identify the "marquee" tools, and we'll combine this list with the rankings in Q2 above to prioritize our work in getting tools ready for the Steam release.

That being said, let's map those tools back to the categories in Q2 and see what we get (note that many tools map to more than one category):

  • Get the UI improvements: (search)
  • Quickly perform common tasks: (autodump, clean, manipulator, stocks)
  • Automate toilsome fortress management: (autobutcher, autofarm, autolabor, autonestbox)
  • Get information to make good decisions: (embark-assistant, manipulator, reveal, prospect, showmood, stocks, exportlegends)
  • Fix game bugs so they don't bother me: ()
  • Manage stock levels: (workflow)
  • Design the fortress: (dig, quickfort)
  • Modify the map/dwarves/resources: (autodump, clean, createitem, fastdwarf, liquids)
  • Add new game mechanics: ()
  • Recover from bad planning / unwinnable situations: (createitem)
  • Trigger game events: ()

UI improvements and bug fixes are important to users, but I'm not surprised at all that they don't get named (other than search). They are not usually tools that users run directly, so their names are not going to be at the forefront of anyone's minds.

The rest of the tools seem reasonably distributed based on the Q2 orderings, which validates both what users *say* they value and what tools they *actually* value.

I am a tad surprised that the smaller productivity tools like unsuspend and unforbid didn't make the list. I know I use those all the time!

Q4: "What do you wish DFHack would do better?"
176 responses. This is the "user pain points" section. The responses here indicate where DFHack users are feeling frustration.



Q4 analysis and opinion
The results could not be more clear. DFHack has a lot of great, powerful features, but users are frustrated with not being able to find them and not being able to use them effectively. There is a large call to make DFHack more accessible from the Dwarf Fortress game screen (the GUI). DFHack should be concentrating developer effort to fix these usability issues. Ideas from the community are welcome here!

Q5: "If you could write your own DFHack feature, what would it be?"
161 responses. Here are the areas where users think DFHack could make an impact if we were to develop a new feature. I made up tool names to combine similar ideas from multiple users, which I will explain below. Only ideas that appeared more than once are included in the charts below.



Now, you may recognize some of the "feature requests" in that chart. Many users were just not aware that DFHack already includes the tool they were requesting. In fact, about 1 in 3 feature requests were for features or tools that already exist in DFHack. Another vote for the "Discoverability" pain point.

Here is the chart with only requests for features that don't already exist in DFHack:



Again, these are made-up names that I used to represent the ideas I was combining from the responses. Here's what they mean:

  • military: manage uniforms, squads, and schedules, including importing and exporting data
  • force siege: generate a siege
  • impregnate: similar to `catsplosion` (which can actually handle any animal type) but for sapient beings, like your dwarves, and able to target specific individuals
  • track-designer: tool for laying down tracks and routes and checking them for breaks
  • fix/missingsquad: ensure your squad that went out on a raid comes back (or at least is declared MIA so squad leaders can be reassigned and another squad formed)
  • assign-pets: assign pets specific owners, or getting dwarves adopted by specific cats
  • max-wave: control how many migrants can come in a migration wave to prevent your fort from growing too fast
  • fortminder: advisor that warns you when things are in a bad state and recommends improvements
  • gui/assistant: centralized DFHack configuration GUI where you can, for example, select the auto* tools you want enabled
  • filter-reports: find important information in the announcement reports
  • religion: manage religions in your fort (or in the world), including raising a historical figure to  deity status

Q5 analysis and opinion
These requests indicate the areas where players feel they don't have enough control or information. Military-related tools were the number one requested feature, but all of these are good suggestions and we'll take them under consideration. A number of these top requests are being worked on right now, such as `filter-reports` and `max-wave`. `gui/assistant` is an excellent suggestion for improving the usability of DFHack and will be given high priority, given the pain points our users made clear in Q4!

Developers out there: if you want to make a contribution to DFHack but don't know what to write, that is the list of the tools that will be most appreciated by the community!

In an effort to aid discovery, here are the most popular "feature requests" for tools that DFHack already has, in order of popularity, along with brief descriptions and links to each existing tool's documentation:

  • quickfort: applies digging, building, stockpile, and zone designations to a map according to a blueprint file. It also has modes that allow you to play back keystroke sequences with the cursor at specific spots on the map. It comes with a library of ready-to-apply blueprints that you can use to design your fortress. Here is an example blueprint for digging, furnishing, and configuring a library and a temple (along with a bunch of other rooms that are prepared for assignment as temples and guildhalls).
  • dwarfmonitor: measure your fort's efficiency and add widgets to the screen that display live-updated information.
  • buildingplan: place buildings and constructions even if you don't have the materials ready yet. They will get built when the construction materials become available. Very useful for planning out large walls or megaprojects since you can designate constructions in places that aren't reachable yet. Works well with automaterial for designating constructions over large areas. quickfort also uses buildingplan to place buildings and constructions from blueprints.
  • automaterial: Moves the last selected material to the top of the list when building more constructions of the same type. Also allows designating very large, optionally hollow, rectangles for construction.
  • orders: import and export lists of manager orders. DFHack comes with a library of ready-to-use manager orders that you can import.
  • manipulator: Easily manage labors across the dwarves in your fort. Supports saving and applying groups of labors as custom professions. DFHack comes with a library of useful professions that you can apply to your dwarves.
  • strangemood: triggers a strange mood. you can optionally choose the dwarf, type of mood, and which skill is used to create the artifact.
  • changevein: changes the vein under the cursor to the specified material.
  • exportlegends: export legends mode data for viewing in external utilities.
  • drain-aquifer: converts all aquifer tiles on the map to regular soil/stone.
  • seedwatch: controls whether each seed type can be cooked based on whether you have enough of that seed to support farming.
  • diggingInvaders: allows siegers to dig and destroy constructions to get to your dwarves.
  • prioritize: watches job creation and ensures jobs of specified types get done quickly. Use this, for example, to ensure your haulers haul your food before it rots.
  • gui/gm-unit: edit unit attributes
  • mousequery: add mouse controls to the DF interface. Hover your mouse cursor over a tile to get information on what that tile contains. Click on a building or stockpile to get to its settings menu.
  • blueprint: record a copy of your fortress in a quickfort blueprint.
  • gui/dfstatus: shows a quick overview of critical stock quantities.
  • forum-dwarves: export the text on the screen to a file.
  • createitem: spawns in an item of your choice. use `createitem inspect` to discover the properties of an existing item you want to copy.
  • gui/settings-manager: GUI interface to customizing the Dwarf Fortress `data/init/init.txt` and `data/init/d_init.txt` files.
  • prospect: discover mineral content of an embark region
  • gui/pathable: displays the tiles that are reachable from the cursor by a walking unit
  • autolabor: automatically set labors on your dwarves according to the jobs that need to be done
  • gui/gm-editor: directly edit Dwarf Fortress data structures
  • autochop: automatically manage tree cutting designations so you always have enough wood in stock
  • spawnunit: create a new unit on the map
  • autodump: destroys all items selected for dumping or moves them to the cursor location
  • zone: assigns animals to pastures
  • gui/room-list: lists all rooms owned by a dwarf
  • gui/mod-manager: installs/uninstalls DF mods
  • tweak makeown: add visitors or merchants to your fort
  • fastdwarf: make dwarves magically fast
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3184 on: June 28, 2022, 07:45:20 am »

Code: (Open-advmode.lua) [Select]
local old_screen=dfhack.gui.getCurViewscreen()
local new_screen=df.viewscreen_setupadventurest:new()
old_screen.child=new_screen
new_screen.parent=old_screen
for Rawid,Creature in pairs (df.global.world.raws.creatures.all) do
new_screen.races_info:insert("#",{new=true,race=Rawid,anon_1=20000,playable=true})
if Creature.flags.HAS_ANY_INTELLIGENT_LEARNS==true then
new_screen.race_ids:insert("#",Rawid)
end
end

new_screen.highlighted_entity_ids:insert("#",'-1')
for Civ_id,Ent in pairs (df.global.world.entities.all) do
new_screen.highlighted_entity_ids:insert("#",Ent.id)
for _,Setup in pairs (new_screen.races_info) do
if Ent.race==Setup.race then
 Setup.entity_id=Ent.id
end
end
end


df.global.gamemode=df.game_mode.ADVENTURE
df.global.gametype=df.game_type.ADVENTURE_MAIN



ok so while screwing around with viewscreens here's a slightly better open advmode creation screen script which from my tests works well for making new adventurers... if you're fast traveling as having a game field loaded will cause the game to layer additional game field over the previous and has been prone to crash if done near adv camps and player forts.

I guess with a bit more poking into this scripts one could say mess with the next set of adventurers loadout and probably open the door to hiring reinforcements and updating the party system with new members.
though I haven't figure out how to say... manipulate the character creation to go back to a previous adventurer made to change their gear or update their look or buy them more pets.

oh yeah this pretty much works in legend mode and world generation(warning uhh you might wanna clear the nemesis pool after your done screwing around or you might crash the game before the world gen is finished ... also if you have the go to world generation script I made earlier) fort mode is a bit tricky as technically it's still on a game field and probably result in the same land overlaying issue as with using this script while not fast traveling. also I don't know if this leads to any weird bugs or save corruptions down the line so probably a good idea to make backups of the saves you like before fiddling with this.

Code: (open-worldgen.lua) [Select]
--thanks to Warmist for the old_screen new_screen addition and Open-legends devs for inspiration
local old_screen=dfhack.gui.getCurViewscreen()
local new_screen=df.viewscreen_new_regionst:new()
old_screen.child=new_screen
new_screen.parent=old_screen
new_screen.worldgen_paused=true
df.global.gamemode=3
df.global.gametype=11
local WorldGenStat=df.global.world.worldgen_status
WorldGenStat.state=8
if new_screen.worldgen_presets~=0 then
local WGParms=df.global.world.worldgen.worldgen_parms
WGParms.beast_end_year=df.global.world.worldgen.worldgen_parms.beast_end_year+1000
WGParms.end_year=df.global.world.worldgen.worldgen_parms.end_year+1000
new_screen.worldgen_presets:insert("#",df.global.world.worldgen.worldgen_parms)
else
old_screen.worldgen_presets:insert("#",{new=true,df.global.world.worldgen.worldgen_parms})
end



ok so this revised version of the worldgen viewscreen script will now access world generation for the world save.
the big issue is in most of my tests with this it crashed if you fast travel and it crash if you unpause fort mode
so the only way to use this is if you world gen then instantly go and retire the adv or fort then load it back up.
probably one of the more unstable scripts but this does get you access to probably the world gen history event happening to your fort and adventurers...

also word for the wise probably best not to World gen like a over 100+ years or you will have your citizens dying of old age if they aren't already immortal, as in my test the citizens would be idle in the exact same spots you left them when you started world generating... might need to see if this works on necromancers though.

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

Tyxaar

  • Bay Watcher
  • Skilled artist, adequate modder, great Necromancer
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3185 on: July 08, 2022, 05:09:02 am »

Heyo, question about scripts here. I know hardly anything about how to write DFhack scripts, but how would I go about modifying the cannibalism script to apply to all sentient corpses as soon as they die? Note that I have written literally 0 dfhack scripts or plugins, but if someone could let me know, that'd be neat.
Logged
Heyo! I'm Tyxaar, I go by she/her, and I'm an Australian digital artist.
I enjoy modding, games, art, TTRPGs, and other various nerdy stuff.

Atkana

  • Bay Watcher
  • [CURIOUSBEAST]
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3186 on: July 14, 2022, 10:59:29 am »

I'm currently having a problem when assigning syndromes via script. I have a syndrome that's supposed to immediately grant the ability to perform an interaction, however the way syndrome-util applies syndromes means that any syndrome effects added won't come into effect until the next syndrome tick (which can be quite a while in adventure mode), meaning the ability won't become available until then. Is there an alternative way to apply syndromes, or maybe some way to forcibly trigger the game to re-check a creature's syndromes without having to wait for the next syndrome tick?



Heyo, question about scripts here. I know hardly anything about how to write DFhack scripts, but how would I go about modifying the cannibalism script to apply to all sentient corpses as soon as they die? Note that I have written literally 0 dfhack scripts or plugins, but if someone could let me know, that'd be neat.

Here's something I just quickly threw together - it might need a little testing. It should automatically do the cannibalism thing whenever an item is created (except ones created due to traders, migrants, invaders and spider webs - some limitation on the event used), and yeah, a creature dying counts as creating a corpse :b.
Code: (auto-cannibalism.lua) [Select]
-- Makes any creature that dies cannibal-able
local eventful = require "plugins.eventful"

function on_item_created(item_id)
local item = df.item.find(item_id)

item.flags.dead_dwarf = false
end

--------------------
initialized = initialized or false

function init()
-- Set up everything to default values here
initialized = true

eventful.enableEvent(eventful.eventType.ITEM_CREATED, 1)
eventful.onItemCreated["auto-cannabalism"] = on_item_created
end

function reset()
-- Set things to nil/default here
initialized = false

eventful.onItemCreated["auto-cannabalism"] = nil
end

dfhack.onStateChange["auto-cannabalism"] = function(code)
-- Wipe / reset data whenever loaded state changes
if code == SC_WORLD_UNLOADED then
reset()
elseif code == SC_WORLD_LOADED then
if ( not initialized ) then
init()
end
end
end

if ( not initialised ) then
init()
end
I think I may have used the wrong template, meaning that the script will always be running for the whole game session rather than per-world, but I'm too lazy at the moment to check/fix it :p

edit: I've released a more improved version on my github. Still waiting to find out about a workaround for my syndrome-assigning problem, though :c
« Last Edit: July 17, 2022, 07:47:01 am by Atkana »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3187 on: July 16, 2022, 01:37:25 am »

Looks to me like the onStateChange handler is clearly checking for SC_WORLD_(UN)LOADED to determine when to enable/disable the event handler, so it should work the way you want. Cool idea to use the ITEM_CREATED event, by the way - I had been thinking of using UNIT_DEATH, but it's a bit more work to connect to the item that way.
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.

Atkana

  • Bay Watcher
  • [CURIOUSBEAST]
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3188 on: July 16, 2022, 03:56:24 am »

Looks to me like the onStateChange handler is clearly checking for SC_WORLD_(UN)LOADED to determine when to enable/disable the event handler, so it should work the way you want. Cool idea to use the ITEM_CREATED event, by the way - I had been thinking of using UNIT_DEATH, but it's a bit more work to connect to the item that way.
Yeah, I originally tried using the UNIT_DEATH event, looping through the unit's corpse pieces and removing the dead_dwarf flag, but it didn't seem to work - I think maybe a delay before setting the flag is required with that method, and that's too much faff :P

After thinking, I have realised the part I was supposed to cut from the template: the elseif code == SC_WORLD_LOADED then section. That's restarting the script any time a world is loaded in the same game session as the script is run, when really it should be a conscious choice to run it (or at least, a per-save choice to automatically run it via an onLoad*.init). Wouldn't want to finish playing your modded post-apocalyptic cannibal-fest save, then switch to one of your regular dwarf fortress saves and see your dwarves butcher the recently deceased mayor or something.

FantasticDorf

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3189 on: July 16, 2022, 07:18:56 am »

Heyo, question about scripts here. I know hardly anything about how to write DFhack scripts, but how would I go about modifying the cannibalism script to apply to all sentient corpses as soon as they die? Note that I have written literally 0 dfhack scripts or plugins, but if someone could let me know, that'd be neat.

Here's something I just quickly threw together - it might need a little testing. It should automatically do the cannibalism thing whenever an item is created (except ones created due to traders, migrants, invaders and spider webs - some limitation on the event used), and yeah, a creature dying counts as creating a corpse :b.

This was already done by Burritoman's 'Fix sentient butcher' script, but i dont believe they're around for comment anymore. It's still working to this day, even if you configure as usually in session (and between DFhack saves at the same root-file) and can trigger it remotely from .Load etc subfiles which can be written on the spot in the OS df folder raw location but it does have caveats in coverage, like those deep in the caverns/sudden deaths where its turned off and lead to a backlog or exceptions where you'd have to work around it.

Going by item creation would possibly be similar to the smart-pets//nemesis updating aspect of the modern create-unit, but the status is passed along (exemplified by the times i've restored troll hair, by checking the GUI connected entity materials list which when you jump to the part and-re activate dead dwarf true, the object takes the nemesis name prefix), and workshops won't take dead_dwarf true items for being "rotten" or cause they're too small (often with teeth that get beat out while subject is still alive and dead_dwarf=true).
Logged

Tyxaar

  • Bay Watcher
  • Skilled artist, adequate modder, great Necromancer
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3190 on: July 19, 2022, 06:57:04 am »

Atkana and I talked about it and they found a workaround that works fine! Here's the full script if anyone else wants to use it. It hasn't been tested with necromancy though.

Spoiler (click to show/hide)
Logged
Heyo! I'm Tyxaar, I go by she/her, and I'm an Australian digital artist.
I enjoy modding, games, art, TTRPGs, and other various nerdy stuff.

doublestrafe

  • Bay Watcher
  • [PONY_DEPENDENT]
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3191 on: August 03, 2022, 04:48:57 pm »

Few questions about assign-prefences:

Is there a token that will allow a dwarf to like to eat [CREATURE] eggs?
Is there a limit to the number of preferences you can assign?
Will really generic preferences work? Like, will -likeitem PANTS give good thoughts for both a civilian putting on a -hemp skirt- from an elf corpse and an armorer making ☼steel greaves☼?

Thanks!
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3192 on: August 05, 2022, 08:16:19 am »

Code: ('Add2Party.lua') [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

unit=getCreatureAtPos(getxyz())
df.global.ui_advmode.interactions.party_core_members:insert("#",unit.hist_figure_id)

ok so stumbled upon the data in advmode ui that holds where the 'core party members' are or well  what I been calling Adv party members.
so now uhh here's a script that works like bodyswap but uses the in game swap mechanics to switch around adventurers... also doubles as a companion maker since all adv party members are following each other. currently realizing I could have been playing around with this when adv mode got party members... oh well better late than never.


edit: oh this was also added to the repo's body swap hmm though that doesn't really add more adventurers to your party unless you make them companions then swap over to them with the repo body swap script

edit 2: well while I'm here, probably good enough time to dump this modified update on the open-advmode script which now attempts to grab campboats but mostly lets the player start from their player site... and start as any sapient creature.

Code: ('Open-Advmode2.lua') [Select]
local old_screen=dfhack.gui.getCurViewscreen()
local new_screen=df.viewscreen_setupadventurest:new()
old_screen.child=new_screen
new_screen.parent=old_screen
for Rawid,Creature in pairs (df.global.world.raws.creatures.all) do
new_screen.races_info:insert("#",{new=true,race=Rawid,anon_1=20000,playable=true})
if Creature.flags.HAS_ANY_INTELLIGENT_LEARNS==true then
new_screen.race_ids:insert("#",Rawid)
end
end

new_screen.highlighted_entity_ids:insert("#",'-1')
for Civ_id,Ent in pairs (df.global.world.entities.all) do
new_screen.highlighted_entity_ids:insert("#",Ent.id)
for _,Setup in pairs (new_screen.races_info) do
if Ent.race==Setup.race then
 Setup.entity_id=Ent.id
end
end
end



for Civ_id,Ent in pairs (df.global.world.entities.all) do
for boat,camp in pairs (df.global.world.world_data.sites) do
if camp.name.first_name=="BOAT" or camp.type==0 then
local Campent=camp.entity_links
for _2,Campe in pairs(Campent) do
if Campe.flags.residence==true or  Campe.flags.land_for_holding==true then
new_screen.highlighted_entity_ids:insert("#",Campe.entity_id)
for _,Setup in pairs (new_screen.races_info) do
 Setup.entity_id=Campe.entity_id
end
end
end
end
end
end


df.global.gamemode=df.game_mode.ADVENTURE
df.global.gametype=df.game_type.ADVENTURE_MAIN
so I probably should advise to use this you probably want to have a player fort made or use one of my many old camp boat scripts so that the starting site gets picked up.
so far you probably don't want to use this on a fresh adventurer if you want to keep said fresh adventurer around as any new adv's made wouldn't been saved to the game and won't be able to unretire since they never retired in the first place... if you go with the fast travel set up to avoid site overlay issues and crashing if you attempt this while on the camp site.


« Last Edit: August 06, 2022, 06:50:54 am by Rumrusher »
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

doublestrafe

  • Bay Watcher
  • [PONY_DEPENDENT]
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3193 on: August 09, 2022, 04:10:54 am »

So maybe I'm in over my head, but armed with a 20 year old knowledge of just enough vba experience to look like a genius in a small office, and a frustration with trying to figure out how and when stuff happened looking through gamelog.txt, I sat down today to try to teach myself lua.

Fortunately, it's similar to all the other coding I've ever done, which is to say that the best way to approach it is to steal liberally from any possible source. I've managed to get as far as writing a script that will, with the help of "repeat", print the time and date to the announcement log on a regular basis. It uses no loops and ought to give any seasoned coder a good laugh. Of course, now that that part's complete, I found dfhack.gui.WriteToGameLog, so now I'll have to rewrite it to be quiet.

But I've run into another problem with the gamelog.txt, which is that it doesn't care at all what save you're running from. Everything from every fort goes in willy-nilly. So I thought, while I'm writing a timestamp, why not write the name of the fortress? How hard can that be?

I am at an utter loss here. I had been able to find df.global.cur_year only because timestream uses it--I learned a lot from timestream, actually. And I found where it came from, in https://github.com/DFHack/df-structures/blob/master/df.globals.xml (had to go online--despite the Lua API docs' assurance, \hack\library\xml only contains how-to-update and SYNTAX). There are some interesting things there, but not, as far as I can tell, the name of the fortress.

Really, this is a more general question, though I really do want to know how to return the fortress name, or at least the world name. But how do you find what you're looking for in the dozens of xml files? Is it just a question of sheer dogged perseverance and trial and error?
Logged

Schmaven

  • Bay Watcher
  • Abiding
    • View Profile
Re: DFHack 0.47.05-r6
« Reply #3194 on: August 09, 2022, 05:33:18 am »

Is it possible to run a search on the xml files for the fort / world name text strings?
Logged
Pages: 1 ... 211 212 [213] 214 215 ... 244