Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 140 141 [142] 143 144 ... 244

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

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2115 on: February 23, 2020, 01:25:56 pm »

Quick note - the "feature" script seems to be broken for me. feature list doesn't return anything, and feature magma tells me that it "Could not find a magma-bearing feature." Map doesn't have a magma pool, so its just the sea, however normally the caverns/etc would be listed as well.

Happy to provide logs/etc - not experiencing any other issues though. Arch 64 bit :)
Not being familiar with the script, but running "feature list" on the same save in 0.44.12 and 0.47.03 gives the same result for me (9 different ones), and "feature magma" resulted in "Enabled magma furnaces" on both (there are already working magma furnaces, though). However, the DF structures I'm using were downloaded 10 or so hours ago, and so may be newer than the ones you used.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2116 on: February 23, 2020, 08:26:09 pm »

Code: [Select]
if dfhack.gui.getCurFocus() ~= 'setupadventure' then
    qerror('Must be called on adventure mode setup screen')
end

local adv = dfhack.gui.getCurViewscreen().party_members  -- hint:df.viewscreen_setupadventurest
for Pm, Ad in pairs(adv) do 

for k in pairs(Ad.skills) do
    Ad.skills[k] = df.skill_rating.Legendary5
end
for k in pairs(Ad.physical_levels) do
    Ad.physical_levels[k] = df.adventurer_attribute_level.Superior
end
for k in pairs(Ad.mental_levels) do
    Ad.mental_levels[k] = df.adventurer_attribute_level.Superior
end
end

here's a rework on the adv max skills script though this one will max out all the skills for every new adventurer in the party.
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

Taras

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2117 on: February 24, 2020, 08:21:25 am »

How resurrect my dead adventurer?
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2118 on: February 24, 2020, 10:54:33 am »

How resurrect my dead adventurer?

Code: [Select]
local fullHeal = reqscript('full-heal')

if df.global.gamemode ~= df.game_mode.ADVENTURE then
  qerror("This script can only be used in adventure mode!")
end

local adventurer = df.nemesis_record.find(df.global.ui_advmode.player_id).unit
if not adventurer or not adventurer.flags2.killed then
  qerror("Your adventurer hasn't died yet!")
end

fullHeal.heal(adventurer, true)
df.global.ui_advmode.player_control_state = 1

Copy-paste the above into a text editor and save it as a .lua file (name it something like resurrect-adv.lua) in the hack\scripts folder. Then run it by entering the file's name in the DFHack console after you've been presented with the "You are deceased" message.
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

hagger

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2119 on: February 24, 2020, 12:10:37 pm »

Quick note - the "feature" script seems to be broken for me. feature list doesn't return anything, and feature magma tells me that it "Could not find a magma-bearing feature." Map doesn't have a magma pool, so its just the sea, however normally the caverns/etc would be listed as well.

Happy to provide logs/etc - not experiencing any other issues though. Arch 64 bit :)
Not being familiar with the script, but running "feature list" on the same save in 0.44.12 and 0.47.03 gives the same result for me (9 different ones), and "feature magma" resulted in "Enabled magma furnaces" on both (there are already working magma furnaces, though). However, the DF structures I'm using were downloaded 10 or so hours ago, and so may be newer than the ones you used.

Updating structures by installing the latest nightly build worked for me, thanks! I worked around it by actually discovering the magma sea, but nice to see it working again. I think it's always given back that "Enabled magma furnaces" message regardless of whether you're already able to use them - I tended to choose a magma-y feature from the list anyway.

Cheers again.
Logged

Tonren

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2120 on: February 24, 2020, 12:37:08 pm »

Did you install libpthread, though? And did the one you installed match the architecture you're building DFHack for? (e.g. CMake won't pick up on a 32-bit libpthread if you're building 64-bit DFHack.)

I have installed libevent-pthreads-2.1-6 and libpthread-stubs0-dev, which are the closest I can find to a reputable package with "pthread" in the name. apt list --installed suggests that I have the correct AMD64 versions:

Code: [Select]
libevent-pthreads-2.1-6/bionic,now 2.1.8-stable-4build1 amd64 [installed]
libpthread-stubs0-dev/bionic,now 0.3-4 amd64 [installed]

Maybe I downloaded the wrong arch or misconfigured a build option somehow? I'll keep tinkering... it would be nice to be able to build it myself, but the villain update is absorbingly fun... :->
Logged

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2121 on: February 24, 2020, 02:16:47 pm »

libpthread is part of the standard (posix) library, and thus it is part of the base system. The development files should be installed automatically with gcc (the package is libc6-dev if you want to check).
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2122 on: February 25, 2020, 03:13:02 am »

Technical question: Is there a way to check if a pointer is valid in Lua, i.e. if a df structure pointer address is within the range allocated to DF?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2123 on: February 25, 2020, 03:50:55 am »

Technical question: Is there a way to check if a pointer is valid in Lua, i.e. if a df structure pointer address is within the range allocated to DF?

part of answer: here

full answer: you need to get all the segments that df has allocated and check if pointer is inside that segment. You can get all memory segments with "dfhack.internal.getMemRanges()".
Also related mem scan stuff

Taras

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2124 on: February 25, 2020, 03:52:05 am »

How resurrect my dead adventurer?

