Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 114 115 [116] 117 118 ... 242

Author Topic: DFHack 50.11-r6  (Read 795774 times)

rel1c

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1725 on: April 18, 2019, 10:18:36 pm »

haha yeah i guess i did!

I'm specifically trying to find out what each wound object is named. So which pointer points to the object that represents say a nose cut that's infected.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1726 on: April 19, 2019, 07:50:55 pm »

They don't really have names like that. Here's the XML definition for unit_wound. I'd guess "parts" has some stuff that's useful for you.
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.

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1727 on: April 20, 2019, 03:36:41 am »

I'm looking to cure only infection from my adventurer. I tried forking full-heal, but alas I can't seem to figure it out. I can get a list of wounds in unit.body.wounds, but they just look like memory addresses.

Use the 'gui/gm-editor' command. It's the most convenient way to visualise structures and allows for manual editing.

A script like this is probably what you're after:
Code: (adv-cure-infection.lua) [Select]
local unit = df.nemesis_record.find(df.global.ui_advmode.player_id).unit
unit.body.infection_level = 0
for _,wound in ipairs(unit.body.wounds) do
  wound.flags.infection = false
end
« Last Edit: April 20, 2019, 04:12:15 am by Atomic Chicken »
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. 

Alatun

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1728 on: April 20, 2019, 04:37:47 pm »

Hi!

I've got a question regarding "eventful.lua" in DF-Hack. I'd like to track some information about dwarfs over multiple years. I've written a small LUA script to export data in a kind of XML style. Now I'm looking for way get this LUA script being triggered automatically and thought there could be an event (like at the 1st of each month).

But what I found so far is:

Code: [Select]
eventType=invertTable{
    [0]="TICK",
    "JOB_INITIATED",
    "JOB_COMPLETED",
    "UNIT_DEATH",
    "ITEM_CREATED",
    "BUILDING",
    "CONSTRUCTION",
    "SYNDROME",
    "INVASION",
    "INVENTORY_CHANGE",
    "REPORT",
    "UNIT_ATTACK",
    "UNLOAD",
    "INTERACTION",
    "EVENT_MAX"
}
Looks like an event being triggered at the beginning of each month is not available. There is an event called "TICK". I was thinking about using this event, but it looks "dangerous" and I found no other script using it so far. As I'm no LUA expert, I'm also unsure how to setup an event handler for this case.

The "TICK" seems to correspond to 0. When looking at the C++ source of the event plugin I saw this:

Code: [Select]
static const handler_t eventHandlers[] = {
 NULL,
 ev_mng_jobInitiated,
 ev_mng_jobCompleted,
 ev_mng_unitDeath,
 ev_mng_itemCreate,
 ev_mng_building,
 ev_mng_construction,
 ev_mng_syndrome,
 ev_mng_invasion,
 ev_mng_inventory,
 ev_mng_report,
 ev_mng_unitAttack,
 ev_mng_unload,
 ev_mng_interaction,
};
So eventHandlers[0] == NULL.

My assumption so far: the TICK event is not implemented. Is my assumption correct or did I miss something?

If it should work, can anybody give me an example, how it could be used?
« Last Edit: April 20, 2019, 04:40:46 pm by Alatun »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1729 on: April 20, 2019, 05:04:22 pm »

There's already a "repeat" script that can run other scripts periodically, if that's what you want. If it doesn't work for you, it uses a separate timeout API that's probably easier to use than eventful for your purposes.
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.

Alatun

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1730 on: April 20, 2019, 05:42:11 pm »

Ok, thx. I will take a look if that could suit my need.
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1731 on: April 20, 2019, 11:21:49 pm »

Will a plugin built for an R2 DFhack work with an R1 dfhack of the same DF version, or vice versa?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1732 on: April 21, 2019, 12:36:20 am »

Nope, it'll fail the DFHack version check in both cases.
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.

Alatun

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1733 on: April 21, 2019, 08:19:22 am »

Just discovered that LUA's

io.stdout:write(...) gets written to stdout.log. To get something printed in the dfhack console window, you must use "print".

When using loops to generate output print is a problem, because each call appends a newline automatically. Is there another way to write something to the df console using the io.stream ... api?

I know, I can concatenate strings, but this is ugly.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1734 on: April 21, 2019, 11:45:44 am »

Just discovered that LUA's

io.stdout:write(...) gets written to stdout.log. To get something printed in the dfhack console window, you must use "print".

When using loops to generate output print is a problem, because each call appends a newline automatically. Is there another way to write something to the df console using the io.stream ... api?

I know, I can concatenate strings, but this is ugly.
You're looking for "dfhack.print", with "dfhack.println" adding a newline (which you didn't want).
Logged

Alatun

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1735 on: April 22, 2019, 01:55:03 am »


You're looking for "dfhack.print", with "dfhack.println" adding a newline (which you didn't want).

Thank you.
Logged

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1736 on: April 24, 2019, 06:01:41 pm »

Updated scripts/pref-adjust.lua on the weekend, submitted the pull request.  Working great for me, the previous version was crashing 0.44.12 (along with prefchange. I PM'd Max) due to not handling the new music/dance/poetry entries.

In case anyone was curious, it's much better now and fixed.  :o

As always, there's more options to add, but I figured fixing the crash bug was important.

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1737 on: April 28, 2019, 08:26:31 am »

I'd like to know if my Qt experiment works on macOS (I am worried by this). But, since I cannot use macOS myself, I need help from a macOS user who knows how to compile DFHack plugins.

Download and compile the plugin from here. You will need to install Qt (homebrew can help with that) and pass its installation directory to cmake with -DCMAKE_PREFIX_PATH (-DCMAKE_PREFIX_PATH=/usr/local/opt/qt for homebrew installation).

Try enabling the plugin ("enable qapplication"), then try commands like "qt-info" or "qt-log". Please tell me if windows appear and if DF survives it. Also check the content of "qt_log.txt" in DF directory (or the content of the log window if it works).

Hi, I am still looking for a macOS user who can help me.
Logged

Schmaven

  • Bay Watcher
  • Abiding
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1738 on: May 01, 2019, 06:16:10 pm »

I saw the command in another thread but haven't been able to find it again yet...  Does anyone remember how to tell what types of animals exist on a particular embark?  It's likely in 1 of the 100+ pages here I am still digging through. 
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1739 on: May 01, 2019, 07:37:37 pm »

What do you mean by "exist"? Are you looking for the animals on the map, or animals that could appear on the map? Regular creatures or vermin? Is this before or after embarking?
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 ... 114 115 [116] 117 118 ... 242