Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 134 135 [136] 137 138 ... 244

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

Kat

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2025 on: January 24, 2020, 09:03:13 pm »

Hi people :) great seeing DFHack still being updated.

Anyway I have something I am struggling with in my game, and I am wondering if any of you have ever come across this, and what solution if any, you found.

So, I have temples in my fort. I want to assign at least one performer to each of the temples.

I can find citizens with dancing skills etc via Dwarf Therapist. But... I can't tell which gods those citizens worship, except by viewing their unit info. So I can't easily tell which citizens to assign to which temples.

is it possible, or would it be possible in future, to display or sort the available performers, so that you can find ones that worship the god of the temple ?

Here's a picture of what I mean:
https://i.imgur.com/F6K2uNt.png
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2026 on: January 25, 2020, 05:10:43 am »

@Kat: It's possible to write a DFHack script that does what you want, but you'd likely have to (learn to, if needed) write it yourself, given that you'd need a fair bit of luck to find someone else who shares your particular needs and who's interested in writing it.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2027 on: January 25, 2020, 03:39:09 pm »

Couple questions;

1. Does the defclass() support overloading operators? I know with "normal" metatables you can put functions for things like __add, __eq, etc... Just making sure that I can still do that.
Looks like it:
Code: [Select]
[lua]# x = defclass()
[lua]# function x:__add() print('adding') end
[lua]# print(x() + 2)
adding
nil

Quote
2. I'm trying to decide how to organize my scripts and functions collection and am wondering what some of my options might be. Currently I am adding expanding on some of the current df-structures objects by using classes. As an example, I have a UNIT class which adds functions like UNIT:makeProjectile(vx,vy,vz) which turns the unit into a projectile. Now for the question, my current thoughts for organization are 1) Putting the defclass and all the functions associated with that class in their own file, or 2) put the defclass for each of the different classes in a single file with descriptions of each class, and then put the functions for the class in a seperate file, 3) group classes and functions into categories and create files for each category. Is there a "best" way to handle this in terms of performance (I'm guessing #3)? If they are all roughly equal I was thinking of using #2 because it would be the easiest to read and create help files for. Is there another way that I'm not thinking of?
I wouldn't split up the defclass and function definitions - defclass is really just one line. Personally, I would go with #1, unless you have a lot of classes, and then #3 might be a bit faster. One disadvantage of #2 is that if you forget to include the file that defines all the functions, you'll just end up with a class that does nothing.

Quote
3. I noticed in some of the scripts in the repository there is the line
Code: [Select]
if not dfhack_flags.module then
    main(...)
end
Just wanted to make sure I understand this, if a script gets called from the command line or with run_script/run_command it will call main, if it gets access with reqscript() it will not call main, correct?
Yup! It's the same as the "moduleMode" check you might see in some scripts, but that's deprecated.
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.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2028 on: January 28, 2020, 04:08:53 am »

just checking dfhack r3 and oh finding out units just have caste flags in their enemy section is a deep life savor. this opens up for like getting creatures and reanimated beings that don't talk to uhh talk.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

darkhog

  • Bay Watcher
  • JAGIELSKI is PERFECTION
    • View Profile
    • Jagielski Gaming YT channel
Re: DFHack 0.44.12-r3
« Reply #2029 on: January 29, 2020, 12:12:03 pm »

Any timetable on how soon dfhack can be updated for the new version?
Logged
I am a dwarf and I'm digging a hole. Diggy Diggy hole, diggy diggy hole.

If I say something funny, don't ask if you can sig it. Just do it (though credit me).

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2030 on: January 29, 2020, 12:52:09 pm »

We can't make any guarantees - we don't know exactly how much has changed that concerns us yet. It will probably be at least a week before we have something partially usable, but even then it will likely be unstable for a while longer.

If anyone's interested, we do have an IRC channel where you can see more up-to-date activity (see the first post for details - just please don't bug us there with questions about when DFHack will be updated).
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.

jecowa

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2031 on: January 29, 2020, 11:17:12 pm »

Thanks for keeping us apprised.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2032 on: January 30, 2020, 03:53:54 am »

I wouldn't mind if a post was made in this thread when the first cut of the (re)mapping has been made so "amateur" mapping activities can be started.
Logged

HungThir

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2033 on: January 30, 2020, 05:32:55 am »

is it possible to build dfhack usefully in an msys2 shell?  i think this is an abi compatibility question, i don't really understand how the mingw/msys2 posix/win64 translation layers work or to what extent stuff built with the mingw toolchain is able to interact with native win64 apps.  i'm a linux/posix programmer, and would like to be able to contribute, but i don't run linux on my gaming pc, i don't run dwarf fortress on the work laptop, and i don't know thing one about the windows toolchains, really

i could potentially figure out (and document) how to build it under msys2, if i knew before sinking time into it that it would actually work. but my current understanding is that it wouldn't work. am i right?
Logged

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2034 on: January 30, 2020, 05:54:00 am »

The issue is that MSVC and GCC C++ ABIs are incompatible (there is no standard C++ ABI). It is not about posix/win32 translation. You are stuck with whatever compiler Toady uses.
Logged

HungThir

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2035 on: January 30, 2020, 05:57:42 am »

The issue is that MSVC and GCC C++ ABIs are incompatible (there is no standard C++ ABI). It is not about posix/win32 translation. You are stuck with whatever compiler Toady uses.

gotcha, cheers
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.44.12-r3
« Reply #2036 on: January 30, 2020, 07:03:29 am »

The issue is that MSVC and GCC C++ ABIs are incompatible (there is no standard C++ ABI). It is not about posix/win32 translation. You are stuck with whatever compiler Toady uses.
My understanding was that it was mainly a runtime library issue, specifically the memory layouts of std::string/std::vector and the fact that DF's heap is managed by the VC++ 2015 runtime library (which MingW does not use).
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2037 on: January 30, 2020, 08:54:40 am »

By C++ ABI, I meant both compiler and standard library ABIs. On the compiler side you'll get issues with name mangling, class layout, call conventions, ...
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2038 on: January 31, 2020, 10:56:51 am »

Is there a way to check if a dfhack structure has a specific member? What I mean is that if I have a normal table I can do "if rawget(table,key) then..." or "if table[key] then..." but trying the first one results in the error that a table is expected but got userdata, and the later gives the error that the field is not found.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r3
« Reply #2039 on: January 31, 2020, 11:56:25 am »

The method I've used to detect if a field is present (to determine if the DF version is the current one or an older one) is to iterate over the fields with "pairs". If it's present I'll eventually get a match.

Code: [Select]
  --  Backwards compatibility detection
  -- 
  local river_type_updated = false
  if true then  --  To get the temporary variable's context expire
    local river = df.world_river:new()
    for i, k in pairs (river) do
      if i == "flow" then
        river_type_updated = true
        break
      end
    end
    river:delete ()
  end
Logged
Pages: 1 ... 134 135 [136] 137 138 ... 244