Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 87 88 [89] 90 91 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1458176 times)

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1320 on: April 20, 2012, 12:06:13 pm »

Well warping folks is easy, getting them to not horribly clutter the area with knee high invisible blocks is hard. good thing old dfusion warp isn't that hard to port over.

Code: [Select]
function tools.warp(unit)
print("Self or at position? (s or anything else):");
local r=getline()
local unit
if r=="s" or r=="S" then
unit=df.global.world.units.other[0][0]
else
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
end
local sx,sy,sz
sx=unit.pos.x
sy=unit.pos.y
sz=unit.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
print("Jump where (coordinates in form 'dx dy dz' or 'c' for cursor):")
r=getline()
local tx,ty,tz
if r=="c" then
tx,ty,tz=getxyz()
else
lp=string.gmatch(r,"%-?%d+")
--local d
--d=lp()
tx=sx+tonumber(lp())
ty=sy+tonumber(lp())
tz=sz+tonumber(lp())
end
print("Warp to coords:"..tx.." "..ty.." "..tz)
unit.pos.x=tx
unit.pos.y=ty
unit.pos.z=tz
end
tools.menu:add("warp",tools.warp)

edit: here's the codes for a warp, this works both in adventure mode and fort mode, you need to have the pointer on top of the unit you want... and also to make sure the unit not sharing the same tile as someone else.

thanks!
where do I plug this code exactly?
dfusion folder, best to stick this in tools/init.lua file.
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

vorpal+5

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1321 on: April 20, 2012, 01:51:53 pm »

I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*
Logged

robertheinrich

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1322 on: April 20, 2012, 03:25:21 pm »

I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*

a) the teleport code posted by rumrusher can result in having spots on the map where you can't build stuff on, but he already mentioned that... df maps store some occupancy thing which is not properly cleared by just changing unit positions.

b) the lua stuff needs a bit more documentation as a whole. For the time being look at the lua readme (which is part of the download) and check out http://dwarffortresswiki.org/index.php/Utility:DFusion and call 'dfuse' before you start a 'lua' session and come back here to complain about stuff which won't work so we can figure it out.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1323 on: April 20, 2012, 04:20:14 pm »

I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*
Wait are you using dfusion to run it or some other process? you also need to boot out of dfusion mode while playing dwarf fortress. dfusion follow and "follow" are two different follows.

the dfhack follow is just a camera zoom on to a unit useful in fort mode.
dfusion's follow is for making unit's follow the adventurer.  their not the same. and the tools aren't named advance more so it's a short for ADVenture for their highly useful for adventure mode.
« Last Edit: April 20, 2012, 04:28:28 pm by Rumrusher »
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

vorpal+5

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1324 on: April 21, 2012, 02:19:51 am »

Ok, I made it work. But three things.

[1]
I had to alter the code because for reason unknown no unit was retrieved when using
getCreatureAtPos(getxyz)

and yes, the cursor was on a dwarf, and he was the unique entity of the tile.

So I altered it with
unit=getSelectedUnit()
using V to select a dwarf, it worked.

Do you know why there was a problem?

[2]
Second, using the command is quite convoluted. For people wanting to use it and want a step by step, you have to activate DFusion by typing DFusion in the DFHack console. Then you are presented with a menu, the new command is in tools, so your type (2). Then you have a list of available commands, warp is (6) for me, so I type (6). And then I can operate the command... Once the command activates, I'm back to the first menu...

Any possibility to have a less convoluted way of using the command, ideally like just typing 'warp' in DFHack, or at worse when DFusion is active?

In any case, big thanks to you, this will change my life... Now if there is a stuck dorf, I can unstuck him.

[3]
About the glitch, a data not cleared on occupancy, is the glitch on the source tile or the target tile? If on the target tile, I can always use the same destination tile, knowing the tile is now 'screwed', this will be my 'dump tile'... If on the source, this can be more problematic indeed.
Logged

Antalia

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1325 on: April 21, 2012, 07:15:34 am »

