Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 20 21 [22] 23 24 ... 243

Author Topic: DFHack 50.13-r1  (Read 810096 times)

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #315 on: September 21, 2017, 07:55:04 am »

Thanks ab9rf.
Given that the github structure has one structure for DFHack and another for DF structures, I never considered that the off site organization might somehow pull the apparent separate DF structures entity into the DFHack one, although I was aware that there are a lot of things I could never find in the online DFHack file structure.
Given your comments, I managed to get git to tell me there's a "git submodule status" command, and that command shows there is indeed a "library/xml" submodule, which looks to be very similar to the df structures one (i.e. it should be the one). This means it should be reasonably easy to have a "complete" dfhack structure whose purpose is to support df structures work as you said.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #316 on: September 22, 2017, 03:38:06 pm »

Is it possible to print in different colors in the DFHack screen? I currently have an output like;
PASSED: unit/action-change
PASSED: unit/attack
FAILED: unit/body-change
NOCHECK: unit/create
PASSED: unit/move

and it would be awesome if I could color code it
PASSED: unit/action-change
PASSED: unit/attack
FAILED: unit/body-change
NOCHECK: unit/create
PASSED: unit/move
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #317 on: September 22, 2017, 05:01:55 pm »

Yep. Here's what I use:

Code: [Select]
    function printlnc(text, color)
        dfhack.color(color)
            dfhack.println(text)
        dfhack.color(COLOR_RESET)
    end

Example screenshot from relations-indicator.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #318 on: September 22, 2017, 05:12:38 pm »

