31
Utilities and 3rd Party Applications / Re: What do I need to write this script:
« on: November 05, 2017, 07:28:08 am »
@Warmist: When I was searching the lua scripts in DF and DFHack directory, I found that utils.lua has a binary search function generalised to work with any list.
@Patrick:
I was puzzled why I can't find this script in DFHack or in the game already and I did not figure out how and when to run it. Thanks for telling me. It's only now that I realise that you did all this work for your private needs of getting an almost perfect duplicate of the text displayed under Thoughts and preferences. Hats off. You practically did 90% of the work I was afraid I'd had to do myself before I wrap it up with a routine gathering this periodically.
I am sorry if my snarky remark about the function naming. I thought I am looking at a publicly available DFHack script which is supposed to be properly commented and clear for all the DFHack devs. I didn't know that you did all this just to do your own DFHacking stuff and graciously share this.
Yet I have to say I truly struggled to understand all that code. A couple of comments of what this all or each of its functions are supposed to do would have saved me several hours of clueless staring at it and sort of reverse engineering it. I only learn programming as a pastime hobby and I never knew such algorithm as binary search. And I didn't know how hard—if not impossible—it is to implement it 100% bug-free.
Anyway, a thousand thanks for this script, it already gathers most of the information I am looking for. Back to the topic now: I have tried it on some of my dwarfves. Besides some of the information from thoughts missing (which I'm going to try to add to the script) I found that for some dwarves it writes the wrong feeling for inebriation. DF says "she didn't feel anything due to inebriation" thoughts.lua says "... felt euphoric due to inebriation" Although I'm currently not interested in keeping track of my dwarfs recent experiences, I wonder what can be causing this difference.
@Patrick:
I was puzzled why I can't find this script in DFHack or in the game already and I did not figure out how and when to run it. Thanks for telling me. It's only now that I realise that you did all this work for your private needs of getting an almost perfect duplicate of the text displayed under Thoughts and preferences. Hats off. You practically did 90% of the work I was afraid I'd had to do myself before I wrap it up with a routine gathering this periodically.
I am sorry if my snarky remark about the function naming. I thought I am looking at a publicly available DFHack script which is supposed to be properly commented and clear for all the DFHack devs. I didn't know that you did all this just to do your own DFHacking stuff and graciously share this.
Yet I have to say I truly struggled to understand all that code. A couple of comments of what this all or each of its functions are supposed to do would have saved me several hours of clueless staring at it and sort of reverse engineering it. I only learn programming as a pastime hobby and I never knew such algorithm as binary search. And I didn't know how hard—if not impossible—it is to implement it 100% bug-free.
Anyway, a thousand thanks for this script, it already gathers most of the information I am looking for. Back to the topic now: I have tried it on some of my dwarfves. Besides some of the information from thoughts missing (which I'm going to try to add to the script) I found that for some dwarves it writes the wrong feeling for inebriation. DF says "she didn't feel anything due to inebriation" thoughts.lua says "... felt euphoric due to inebriation" Although I'm currently not interested in keeping track of my dwarfs recent experiences, I wonder what can be causing this difference.