Quote
There's no real documentation and the only example so far is dfhack-run.cpp - your best bet is to look at that and at the mentioned Remote* files. A bit can be understood by looking at the rename plugin, which extends the core protocol with some of its functions - look for "plugin_rpcconnect" in plugins/rename.cpp.
This looks great for C-based clients. But I don't think DFHack's RPC functions, as implemented, can be compatible with Java clients. This is because Java RPC clients rely on a service library compatible with the server. DFHack's RPC service appears to be homebrewed--I did not find any Java service library compatible with the style of function stubs it uses. (The stream object getting passed around in DFHack, seems to be the most serious hurdle here. Passing back return values as function arguments may be a problem, too.) Writing this Java service library from scratch would not be trivial.

This is disappointing, because I was quite hopeful that my Java application could make use of some functions in RemoteTools, especially SetUnitLabors().

Is there any intention of DFHack supporting Java client RPC in the future? I didn't see anything like "// Let's only support C/C++/C#!" when studying the code, which leaves me vaguely hopeful.

I know I can theoretically just write my own C++ middle-man to do RPC with DFHack, using protobufs service (or whatever) to talk to my Java app. (That would be a less intense headache than the other option, for me.) This could manage passing information between DFHack and my Java client. But in reality I doubt I would ever go this far. (This feature is not critical enough to the main function of my cross-platform application, to justify repeating any past "fun" I've had cross-platforming with C++.)
Logged
Author of Saga of Nutscaves, a tale of unsafe working conditions, plague, and worse

Creator of Dwarf Organizer, a Java application to help assign labor in your fortress

the_game_hunt

  • Bay Watcher
  • [NO_MERCY]
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1326 on: April 21, 2012, 09:42:04 am »

Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.
Logged
Quote
The spinning (silk shoe) strikes the Baron in the left upper arm, bruising the skin!
The Baron has been shot and killed.

WARNING! I'm not responsible for damaging/destroying your post!

robertheinrich

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1327 on: April 21, 2012, 10:10:54 pm »

Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.

From the viewpoint of regrass, a dirt road is simply a spot where there is soil but no grass, so it will regrow grass there. When you tell your dorfs ingame to build a dirt road all they will do is remove the grass there and after a while that tile will get re-claimed by the game and grow grass maybe even a tree/shrub... But if you have a savegame where you embarked on a dirt road and it's regrassed and no trees/shrubs grow on it after observing it for a couple of years, please upload it... it might be possible that dirt roads you embarked on are some weird special case.
Logged

dree12

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1328 on: April 22, 2012, 09:03:18 am »

Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.

From the viewpoint of regrass, a dirt road is simply a spot where there is soil but no grass, so it will regrow grass there. When you tell your dorfs ingame to build a dirt road all they will do is remove the grass there and after a while that tile will get re-claimed by the game and grow grass maybe even a tree/shrub... But if you have a savegame where you embarked on a dirt road and it's regrassed and no trees/shrubs grow on it after observing it for a couple of years, please upload it... it might be possible that dirt roads you embarked on are some weird special case.
Human dirt roads are never reclaimed by the game, so they must have a flag or something. I've found that this occurs very frequently and a save game probably isn't useful.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1329 on: April 22, 2012, 03:46:25 pm »

Ok, I made it work. But three things.

[1]
I had to alter the code because for reason unknown no unit was retrieved when using
getCreatureAtPos(getxyz)

and yes, the cursor was on a dwarf, and he was the unique entity of the tile.

So I altered it with
unit=getSelectedUnit()
using V to select a dwarf, it worked.

Do you know why there was a problem?

[2]
Second, using the command is quite convoluted. For people wanting to use it and want a step by step, you have to activate DFusion by typing DFusion in the DFHack console. Then you are presented with a menu, the new command is in tools, so your type (2). Then you have a list of available commands, warp is (6) for me, so I type (6). And then I can operate the command... Once the command activates, I'm back to the first menu...

Any possibility to have a less convoluted way of using the command, ideally like just typing 'warp' in DFHack, or at worse when DFusion is active?

In any case, big thanks to you, this will change my life... Now if there is a stuck dorf, I can unstuck him.

[3]
About the glitch, a data not cleared on occupancy, is the glitch on the source tile or the target tile? If on the target tile, I can always use the same destination tile, knowing the tile is now 'screwed', this will be my 'dump tile'... If on the source, this can be more problematic indeed.
okay [1] warp was ported over from my adventure_tools folder though originally was meant to be universal for getSelectedUnit doesn't work well in adventure mode due to lack of V button.
so it's news to me that the other way to select folks doesn't work. testing okay it works in fort mode, did you place the X pointer on top of the creature you want to select? because that line of code checks for position of the creature and the pointer and if it matches up the creature will be selected.
[2] dfhack made this even more convoluted given that old dfusion saved the command inputs thus repeating a function was just scrolling up. I think someone made a plugin that just reads the function of dfusion folder and you just need to type out the name.
[3]source of (original)tile not target(IE the spot you wanted the creature to warp to).
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

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1330 on: April 22, 2012, 06:29:59 pm »

Trying to fix my [PRINT_MODE:TEXT] problem so I cloned dfhack and compiled it, without changes yet, to make sure building works before I start editing code.

Everything builds fine, with some warnings about tile_designations.h and enums that I hope are not relevant to my interests.  But when I run dfhack I get:
Code: [Select]
./libs/Dwarf_Fortress: /home/ubu/Downloads/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
But I'm looking right at the file:
Code: [Select]
ubu@ubu-PX790AA-ABA-SR1511NX-NA530:~/Downloads/df_linux/libs$ ls -al
total 20936
drwxr-xr-x 2 ubu ubu     4096 2012-03-30 06:27 .
drwxr-xr-x 8 ubu ubu     4096 2012-04-22 18:14 ..
-rwxr-xr-x 1 ubu ubu 14669276 2012-03-30 06:27 Dwarf_Fortress
-rw-r--r-- 1 ubu ubu   466491 2012-03-30 06:27 libgcc_s.so.1
-rwxr-xr-x 1 ubu ubu  1435396 2012-03-30 06:27 libgraphics.so
-rwxr-xr-x 1 ubu ubu  4852343 2012-03-30 06:27 libstdc++.so.6

What am I missing?  I'm on Ubuntu 11.10 32bit.  Fresh install of df_linux, haven't even edited the inits yet.
Logged

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1331 on: April 22, 2012, 09:48:13 pm »

Bump, some research leads me to think I'm using the wrong version of gcc.
Currently I'm using gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

Anyone know what version I should be using? 

Edit: Nevermind, used 4.5 and it works fine.  Now for some coding.
« Last Edit: April 22, 2012, 10:22:26 pm by kingubu »
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1332 on: April 23, 2012, 02:47:23 am »

Everything builds fine, with some warnings about tile_designations.h and enums that I hope are not relevant to my interests.

Those warnings are a gcc bug in a way. In earlier versions they actually made sense (and therefore didn't appear), but in the current one they are broken.

Code: [Select]
./libs/Dwarf_Fortress: /home/ubu/Downloads/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)

That copy of libstdc++ works only for gcc versions up to a certain point. If you use a newer one, you have to delete it so it falls back to the one in your system.
Logged

kingubu

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1333 on: April 23, 2012, 06:48:21 am »

Thanks for the reply.  Yeah, switching to gcc 4.5 fixed my problems including the enum one.  Which did turn out to be my problem.  'prospect all' was reporting there were 1.5 million tiles of "IRON" which seemed iffy.

Now I've got [PRINT_MODE:TEXT] and dfhack running together, I can't use the function keys to zoom.  I can use them for dfhack commands like follow.  But plain zooming doesn't work. 

I'm headed back to the source code with a bottle of Mountain Dew in hand.  Wish me luck.
Logged

Alexander86

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.07 r2
« Reply #1334 on: April 23, 2012, 08:48:21 pm »

I'm having a problem with the liquids command. Ok, what I want to do is setup a great tower made out of obsidian so i change it to 'o' then set my ranges say 100 100 and 20 Z's high. This is on the ground level btw. So instead of making this solid tower straight up it only does the base floor and a part of the second floor, whats worse is that you can't just go up to the next level and try to fill in the rest it just won't work. but it works perfectly as long as its underground up until it gets to above ground then it has the same problem and there's plenty of levels of sky above so that's not the problem I haven't tried doing the same with the tile types command because frankly it confuses the hell out of me. Can anyone help me out?

Tl:dr liquids command refuses to make giant tower of obsidian.
Logged
Pages: 1 ... 87 88 [89] 90 91 ... 373