Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: relations-indicator [DFHack lua script] 1.17  (Read 30725 times)

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
relations-indicator [DFHack lua script] 1.17
« on: September 15, 2017, 02:29:38 pm »

...Or yet another tool for play-dates. Features:

Showing individual unit pregnancy and lover status in both view-general and unitlist modes.

Viewing individual units

Pregnant, married dwarf:
||
Screenshot from 3rd embark

Dead spouse:
||
These are quite common in many succession forts

Offsite spouse:
||
This happens often with visitors

Birds get little different pregnancy text:
||

Viewing unitlist

Aggregated view on the left

||
Breadbowl screenshot

that enables you to see suitable marriage pairs on clicking a Citizen's indicator:
(second click restores list)

||
Moonhome screenshot  for third generation dwarf's suitable marriage candidates

or with popup lightbox-like box on a visitor:

||
Illustrative gloomdiamonds screenshot

Finally, can hover with mouse over a pregnancy indicator for numerical value of how many full months the unit has been pregnant for.

||

There's also partial support for lethosor's lua implementation of manipulator:
(shift-scrolling with numpad behaves weirdly, but clicks and (shift-)arrowkeys work.)
||

Usage

To use the script, you need to have saved relations-indicator.lua to text file in /hack/scripts and ditto for gui/indicator_screen.lua in /hack/scripts/gui.

Then either add to onMapLoad(_extra).init or dfhack.init
or just pregnancy-indicator bind (shorthand for above).
(Can at any time disable them with pregnancy-indicator unbind.)

Use relations-indicator bindings to get the above list and exit.

Visual considerations:

I tried to follow preexisting precedents for colors, but there are none for gay guys or girls.
Are yellow and red respectively really the most suitable picks? I don't know.
Ditto for offsite and dead units. The blue shades go entirely unused,
but on the other hand default navy is kind of hard to see on black.
You can at any time see what corresponds what by entering relations-indicator explain colors.

Nest box symbol for pregnant birds makes sense, but a tileset user might find ¶ quite inappropriate when it is converted into a mug;
the default female and male symbols being converted into necklaces and bags may be no better.

Perhaps the textual fluff is too verbose or its tone not suitable; perhaps the information too or not enough accurate.

Perhaps the blinking is too fast or too slow.

If some of these are not pleasing, one can alter the color shades on line 31-38 and symbol usage on lines 68-76.

Gameplay considerations:

How bad must the personality be for a person to be unmarriable?

Presently, it assumes two people with shared parent or either-way grudge won't marry, as well as any one person whose friendship value +friendliness+emotional obsessiveness are combined below 0 (avg would be 100)
or whose esteem of romance or  love propensity combine below 14 (average would be 50)
or whose family valuation is below -40 (average would be 0).

These are probably not precisely the right values or even considerations - why, social and shared skills are absent. I don't know what the right numbers would be, but any would-be experimenter can edit them on lines 83-85.


Second consideration  is non-citizen intelligent creatures. Intelligent here meaning CAN_LEARN without SLOW_LEARNER.

Pets: In my embark tests, they seem unable to breed or get a relationship in years in 3x3 marriage suites when intelligent [with or without +speaking].
So, they get marked as infertile. That said, at least some have managed to breed some manner of intelligent pets somehow, so this might be a question on manner of tags.

Non-historical units:
As one needs to be historical figure to have a relationship, they also get marked as infertile.
For what it is worth, I've failed to get animalmen who have not joined the fortress to do the hanky-panky when they've become historical as well. 
However, this is interesting data for visitor petitions.

Oh yeah, btw, it relies on few historical unit unk values for info like grudges and gelding, and will not work properly with syndrome that removes sterility, and effects with divorces are unknown.

Spoiler: changelog (click to show/hide)

« Last Edit: December 13, 2020, 12:04:53 am by Fleeting Frames »
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #1 on: September 15, 2017, 03:12:19 pm »

