Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 351 352 [353] 354 355 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1408078 times)

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5280 on: February 24, 2014, 02:13:06 pm »

Trying to implement continue type functionality in the Lua scripts, after searching a bit online I found that the newer Lua bases (5.2+) have a built in goto command. I was wondering what base the DFHack Lus is built on, and if I can use this goto function.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5281 on: February 24, 2014, 02:17:38 pm »

What exactly do you need goto for? I'm sure break would work just as well...

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5282 on: February 24, 2014, 02:19:40 pm »

Trying to implement continue type functionality in the Lua scripts, after searching a bit online I found that the newer Lua bases (5.2+) have a built in goto command. I was wondering what base the DFHack Lus is built on, and if I can use this goto function.
5.2. Not sure how you will do that...
There is a lua patch that adds continue, but than you would need to be sure that you will not break ANY script that anyone ever wrote for dfhack.
Also there are a few ways to work around the continue: inverting the if statement, or moving everything to a function and then using return instead of continue:
Code: [Select]
for _,unit in pairs(df.global.world.units.all) do
  if unit.flags1.dead then continue end
  --code
end
--same:
for _,unit in pairs(df.global.world.units.all) do
  if not unit.flags1.dead then
  --code
  end
end
--better:
function do_sth_with_unit(unit)
if unit.flags1.dead then
  return
end
--code
end
for _,unit in pairs(df.global.world.units.all) do
  do_sth_with_unit(unit)
end

« Last Edit: February 24, 2014, 02:23:53 pm by Warmist »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5283 on: February 24, 2014, 02:23:26 pm »

What exactly do you need goto for? I'm sure break would work just as well...

Well I have a loop that has several checks inside of it, once one of the checks is false I want to stop the checking and go on to the next value in the loop. The break statement would stop all further iterations of the loops and so wouldn't be useful for this.

If it is built on 5.2 then I can simply say goto forend and at the end of the for loop place ::forend::. This will allow me to skip all of the checks in between and continue on with the loop.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5284 on: February 24, 2014, 02:26:38 pm »

In that case, I think putting the checks into their own functions would be better.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5285 on: February 24, 2014, 02:31:24 pm »

In that case, I think putting the checks into their own functions would be better.

That was the other possibility, when I originally just had a couple checks it was fine the way it was, but now that I have so many and am adding more I began looking for a way to optimize it and limit the computations. I suppose I should be a good programmer and use separate functions, there may be some errors generated through use of goto statements that I am not aware of.
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: DFHack 0.34.11 r3
« Reply #5286 on: February 25, 2014, 10:46:24 am »

How do I change the tile of a building (for animation purposes)?

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #5287 on: February 25, 2014, 11:30:28 am »

How do I change the tile of a building (for animation purposes)?
I dont know, but I know that warmist and ag know it. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #5288 on: February 25, 2014, 11:30:28 am »

How do I change the tile of a building (for animation purposes)?
If it's a custom building, you can modify its raws in memory and they should take effect immediately, but it will affect all instances of the building.
If you only want to update a single instance of a building (or if it's a hardcoded one), you'll need to interpose building_[whatever]st::drawBuilding(building_drawbuffer*,int16_t), call the original code, then conditionally modify the contents of the draw buffer.
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.

ulspa

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5289 on: February 25, 2014, 12:24:18 pm »

Alright, so one problem down.  I had to install libc6:i386 to get a 32-bit libpthreads.so.0.  It seems to be okay with finding pthreads now.
nice

However, I still have the message that it can't find a working hash map.  The full output from cmake follows:

Spoiler (click to show/hide)

And actually, looking at the complete output from cmake (which ccmake doesn't print, oddly enough), it might be suggesting that it can't find a 32-bit version of zlib.  Except I have a 32-bit version of zlib installed (/lib/i386-linux-gnu/libz.so.1 from the zlib1g:i386 package).

Thoughts?
Actually, your current problem seems to related to another missing library or header. There is a file
Code: [Select]
  dfhack/depends/protobuf/testHashMap.cpp
I guess cmake aborts due to compilation error of this file. Compilation of this file doesn't need any libraries but some standard gnu library therefore you should install all necessary C++ libraries. You can try to compile the file with your 64-bit compiler. This shouldn't cause any problems. Then use
Code: [Select]
$ldd a.out 
to find the missing library. or you may search for libstdc++, glibc, gcc, g++, gcc-libs.
For zlib. You can specify the path with ccmake
Code: [Select]
$ cd dfhack/build
$ ccmake ..
[t] to toggle advanced mode
 ZLIB_INCLUDE_DIR                 /usr/include
 ZLIB_LIBRARY                     /usr//i386-linux-gnu/libz.so
obviously  you have to replace both paths with those that matches for your system.
« Last Edit: February 25, 2014, 12:27:27 pm by ulspa »
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: DFHack 0.34.11 r3
« Reply #5290 on: February 28, 2014, 05:55:38 am »

Is there a way of getting the total value of an item?

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #5291 on: February 28, 2014, 09:23:06 pm »

Is there a way of getting the total value of an item?
No - if you want to get the value, you'll need to calculate it manually by taking into consideration the item type, material, and quality. Fortunately, there's a vmethod available for getting the value of all item improvements in the eyes of a particular civilization, so you can add that afterwards.
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.

Bo-Rufus CMVII

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5292 on: February 28, 2014, 11:47:21 pm »

Anyone know how to create a gui.FramedScreen that is not centered in the parent window?

It looks like update_layout might do it, but I haven't been able to construct an argument that won't make it bomb off.

Thanks.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5293 on: March 01, 2014, 04:17:30 am »

Anyone know how to create a gui.FramedScreen that is not centered in the parent window?

It looks like update_layout might do it, but I haven't been able to construct an argument that won't make it bomb off.

Thanks.
try e.g:
Code: [Select]
my_screen_class= defclass(my_screen_class, gui.Screen)
my_screen_class.ATTRS={
    frame={t=0,l=0,w=10,h=10}
}

Aaarrgh!

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5294 on: March 01, 2014, 03:39:07 pm »

Which changes made with DFHack are persistent? It's a bit tiresome, enabling tweaks and setting up Workflow every time I start up DF.
Logged
Pages: 1 ... 351 352 [353] 354 355 ... 373