Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 65 66 [67] 68 69 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 889295 times)

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #990 on: April 10, 2018, 03:32:13 pm »

http://dfhack.readthedocs.io/en/stable/docs/Lua%20API.html might help. I'm not entirely sure what you're asking for, though, or what you've come up with already.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Ashtaroth

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #991 on: April 11, 2018, 03:36:13 pm »

Possibly a daft question, so I apologise in advance;

I'm trying to use Misery to balance out happiness a little bit, but it just causes endless job cancellation spam and makes the fortress grind to a halt; there are other negative emotions besides "miserable" that don't cause job cancellations and should have the same effect on overall stress, so I want to change it. But since misery, as far as I can see, is a .dll, not a script, I don't have the slightest clue how to go about changing it? What would be the easiest way of doing that?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #992 on: April 11, 2018, 06:31:53 pm »

It's compiled from https://github.com/DFHack/dfhack/blob/master/plugins/misery.cpp, so you'll have to change it and recompile it to have changes take effect.
If you're interested in compiling DFHack, see https://dfhack.readthedocs.io/en/latest/docs/Compile.html. Otherwise, you can submit an issue and someone might get to it eventually. (I'm mostly responsible for making it use miserable thoughts, since I rewrote it some time after it broke around 0.40, but I'm also fairly busy with other things at the moment.)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

YetAnotherLurker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #993 on: April 13, 2018, 03:58:56 pm »

So, tweak cage-butcher apparently does not check anything about the occupants of a cage before setting the slaughter flag. Thus, anything that winds up in a cage can be butchered, including sapient citizens.



I also tried flagging assorted captured invaders for butchering, but didn't manage to get one dragged to the Butcher's Shop due to immediate recaging upon release.
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #994 on: April 14, 2018, 03:36:51 am »

I am having a few problems with modtools/create-unit.  I am trying to use it in an old mod I am updating to the latest DF version, but I have reproduced the problems in a vanilla .05 save moved to both DF .07/DFHack .07-alpha1 and DF .09/DFhack .09-alpha1.   I could *not* reproduce some of them in a fresh embark on a fresh .09 install, but all I did there was create a 5 year pocket world and spawn dogs next to the starting wagon.  All of this is 64bit win 7, by the way.
Spoiler: details (click to show/hide)

I am also having an issue with item-trigger. 
Spoiler: details (click to show/hide)

While I am here, is there a way to change intelligent pets to normal citizens through dfhack, or change long-term residents to citizens so they can take labors?  I tried reaction-trigger and syndrome transformations but those turn the pet into some weird kind of long-term resident that I could assign scholarships/scribing/performing but not the military or labors (not even through dwarf therapist). I might be able to skirt around this using a couple of reaction-triggers, create-unit, an instakilling syndrome and corpseitem (because intelligent pets can do skill-less reactions only for some reason), but it would be nice to not use such a hacky and limited method, especially since it won't allow intelligent pets to keep their skills.
Logged
Fallout Equestria Redux - that's right, it's back

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #995 on: April 16, 2018, 03:32:37 am »

I am having a few problems with modtools/create-unit.  I am trying to use it in an old mod I am updating to the latest DF version, but I have reproduced the problems in a vanilla .05 save moved to both DF .07/DFHack .07-alpha1 and DF .09/DFhack .09-alpha1.   I could *not* reproduce some of them in a fresh embark on a fresh .09 install, but all I did there was create a 5 year pocket world and spawn dogs next to the starting wagon.  All of this is 64bit win 7, by the way.
Spoiler: details (click to show/hide)

Thank you for the testing, this give me some new theories about what causes new units to be hostile for a few frames upon spawn. I believe that it was caused by DF's enemy cache but it seems that any units keep their wild behavior as a predator, prey or curious beast until DF goes and refresh their AI. Is there a "wild animal" cache somewhere?

I need to replace some hacks in create-unit. Meanwhile, if you open the script and remove the three anon_x lines at line 344, create-unit may work again but with strange effects.
« Last Edit: April 16, 2018, 03:34:41 am by Boltgun »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #996 on: April 16, 2018, 09:07:39 am »