Looks quite interesting and handy. I expect I'll give it a try with my next fortress, with a current guess of late November (relies on next DF release being out and, of course, DFHack being available at least in an early version).
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #2 on: September 15, 2017, 03:59:00 pm »

I love tool like these. They somehow integrate more nicely than just e.g. "list all pregnant people" etc...

Jazz Cat

  • Bay Watcher
  • Adept stringed instrumentalist
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #3 on: June 05, 2018, 11:52:18 am »

Posting to watch, since this is presumably getting updated soonish with the new version.
Logged
Give your dwarves a pet
My holiday mod (only offensive to elves)
The check-laundry script

Quote
Just give the Crossbow weapon the [AMMO:CROSSBOW] tag in the raws. You can make a crossbow that shoots crossbows.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #4 on: June 25, 2018, 07:55:39 am »

No update; works fine.

The one which needed an update was gui/indicator-screen, but I already gave you that earlier.

snowyscales

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #5 on: July 05, 2018, 04:13:43 am »

i love the idea of this, but when i put the relations indicator and indicator screen luas into the right places, i came across a problem - the onmapload_extra.init doesn't exist, so i popped the keybinds into the dfhack.init which seemed to work.

only... when viewing the dwarves it didn't show their marital or pregnancy status. that only showed on the units list. and selecting the dwarves in the units list doesn't highlight who they are compatible with?

it was then i noticed dfhack was puking out all of this:

https://i.imgur.com/lYKbCDl.png
https://i.imgur.com/VDe3bdX.png

at first i thought that perhaps it was just because this was a new world, and it hadn't had the time to properly generate all the historical whatsits. and, indeed, once the first migrant wave came, the majority of the error spam disappeared when clicking on the relationship symbols, and it started showing me who was compatible with each other.

except that there are still some errors when clicking on four of my dwarves -

« Last Edit: July 05, 2018, 05:34:06 am by snowyscales »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #6 on: July 05, 2018, 11:38:05 am »

Yay for bug reporting \o/!

Hm, anon3 for all four. Reminds me of safety checking fails with undead and their lack of souls that I fixed before. Looking at code, it might be that one of the anons (anon3) was identified and renamed in dfhack. All the errors point at that.

*checks* Can replicate with some really young dwarves (haven't played 44.09 much but I have older imported save with breeding).

And yup, anon3 is gone and replaced with attitude, with numeric indice notes matching my research. Easy fix. Here you go for 1.1

Also, can't replicate the lack of 'v'iewing on 'v'iew mode. You're using latest version(1.2) of gui/indicator-screen, right? Previous version also had bug with not showing, caused by similar case.
« Last Edit: July 05, 2018, 12:24:54 pm by Fleeting Frames »
Logged

snowyscales

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script]
« Reply #7 on: July 05, 2018, 11:39:55 am »

just now i decided to see if removing the keybinds from dfhack.init and just calling them in-game would fix things. it did not.

Clicking on -

Edzul's icon did this: https://imgur.com/A0oteeW

Catten's showed this, which is expected since she's unwilling to marry, but it does this for everybody it doesn't throw an error for: https://imgur.com/11kbKfS

Tulon Melbildegel's showed this: https://imgur.com/AkAh9UU
but Reg Tunnosing's did this: https://imgur.com/lMv8B3o

M1 Zon is married but clicking on their icon (or their husbands) just shows them alone: https://imgur.com/EBlam9d

Ral Itdunkadol's icon is a wheelbarrow??: https://imgur.com/rOWwFnT

Tosid Othosingiz's icon says he's infertile/asexual: https://imgur.com/N68CAgR
but Dwarf Therapist says he's not, and his only injury is a smashed hand: https://imgur.com/klAuQnY


EDIT: and i didn't notice you'd posted a fix there, so i'mma go try that out

EDIT 2: i'm still having the weird wheelbarrow icon issue with Ral, and Tosid showing as infertile/asexual when he's straight and has no gelding accidents. But everything else is perfect i love you. platonically

