Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [Lua script] List gods, temples and worshippers list-gods.lua  (Read 6322 times)

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile
[Lua script] List gods, temples and worshippers list-gods.lua
« on: October 30, 2018, 03:57:36 pm »

DFhack Lua script, to be put in hack/scripts/list-gods.lua
It's for v0.44.12.

Spoiler (click to show/hide)

This is a script to show all gods available, their number of worshippers (divided into three categories: citizens, long-term residents and short-term visitors), as well as status of the best temple for each god, plus assigned zones. I had to make it when my fortress reached about 100 gods and started to have problems with temple management. It allowed me to discover popular gods with no temples, gods who lost popularity, or find zones/rooms assigned to temples and forgotten, which is not that easy with DF's interface.

The script otputs to DFhack's console, but the mode of action depends on the cursor or highlight in the main DF window.

Options:
-help will show a reminder of main options ("list-gods -help")
-all will show gods worshipped by visitors only, in addition to citizens+LTRs
-domain will show domains (spheres) of the gods in the main list
-noroom will prevent showing rooms (but not zones) assigned to locations


Color coding for temples are:
light green - all visitors welcome
white - citizens and long-term residents only
yellow - citizens only
blue - there is no zone/room assigned to the temple (so it has no physical location)
dark grey - the temple doesn't exist (used for gods with no temples)


There are three modes:
1. default mode - gods available for creating temples are shown, ordered according to the number of worshippers (most popular on top), and colored depending on status/inclusivity of their best temple. Additionally all universal temples are listed (dedicated to no particular deity), as well as orphaned temples (dedicated to deity which has no longer worshippers).

Without additional option only gods avaialble are listed, i.e. ones worshipped by your civ or citizens and long-term residents on map. But with option "-all" also gods worshipped by visitors are listed. The game doesn't count visitors when displaying gods available and number of worshippers, that's why this is optional here. There is also option "-domain" (or "-domains") which will display domains (spheres) associated with that god.

[EXAMPLE]
Spoiler (click to show/hide)

2. zone/temple mode - when either the cursor is on a zone in main window, or the location is highlighted in the list of locations. Shows name of the zone (or zones, if overlapping) under the cursor, color-coded name of the temple, spheres associated with the god, number of worshippers of each category, and zones and rooms.

There is additional option, "-noroom", which prevents counting the rooms, only zones are shown. This is mostly useful with taverns actually, unless you assign rooms to the temples too.

[EXAMPLE]
Spoiler (click to show/hide)

3. unit mode - when the unit is selected in any way (even in list of deads). Shows citizenship status of the unit, all gods worshipped by it (color-coded according to the best temple), associated spheres, need for worship (not all worshippers need to actully worship the god), as well a focus level associated with worshipping the particular god.

[EXAMPLE]
Spoiler (click to show/hide)

EDIT:
  • Added option to show domains (spheres) of gods in the main list. For temporary use type -domain option, for permanent use change line
    Code: [Select]
    LIST_DOMAINS = false to
    Code: [Select]
    LIST_DOMAINS = true in the CONFIGURATION part.
  • Fix: removed home civ merchants and their bodyguards from visitor count
  • Fix: error when adding domains of non-worshipped civ gods (visible only in early fortress)
« Last Edit: November 07, 2018, 03:45:45 am by Saiko Kila »
Logged

Pvt. Pirate

  • Bay Watcher
  • Dabbling Linux User
    • View Profile
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #1 on: November 05, 2018, 12:53:08 pm »

can you add the domains to the list?
Logged
"dwarves are by definition alcohol powered parasitic beards, which will cling to small caveadapt humanoids." (Chaia)

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #2 on: November 05, 2018, 02:58:47 pm »

can you add the domains to the list?

Sure, added this option. Use either "-domain" option or change LIST_DOMAINS to true in the CONFIGURATION part near beginning. However, for neat output this requires console wider than the standard 80 characters in Vista/Win7 (120 characters in never Windows versions should be enough). Console width (including default) can be changed in Properties of the window if need be.
Logged

Pvt. Pirate

  • Bay Watcher
  • Dabbling Linux User
    • View Profile
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #3 on: November 05, 2018, 03:07:07 pm »

cool :)
Logged
"dwarves are by definition alcohol powered parasitic beards, which will cling to small caveadapt humanoids." (Chaia)

seyedaed

  • Bay Watcher
  • In honor of Zutthan Govoslorbam
    • View Profile
    • Twitchin
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #4 on: November 06, 2018, 12:46:35 am »

Hey this is pretty cool! Nice work!
Logged
We honor Zutthan Govoslorbam: "For having one of the most exciting, yet boring lives ever."

Gitlab:   https://gitlab.com/deadeyesisnewb/
Twitch:   https://www.twitch.tv/seyedaed/
Twitter:  https://twitter.com/adwarfslife

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #5 on: November 07, 2018, 03:48:44 am »

Thanks.

I fixed an error with domains of gods worshipped by civ but by no citizens (it was present only in early fortresses in default mode). Also output is a bit neater now, especially if there are 100 or more gods.
Logged

vityav

  • Bay Watcher
    • View Profile
Re: [Lua script] List gods, temples and worshippers list-gods.lua
« Reply #6 on: February 06, 2022, 11:49:08 pm »

This is a wonderful script; makes managing temples so much easier when you don't remember what 10 gods you've already made temples to. Just in case anybody comes here from 0.47 versions of dfhack, some changes to get it going (I don't know that it's at full functionality, but this will run and correctly highlight which deities already have temples):

Code: [Select]
201: for k,v in ipairs(df.global.world.entities.all[civ_k].unknown1b.deities) do --add civ gods, if missing becomes
Code: [Select]
201: for k,v in ipairs(df.global.world.entities.all[civ_k].relations.deities) do --add civ gods, if missing
Code: [Select]
236:  tlist[k]={v.id,v.deity,v.name,acc,false}becomes
Code: [Select]
236:  tlist[k]={v.id,v.deity_data.Religion,v.name,acc,false}
Logged