Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Automatic nicknames from list  (Read 607 times)

comham

  • Bay Watcher
    • View Profile
Automatic nicknames from list
« on: March 29, 2013, 11:32:49 am »

Searched around, but didn't see anything like this. Would it be possible, whether as a dfhack script or an addition to Therapist, to give each new dwarf a gender-appropriate nickname from a pre-set list, ideally not re-using a currently active nickname?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Automatic nicknames from list
« Reply #1 on: March 29, 2013, 04:09:52 pm »

Yeah, it would. Pretty simple, actually, with dfhack.units.setNickname(unit,nick).

No idea how to file i/o with lua, though.

I actually use that function for testing, with this script:

Code: [Select]
function renameAllUnitsByNumber()
    for uid,unit in ipairs(df.global.world.units.all) do
        dfhack.units.setNickname(unit,"Unit " .. uid)
    end
end

renameAllUnitsByNumber()