You can use the 15 colors supported by DF for display in both the DFHack console window and on windows you create on top of/integrated into DF. The syntax differs slightly depending on whether you use C(++) or Lua (and I assume things like Ruby supports it as well, although I've never looked at that) but the essential functionality is the same.
You can also change the background color to any of the 15 supported colors, although that requires slightly more work, and there's a Bold parameter I've never used as well.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #319 on: September 24, 2017, 02:27:12 am »

This script kills DF 64 bit but does nothing on DF 32 bit on Windows 10.1:
Code: [Select]
function bellyup ()
  local geo_biome = df.world_geo_biome:new ()
  geo_biome.layers:delete()
end

bellyup ()
As far as I understand, :delete() should not do anything when there is no applicable delete operation ("Destroys the object with the C++ delete operator. If destructor is not available, returns false." from the DFHack Lua API documentation). Is that a bug in the DFHack 64 bit Windows implementation?

Ignore the fact that the code isn't doing anything useful: I've already realized that...
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #320 on: September 24, 2017, 02:30:53 am »

This script kills DF 64 bit but does nothing on DF 32 bit on Windows 10.1:
Code: [Select]
function bellyup ()
  local geo_biome = df.world_geo_biome:new ()
  geo_biome.layers:delete()
end

bellyup ()
As far as I understand, :delete() should not do anything when there is no applicable delete operation ("Destroys the object with the C++ delete operator. If destructor is not available, returns false." from the DFHack Lua API documentation). Is that a bug in the DFHack 64 bit Windows implementation?

Ignore the fact that the code isn't doing anything useful: I've already realized that...
Usually crashes like this is when stuff is misaligned (IIRC) i.e. when the underlying structures are not correct.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #321 on: September 24, 2017, 03:39:29 am »

I doubt it's a structure mismatch issue, as I changed the script to:
Code: [Select]
function bellyup ()
  local unit = df.unit:new()
  unit.social_activities:delete()
 
  --local geo_biome = df.world_geo_biome:new ()
  --geo_biome.layers:delete()
end

bellyup ()
after reading Warmist's comment, and the behavior is the same, despite a completely different structure is attacked. The common denominator (that I can identify) is that both structures attempted to be deleted are <stl-vector> ones, and I don't think it matters if they contain data or not.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #322 on: September 24, 2017, 04:27:25 am »

I doubt it's a structure mismatch issue, as I changed the script to:
Code: [Select]
function bellyup ()
  local unit = df.unit:new()
  unit.social_activities:delete()
 
  --local geo_biome = df.world_geo_biome:new ()
  --geo_biome.layers:delete()
end

bellyup ()
after reading Warmist's comment, and the behavior is the same, despite a completely different structure is attacked. The common denominator (that I can identify) is that both structures attempted to be deleted are <stl-vector> ones, and I don't think it matters if they contain data or not.
Oh you are doing something very strange... See the std::vector is not a pointer, so you are deleting a part of struct which is very invalid in all version, and you should not do it

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #323 on: September 24, 2017, 07:15:31 am »

Yes, as I said initially, I've realized the pointer isn't actually a naked pointer but embedded in an object, so I'm in no way claiming it's sensible to do it. The thing is that the DFHack Lua API documentation seems to indicate the operation should do nothing when not valid (as well as return 'false' which I haven't checked to see if the 32 bit version does), rather than just run off the cliff.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #324 on: September 24, 2017, 08:37:56 am »

Yes, as I said initially, I've realized the pointer isn't actually a naked pointer but embedded in an object, so I'm in no way claiming it's sensible to do it. The thing is that the DFHack Lua API documentation seems to indicate the operation should do nothing when not valid (as well as return 'false' which I haven't checked to see if the 32 bit version does), rather than just run off the cliff.

Yup you are right, something is wrong :). I've posted an issue here

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #325 on: September 24, 2017, 09:44:57 am »

Thanks Warmist.
That would have been my next step, but I generally want to be reasonably sure it is a bug before I post bug reports (which does not mean I screw up and post bug reports incorrectly anyway), so asking here first was my first step.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #326 on: September 24, 2017, 11:04:00 am »

There's a difference between a destructor being "not available" and "not valid". Only the former is easy to detect. https://github.com/DFHack/dfhack/issues/1170#issuecomment-331719462
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.

ab9rf

  • Bay Watcher
    • View Profile
    • ab9rf@github
Re: DFHack 0.43.05-r2
« Reply #327 on: September 26, 2017, 12:49:12 am »

Thanks ab9rf.
Given that the github structure has one structure for DFHack and another for DF structures, I never considered that the off site organization might somehow pull the apparent separate DF structures entity into the DFHack one, although I was aware that there are a lot of things I could never find in the online DFHack file structure.
Given your comments, I managed to get git to tell me there's a "git submodule status" command, and that command shows there is indeed a "library/xml" submodule, which looks to be very similar to the df structures one (i.e. it should be the one). This means it should be reasonably easy to have a "complete" dfhack structure whose purpose is to support df structures work as you said.
library/xml is df-structures. It's a subrepo, and if you go into it's a full repository that you can manipulate in the same manner as any other repository. If you change the commit to which that repo points, the parent repository will track that as a change as to which commit the parent repository will track. This is, in fact, what you basically have to do if you make a change to dfhack code that relies on a newer df-structures release.

There are a lot of gotchas, caveats, and non-obvious best-practice advice for dealing with subrepos. DFHack has five or six subrepos now (and some of them have subrepos of their own, as I recall), so if you're going to be a serious DFHack developer, you kinda have to have at least some understanding of this.
Logged

Burneddi

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #328 on: September 26, 2017, 10:42:52 am »

I'm having some adventure mode woes with TWBT. The site building screen works incredibly poorly, with tiles not properly refreshing when you pan the view around. Advfort (gui/advfort) also doesn't work, the view goes blank when using it so you can't actually see what's going on. Am I using an outdated version or something?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r2
« Reply #329 on: September 26, 2017, 11:42:26 am »

How would we know if you're using an outdated version?

What versions of what are you using, and on what platform? Note that I don't know any answers to adventure mode questions, but those who do most likely need the basic info.
- Platform? (Windows (version, 32/64 bit), Linux (version), Mac)
- DF/Pack version? LNP? If you've compiled it yourself, from which parts? Which DFHack version?
- Which tile set are you using?
- Does it work if you disable TwbT?
- Any other potentially useful pieces of information you can come up with.
Logged
Pages: 1 ... 20 21 [22] 23 24 ... 243