EDIT 3: okay, so i played with r-e for a bit, shut down the game and went off to do some shopping, came back and loaded it up and suddenly my married couple are no longer showing each other when clicking the symbols, just themselves, and when Viewing them they don't have the pregnant/married to information. everything else is working perfectly. (edit 4: and the keybinds have started unbinding which. weird.)
« Last Edit: July 05, 2018, 03:31:49 pm by snowyscales »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: relations-indicator [DFHack lua script] 1.1
« Reply #8 on: July 05, 2018, 04:04:17 pm »

Jeesh, you posted less than 2 minutes after me.

The ö is intentional, and is vanilla ring tile; it represents them being lovers with someone. In case of Ral, their lover is dead (greyed out). As said, can adjust these on lines 67-78 to something you find more appropriate.

Why don't you post screenshot of Tosid's personality? I don't think Dwarf Therapist takes that into account, but this script does. He might be too dour to make friends, or hate family; such things count as well here.


Also, these and all other keybinds have to be set on every start; they disappear on exit. That's why I suggested adding them into init along with other binds :P

Though I can't replicate keybinding issue, I did notice that I forgot to include the unit family layer zoom in relationships however. Fixed.

The married couples should definitely be showing both parties of marriage, though. If it isn't throwing an error on those, can you provide the save? My couples work fine.
« Last Edit: July 05, 2018, 04:16:59 pm by Fleeting Frames »
Logged

snowyscales

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script] 1.11
« Reply #9 on: July 05, 2018, 07:50:03 pm »

ah, i was typing up an edit to my original post when it said you'd done a reply so i just copied what i was writing and made it a new post, and then continued writing in it as i was trying out the update.

also I could have SWORN that Ral hadn't been dating anybody but apparently he'd been dating Dumed, sadly lost in a necromancer attack on the fort when i locked the gates not noticing she was out gathering logs

Tosid's personality: https://imgur.com/deyA1pk

and i removed the keybinds from the init file, just to see if that would help, before you posted the update, and never got round to adding it back in. so i've been calling them from the dfhack window. but they keep intermittently unbinding when i leave the unit list or stop Viewing a dwarf, and to get them to show on View i have to recall the binds while Viewing the dwarf.

and when i escaped from Viewing a dwarf it did: https://imgur.com/84lJVPM , though this might be because i'd been using the mouse to click on the dwarf and called the bindings to see who her lover was since it was showing up, instead of using V which i always forget.

at one point i was clicking on one of the symbols and it showed just the dwarf (she had no matches), but it also still showed all the symbols of the other dwarves down the side - but i couldn't recreate this to get a pic or check for an error.

and the save file: http://dffd.bay12games.com/file.php?id=13869
« Last Edit: July 05, 2018, 07:51:55 pm by snowyscales »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: relations-indicator [DFHack lua script] 1.11
« Reply #10 on: July 05, 2018, 08:37:38 pm »

Ah, yes, Tosid is indeed sterile person - "He is not the type to fall in love or even develop positive feelings. He is slow to trust others."


Clicking on dwarves doesn't work, sadly. Y'see, keybinding plugin can't trigger on mouse presses, lua guis can't watch the game while unpaused and mousequery doesn't provide support for it (it shows the dwarf, but it doesn't press the v key, which is necessary). It'd be possible only if this script was turned into a plugin (or if I checked if the game was viewing a dwarf every few steps, I suppose). Though you can confirm binds actually disappeared by typing keybinding list V into dfhack prompt; if it is empty they poofed.


That's an interesting bug. screen:isDismissed() is not something that I wrote, rather included it as sanity check, but...You're not allowed to check if unactive screen is dismissed? Weird.

Well, I'll remove that, you try this gui/indicator-screen & tell me if it goes away. Can't replicate, but my fps/gfps ratio is well above 2.


Can now replicate the lonely married dwarves. Quite the odd issue, wonder if it is linked to false identity. *open-legends* no cape identies.

