{"action":"created","issue":{"url":"https://api.github.com/repos/DFHack/scripts/issues/81","repository_url":"https://api.github.com/repos/DFHack/scripts","labels_url":"https://api.github.com/repos/DFHack/scripts/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/DFHack/scripts/issues/81/comments","events_url":"https://api.github.com/repos/DFHack/scripts/issues/81/events","html_url":"https://github.com/DFHack/scripts/pull/81","id":369183959,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMTg2OTk5","number":81,"title":"Adds lua files for optimizing dwarves in fort-mode","user":{"login":"cppcooper","id":7276349,"node_id":"MDQ6VXNlcjcyNzYzNDk=","avatar_url":"https://avatars1.githubusercontent.com/u/7276349?v=4","gravatar_id":"","url":"https://api.github.com/users/cppcooper","html_url":"https://github.com/cppcooper","followers_url":"https://api.github.com/users/cppcooper/followers","following_url":"https://api.github.com/users/cppcooper/following{/other_user}","gists_url":"https://api.github.com/users/cppcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/cppcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cppcooper/subscriptions","organizations_url":"https://api.github.com/users/cppcooper/orgs","repos_url":"https://api.github.com/users/cppcooper/repos","events_url":"https://api.github.com/users/cppcooper/events{/privacy}","received_events_url":"https://api.github.com/users/cppcooper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-11T15:41:52Z","updated_at":"2018-12-21T01:47:17Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DFHack/scripts/pulls/81","html_url":"https://github.com/DFHack/scripts/pull/81","diff_url":"https://github.com/DFHack/scripts/pull/81.diff","patch_url":"https://github.com/DFHack/scripts/pull/81.patch"},"body":"The core script could probably be renamed to be more appropriate to its function. Suggestions welcome.\r\n\r\nThe script was created to optimize dwarves for fort-mode work. The core function takes dwarves and allocates a \"dorf_job\" to each dwarf. This decision takes into account current counts for each dorf_job, in relation to how many *should* be allocated based on the working population size.\r\n**dorf_job:**\r\n- a custom profession name\r\n- a specific set of required labors\r\n- a specific set of probabilistic labors\r\n  - these labors are applied based on individual probabilities which also act as enforced ratios\r\n- a specific set of dorf_types\r\n\r\n**dorf_types:**\r\n- a probability of being applied to any dwarf during the `pimpem` process\r\n- some types include specific labors with a specific range of values for randomly assigning skill level for said labor\r\n- a specific set of attributes with a specific attribute level\r\n\r\n**attribute levels:**\r\n```lua\r\n--probability is used for generating all dwarf stats, some jobs include dorf_types which will upgrade particular stats\r\nattrib_levels = { -- prob,      avg,    std deviation\r\n    incompetent =   {p=0.01,    100,    20},\r\n    verybad =       {p=0.02,    250,    25},\r\n    bad =           {p=0.04,    450,    30},\r\n    average =       {p=0.21,    810,    60},\r\n    good =          {p=0.28,    1350,   75},\r\n    verygood =      {p=0.22,    1700,   42},\r\n    superb =        {p=0.12,    1900,   88},\r\n    amazing =       {p=0.06,    2900,   188},\r\n    incredible =    {p=0.03,    3800,   242},\r\n    unbelievable =  {p=0.01,    4829,   42}\r\n}\r\n```\r\n\r\nThe script relies on persistent data saved in with the user's world data to know how many dwarves are allocated to a job, and what jobs/professions are allocated to a single dwarf. This is important for maintaining ratios after resetting a subset of the fort's population.\r\n\r\nThe main script `pimp-it.lua` relies on a secondary file `dorf_tables.lua` in order to know what it is doing with the dwarves. The user can use the script `pimp-it.lua` to manually apply additional skills to one or many dwarves; in order to know exactly what a dorf_job or profession or dorf_type does the user would ultimately need to look at `dorf_tables.lua`.\r\n\r\nThe below information is help information shown via command-line, it mainly deals with how to use the script. It does not explain what types, professions, or jobs do. Suggestions for improving usability are welcome here.\r\n\r\n```lua\r\n[====[\r\nusage: pimp-it [-help|-select]\r\n               -select <sel-opt> -<command> <args>\r\n============\r\npimp-it script\r\n~~~~~~~~~~~~\r\nTo use this script, you need to select a subset of your dwarves. Then run commands on those dwarves.\r\nExamples:\r\n  [DFHack]# pimp-it -select [ jobs Trader Miner Leader Warden ] -applytype adaptable\r\n  [DFHack]# pimp-it -select all -clear -pimpem\r\n  [DFHack]# pimp-it -select pimped -reroll\r\n  [DFHack]# pimp-it -select named -reroll inclusive -applyprofession RECRUIT\r\n~~~~~~~~~~~~\r\n select options:\r\n   (protected is the only option which will select PROTECTED dwarves)\r\n    all         - selects all dwarves.\r\n    highlighted - selects only the in-game highlighted dwarf (from any screen).\r\n    named       - selects dwarves with user-given names.\r\n    unnamed     - selects dwarves without user-given names.\r\n    employed    - selects dwarves with custom professions. Excludes pimped dwarves.\r\n    pimped      - selects dwarves based on session data. Dwarves who have been pimped, should be listed in this data.\r\n    unpimped    - selects any dwarves that don't appear in session data.\r\n    protected   - selects any dwarves which use protection signals in their name or profession. (ie. {'.', 'c', 'j', 'p'})\r\n    unprotected - selects any dwarves which don't use protection signals in their name or profession.\r\n    drunks      - selects any dwarves which are currently zeroed, or were originally drunks as their profession.\r\n    jobs        - selects any dwarves with the listed job types. This will only match with custom professions, or pimped dwarves (for pimped dorfs see: dorf_jobs in dorf_tables.lua).\r\n                - usage `-select [ jobs job1 job2 etc. ]` eg. `-select [ jobs Miner Trader ]`\r\n~~~~~~~~~~~~\r\nCommands will run on the selected dwarves\r\n available commands:\r\n    clear              - zeroes selected dwarves. No attributes, no labours. Assigns 'DRUNK' profession.\r\n    reroll <inclusive> - zeroes selected dwarves, then rerolls that dwarf based on its job. Ignores dwarves with unlisted jobs.\r\n                       - optional argument: inclusive. Only performs the reroll, will no zero the dwarf first. Benefit: stats can only go higher, not lower.\r\n    pimpem             - performs a job search for unpimped dwarves. Each dwarf will be found a job according to the job_distribution table in dorf_tables.lua\r\n    applyjobs          - applies the listed jobs to the selected dwarves. list format: `[ job1 job2 jobn ]` brackets and jobs all separated by spaces.\r\n                       - see dorf_jobs table in dorf_tables.lua for available jobs.\")\r\n    applyprofessions   - applies the listed professions to the selected dwarves. list format: `[ prof1 prof2 profn ]` brackets and professions all separated by spaces.\r\n                       - see professions table in dorf_tables.lua for available professions.\r\n    applytypes         - applies the listed types to the selected dwarves. list format: `[ type1 type2 typen ]` brackets and types all separated by spaces.\r\n                       - see dorf_types table in dorf_tables.lua for available types.\r\n~~~~~~~~~~~~\r\n    Other Arguments:\r\n      help - displays this help information.\r\n      debug - enables debugging print lines\r\n\r\nNo dorfs were harmed in the building of this help screen.\r\n]====]\r\n```"},"comment":{"url":"https://api.github.com/repos/DFHack/scripts/issues/comments/449209852","html_url":"https://github.com/DFHack/scripts/pull/81#issuecomment-449209852","issue_url":"https://api.github.com/repos/DFHack/scripts/issues/81","id":449209852,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTIwOTg1Mg==","user":{"login":"lethosor","id":3719547,"node_id":"MDQ6VXNlcjM3MTk1NDc=","avatar_url":"https://avatars2.githubusercontent.com/u/3719547?v=4","gravatar_id":"","url":"https://api.github.com/users/lethosor","html_url":"https://github.com/lethosor","followers_url":"https://api.github.com/users/lethosor/followers","following_url":"https://api.github.com/users/lethosor/following{/other_user}","gists_url":"https://api.github.com/users/lethosor/gists{/gist_id}","starred_url":"https://api.github.com/users/lethosor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lethosor/subscriptions","organizations_url":"https://api.github.com/users/lethosor/orgs","repos_url":"https://api.github.com/users/lethosor/repos","events_url":"https://api.github.com/users/lethosor/events{/privacy}","received_events_url":"https://api.github.com/users/lethosor/received_events","type":"User","site_admin":false},"created_at":"2018-12-21T01:47:17Z","updated_at":"2018-12-21T01:47:17Z","author_association":"MEMBER","body":"Sorry for the long delay. This is rather large, so I'm not sure how much of a code review I can do. I can go more into detail if you want. As long as you're able to maintain this, that's good with me.\r\n\r\nRegarding naming, I would stick with `dwarf`, not `dorf`, everywhere. Also, the helper file should probably not go in the root scripts folder, because then it'll show up in `ls` and people might think it's a script. We don't have a great system for helper files yet, but try the check that https://github.com/DFHack/scripts/blob/master/item-descriptions.lua does near the top - it's at least more user-friendly."}}
{"actor":{"display_login":"lethosor"}}