Numbering for units without a name given is broken.  Most of the time, the number that the creature displays is a very large, sometimes negative number. Further spawned units of that race increment the number as expected.  Occasionally, the number starts at 1 as expected. Given that one time I saw an opossum 5(the first of its kind spawned) immediately after I just spawned a coati 5 (the 5th of its kind), I would guess that the variable for unit numbering isn't being initialized and the code branch that deals with numbering/naming creatures who are the first of their kind isn't executing or is missing the code to assign it to 1. Either that or there is a bad pointer address/pointer math somewhere (don't know whether the code for it is in C or Lua).
What mode are you in (fortress, arena, adventure)? The initialization behavior varies between them. I thought I had fixed it in one, but it might have broken in another.

Quote
The -domesticate flag throws an error, and units with it but not -setUnitToFort are friendly, not fort pets (the latter may be intended behavior, I'm not sure).  Here is the stack trace: 
...FE temp\DFFE 14.04/hack/scripts/modtools/create-unit.lua:344: Cannot write field unit.T_enemy.anon_4: not found.
stack traceback:
   [C]: in metamethod '__newindex'
   ...FE temp\DFFE 14.04/hack/scripts/modtools/create-unit.lua:344: in global 'domesticate'
   ...FE temp\DFFE 14.04/hack/scripts/modtools/create-unit.lua:537: in local 'script_code'
   ...y\Desktop\games\DFFE temp\DFFE 14.04\hack\lua\dfhack.lua:562: in function 'dfhack.run_script_with_env'
   (...tail calls...)
To script authors: this is why you NEVER use "anon" variables. Submit a PR to give them names!
Boltgun: either they were given names or some other unnamed fields were given names. I'll try to investigate what the right names should be.
Edit: fixed: https://github.com/DFHack/scripts/commit/96b118b2e7fe8d91b59e0cc1c7951bf27a5e6698
« Last Edit: April 16, 2018, 09:16:32 am by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #997 on: April 16, 2018, 09:29:44 am »

I am having a few problems with modtools/create-unit.  I am trying to use it in an old mod I am updating to the latest DF version, but I have reproduced the problems in a vanilla .05 save moved to both DF .07/DFHack .07-alpha1 and DF .09/DFhack .09-alpha1.   I could *not* reproduce some of them in a fresh embark on a fresh .09 install, but all I did there was create a 5 year pocket world and spawn dogs next to the starting wagon.  All of this is 64bit win 7, by the way.
Spoiler: details (click to show/hide)

Thank you for the testing, this give me some new theories about what causes new units to be hostile for a few frames upon spawn. I believe that it was caused by DF's enemy cache but it seems that any units keep their wild behavior as a predator, prey or curious beast until DF goes and refresh their AI. Is there a "wild animal" cache somewhere?

I need to replace some hacks in create-unit. Meanwhile, if you open the script and remove the three anon_x lines at line 344, create-unit may work again but with strange effects.


As a quick test, I removed those 3 lines and tried spawning a few units in my modded .09/.09-alpha1 game that would fight previously on spawn. The short of it is that while some things are still broken, unless weird problems crop up later then I have a workable command I can use now to spawn pets from a workshop (thanks!).
Spoiler: results of quick test (click to show/hide)
What mode are you in (fortress, arena, adventure)? The initialization behavior varies between them. I thought I had fixed it in one, but it might have broken in another.
All the create-unit stuff I have been doing is in fortress mode.
Logged
Fallout Equestria Redux - that's right, it's back

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #998 on: April 16, 2018, 11:42:29 am »

Can you try replacing the 3 lines with the fixed ones I linked instead of deleting them? I doubt they have much to do with your issue, but I want to be safe.

"spawnunit CAT MALE" (which uses modtools/create-unit) produced a cat called "Cat 1" in fortress mode for me, and I'm using a tool that initializes all memory to 0xAA, so if the ID weren't initialized, it should have been a large negative number. Can you provide a specific command that produces a badly-numbered unit?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #999 on: April 17, 2018, 03:29:10 am »

To script authors: this is why you NEVER use "anon" variables. Submit a PR to give them names!
Boltgun: either they were given names or some other unnamed fields were given names. I'll try to investigate what the right names should be.
Edit: fixed: https://github.com/DFHack/scripts/commit/96b118b2e7fe8d91b59e0cc1c7951bf27a5e6698

For info, create-unit broke creatures with special loyalty such as underworld or residents and long trials and errors revealed that those three anons needed to be set. Perhaps we can drop the two unks if those creatures do not turn weird, if not... we found a clown AI flag.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #1000 on: April 17, 2018, 09:07:44 am »

The point is that if you determine that something needs "anon" fields, you need to give them names. Even "unk" names, like two of them have now, are better than no names ("anon" names are automatically generated).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #1001 on: April 17, 2018, 11:35:56 am »

Can you try replacing the 3 lines with the fixed ones I linked instead of deleting them? I doubt they have much to do with your issue, but I want to be safe.

"spawnunit CAT MALE" (which uses modtools/create-unit) produced a cat called "Cat 1" in fortress mode for me, and I'm using a tool that initializes all memory to 0xAA, so if the ID weren't initialized, it should have been a large negative number. Can you provide a specific command that produces a badly-numbered unit?
Ok, getting out the fresh vanilla 5 year pocket embark and testing this a bit (.09+dfhack .09, 64 bit win7).

For reference, what I get without deleting or replacing any code
Spoiler: control run (click to show/hide)
After typing die in dfhack console, I then replaced the old 3 lines in the script with the ones from your link and loaded up the same fresh embark.
Spoiler: results (click to show/hide)

EDIT: I wasn't getting units attacking each other either before or after except for the wild dog, so I am going to transfer that .05 fortress over and spawn some dogs in the packed training room. 

EDIT 2: Ok, getting coords with teleport and spawning dogs in the middle of a packed training room of a large fortress.  Still have new code.
Spoiler (click to show/hide)
« Last Edit: April 17, 2018, 12:02:27 pm by thefriendlyhacker »
Logged
Fallout Equestria Redux - that's right, it's back

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #1002 on: April 19, 2018, 11:00:01 am »

What's the deal with all the "exterminate" command's pronouns? Options include "him", "her", and "it" / "that". The script will print a message if you choose wrongly.
Seems like unnecessary confusion for something that isn't at all relevant to the function. Why not just "exterminate target" or "exterminate selected"?
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #1003 on: April 19, 2018, 11:06:16 am »

Agreed. I'll add those and get rid of the message.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.09-r1
« Reply #1004 on: April 19, 2018, 11:35:55 am »

What's the deal with all the "exterminate" command's pronouns? Options include "him", "her", and "it" / "that". The script will print a message if you choose wrongly.
Seems like unnecessary confusion for something that isn't at all relevant to the function. Why not just "exterminate target" or "exterminate selected"?
The only reason I can see for the rejection is if it's the wrong target (e.g. two units at the same tile). However, there's only a 50% chance of it catching an error at the cost of annoyance when you just want to get rid of a bugger without examine it's gender first.
Logged
Pages: 1 ... 65 66 [67] 68 69 ... 244