*investigates*

*investigates*

THIS IS AN ILLEGITEMATE MARRIAGE!

Zon is a child bride, being mere fifty two years old, while Reg is seventy seven, a 25-year age difference.

Worldgen can do that, right.

Anyway, moved age check below spouse check and updated link in main post. Less efficient, but good riddance.

PS: It seems you have temperate shrubland in air biome, so you could get bears climbing down trees and grow temperate crops there.
« Last Edit: July 05, 2018, 08:53:35 pm by Fleeting Frames »
Logged

snowyscales

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script] 1.12
« Reply #11 on: July 06, 2018, 02:20:48 am »

oh geez, poor Tosid, and he dreams of raising a family, too

and yep, the screen:isDismissed() bug seems to have gone away; the keybinds no longer seem to be unbinding, and Reg and Zon are now showing as properly married. though i'll know for sure later on when i have the chance to play for a proper amount of time.

yeah, worldgen can do all sorts of illegal marriages - couples who are too old/too young, married asexuals, gay/straight couples... and they almost always show up with a worldgen kid or two and then never have another

huh. i mean there's a shrubland biome just a couple scoots north of my embark (and swamp just to the right). but that does explain why a pangolin fell out of a tree
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: relations-indicator [DFHack lua script] 1.11
« Reply #12 on: July 06, 2018, 04:58:24 am »

lua guis can't watch the game while unpaused

i've done it. here's the code

Code: [Select]
function OverhaulUI:onRender()
    self._native.parent:render()
    self:renderSubviews(gui.Painter{})
end
function OverhaulUI:onIdle()
    self._native.parent:logic()
end
function OverhaulUI:onInput(keys)
    if keys._MOUSE_L then
        df.global.enabler.mouse_lbut=1
    end
    if keys._MOUSE_L_DOWN then
        df.global.enabler.mouse_lbut_down=1
    end
    if keys._MOUSE_R then
        df.global.enabler.mouse_rbut=1
    end
    if keys._MOUSE_R_DOWN then
        df.global.enabler.mouse_rbut_down=1
    end
    for code,_ in pairs(keys) do
        if self.allowKeyPresses or allowedKeys[code] then
            self:sendInputToParent(code)
        end
    end
    self:inputToSubviews(keys)
    df.global.enabler.mouse_lbut=0
    df.global.enabler.mouse_lbut_down=0
    df.global.enabler.mouse_rbut=0
    df.global.enabler.mouse_rbut_down=0
end

from my somewhat stillborn fully mouse-based GUI project

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: relations-indicator [DFHack lua script] 1.12
« Reply #13 on: July 06, 2018, 11:31:55 am »

Well damn, thank you Putnam.

Removed sharpnel(allowKeyPresses/allowedkeys), slapped into hello world with few adjustments, and got Wohoo, lua viewscreen :) while watching dwarf haul rocks in wheelbarrow around.

I can assume the onIdle :logic(), which I was completely unaware of, was what I needed.

Thanks again; assuming no unforeseen issues crop up this gives potential for a whole new class of options I've dismissed.

E: Though it seems it doesn't handle drawing dig designations by holding down mouse buttons unless I remove zeroing them in enabler (clickin to make them still works tho).

@snowyscales: Excellent, added that link into gui/indicator-screen then.
« Last Edit: July 06, 2018, 05:31:06 pm by Fleeting Frames »
Logged

snowyscales

  • Bay Watcher
    • View Profile
Re: relations-indicator [DFHack lua script] 1.12
« Reply #14 on: July 08, 2018, 01:08:18 pm »

i think i can safely say that everything is working absolutely perfectly now; i've not noticed anything weird since your update early friday morning

i wish i'd found this script much much earlier, it's amazing (though the fact that every single king/queen in every single one of my games is either infertile or refuses to marry is a bit weird game why are you doing this to me)
Logged
Pages: [1] 2 3