Code: [Select]
local fullHeal = reqscript('full-heal')

if df.global.gamemode ~= df.game_mode.ADVENTURE then
  qerror("This script can only be used in adventure mode!")
end

local adventurer = df.nemesis_record.find(df.global.ui_advmode.player_id).unit
if not adventurer or not adventurer.flags2.killed then
  qerror("Your adventurer hasn't died yet!")
end

fullHeal.heal(adventurer, true)
df.global.ui_advmode.player_control_state = 1

Copy-paste the above into a text editor and save it as a .lua file (name it something like resurrect-adv.lua) in the hack\scripts folder. Then run it by entering the file's name in the DFHack console after you've been presented with the "You are deceased" message.
Thanks!
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2125 on: February 25, 2020, 05:43:00 am »

Thanks Warmist!
Logged

Erendir

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2126 on: February 25, 2020, 02:14:28 pm »

There is one thing I still want. I saw https://botsin.space/@it_was_inevitable (live feed of interesting dwarf conversation of a fortress) and thought, I'm missing on so much of my dwarfs' lives!

So, step 1 was adding D_D to [REGULAR_CONVERSATION:A_D:D_D] and [CONFLICT_CONVERSATION:A_D:UCR_A:D_D] in announcements.txt.

This ends up with A TON of uninteresting spam in announcements screen.
So, the next step is: figure out how to filter and/or redirect this.

We can hear to reports like this (those enabled in announcements.txt):
Code: [Select]
eventful=require('plugins.eventful')
eventful.onReport.print_report_text = function(id) local report=df.report.find(id); print(id, report.text); end
eventful.enableEvent(eventful.eventType.REPORT, 1)

We can also delete an entry at a given index with
Code: [Select]
df.report.get_vector():erase(idx)

but this doesn't delete it from announcements view.

This does, but only when the screen is open.
Code: [Select]
dfhack.gui.getViewscreenByType(df.viewscreen_announcelistst, 0).reports:erase(idx)

So, what I'm asking is,
  1. is there an easy way to prevent reports from appearing on announcements screen (like set some flag inside the eventful.onReport or something);
  2. lacking that, is there a way to access that `getViewscreenByType(df.viewscreen_announcelistst, 0).reports` when the screen isn't loaded;
  3. and lacking that, is it possible to execute a script when the announcements screen opens?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2127 on: February 25, 2020, 07:32:57 pm »

So, what I'm asking is,
  1. is there an easy way to prevent reports from appearing on announcements screen (like set some flag inside the eventful.onReport or something);
I think world.status.display_timer is what you want - setting it to 0 should clear the bottom of the screen.

The other questions might be useful for other purposes, though, so:
Quote
  2. lacking that, is there a way to access that `getViewscreenByType(df.viewscreen_announcelistst, 0).reports` when the screen isn't loaded;
No, that's a copy that is made specifically for the screen when the screen is opened, and is destroyed when the screen is closed. Modifying it won't affect the global list of reports.

Quote
  3. and lacking that, is it possible to execute a script when the announcements screen opens?
You could use an onStateChange handler - I think that would probably be the easiest way.
« Last Edit: February 25, 2020, 07:34:36 pm by lethosor »
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.44.12-r3
« Reply #2128 on: February 26, 2020, 10:47:05 am »

Code: (GiftSomeone.lua) [Select]
local dlg=require("gui.dialogs")
local testdia=df.global.ui_advmode.conversation
testdia.choices:insert("#",{new=df.ui_advmode.T_conversation.T_choices,})
for nu,choi in pairs(df.global.ui_advmode.conversation.choices) do
if choi.choice==nil then
choi.choice=df.talk_choice:new()
testdia.choices[nu].title:insert("#",df.new("string"))
testdia.choices[nu].keywords:insert("#",df.new("string"))
testdia.choices[nu].choice.type=247
testdia.choices[nu].choice.unk.anon_2=testdia.activity_event[0].participants[1].histfig_id
testdia.choices[nu].title[0].value=("Gift someone themselves")
testdia.choices[nu].keywords[0].value=("Gift")
end
for nod,mof in pairs(df.global.ui_advmode.conversation.page_bottom_choices) do
if nod == 1 then
testdia.page_bottom_choices[nod]=nu
elseif nod == 0 then
testdia.page_bottom_choices[nod]=nu
elseif nod == 1 and 0 then
break
end
end
end

ok so this adventure mode dialog script will hopefully make it so who ever you're talking to will accept the gift of themselves, though given how I set this up it might end up gifting someone you previously talked to so uhh best end conversations with companions before you end up gifting them to some random peasant, or use that to your advantage and end up gifting folks to others.
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

MaxTheFox

  • Bay Watcher
  • Лишь одна дорожка да на всей земле
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2129 on: February 26, 2020, 12:00:26 pm »

unretire-anyone seems to start the people you unretire naked and without any items, only with any artifacts they hold. Is there any way to fix that? e.g by giving them clothing and items appropriate to their civ?
Logged
Woe to those who make unjust laws, to those who issue oppressive decrees, to deprive the poor of their rights and withhold justice from the oppressed of my people, making widows their prey and robbing the fatherless. What will you do on the day of reckoning, when disaster comes from afar?
Pages: 1 ... 140 141 [142] 143 144 ... 244