v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Utility Talk:Dwarf Companion

From Dwarf Fortress Wiki
Jump to navigation Jump to search

I did some cleaning (actually I just removed most of it).

Bugs

There are a few known bugs :

  • exhaustion is sometimes maxed out when you edit a creature
  • bleeding seems not to be stoppable in most case : just turn the creature undead
  • if there is a problem related to python and/or gtk, just make sure you followed the installation instructions. If it doesn't work anyway, it is unlikely I can help you (would be a python or gtk problem, not a DC problem)


Feature requests!

To be edited ...

Dwarf Companion - Cheating Fun in Adventure Mode!

I was tinkering about with the Dwarf Companion program earlier today, when a thought came to my mind. "What if you could do stuff with this program in Adventure mode?"

Well, it turns out that you can. By turning on the program and hitting the "All Creatures" box, you can access any loaded creature as well as your own adventurer. By doing this, you can make him as strong and legendary as you want, and effectively kill anything within the sector. You can also change your character into any creature in the game, including demons, goblins, etc. (NOTE: 'Shapeshifting' like this renders the tile where you changed un-passable, and you tend to teleport when you do so. Also, when I changed into a dragon, the game crashed.) Moods are also able to toggle, though I've only tested them upon my own adventurer. Going beserk in a human town triggered the mayor to start attacking me, but when I turned it off, he became friendly once again.

Here's a movie of some of my exploits with a fresh adventurer dwarf: http://mkv25.net/dfma/movie-348-dwarfcompanioninadventuremode17338a

I hope this strikes as interesting / useful for the future!

Easy Python/PyGTK installer

I was having some trouble getting all the Python dependencies to work properly together, but after some research I found a nice all-in-one PyGTK installer that works perfectly with companion 0.10. http://aruiz.typepad.com/siliconisland/2006/12/allinone_win32_.html Hope this helps!


DwarfCompanion Linux HOWTO

There are two major problems when trying to run DwarfCompanion-0.13 in Linux:

  • at least when started with "wine dwarfort.exe", dwarf-companion
    • cannot find the path to the executable when searching for the offsets
    • and has problems finding the process with "endswith()"

the following patch tries to work around these problems somewhat (you either have to run DwarfCompanion one directory-level down from your dwarfort.exe or change the path in the patch):

--- companion/dwarfdbg.py	2008-09-07 22:04:12.000000000 +0000
+++ ~/dwarf_fortress/companion/dwarfdbg.py	2008-09-07 22:07:11.000000000 +0000
@@ -100,9 +100,9 @@
 		self.dbg = pydbg()
 		self.metals = None
 		for (pid, proc) in self.dbg.enumerate_processes():
-			if proc.lower().endswith("dwarfort.exe"):
+			if "dwarfort.exe" in proc.lower():
 				break
-		if not proc.lower().endswith("dwarfort.exe"):
+		if not "dwarfort.exe" in proc.lower():
 			print "Dwarf Fortress is not running, or could not be found"
 			sys.exit(-1)
 		self.image = proc
@@ -864,7 +865,7 @@
 
 	def getOs(self):
 		if self.ofs == None:
-			self.ofs = offsetsearch.offsetsearch(self.image)
+			self.ofs = offsetsearch.offsetsearch("../dwarfort.exe")
 		return self.ofs
 
 	def instaMood(self):


  • reading/writing from the dwarf-fortress process when attaching/detaching with ptrace() without waiting for the process to react to the ptrace() also leads to problems, basically it is timing-dependent if you can read or change anything

this is easily fixed with waitpid (though I'm not quite sure if this really fixes the problem or if some signals could screw everything up again, therefore the "print status" statement):

--- companion/dflinux.py	2008-01-09 10:50:00.000000000 +0000
+++ ~/dwarf_fortress/companion/dflinux.py	2008-09-07 21:29:50.000000000 +0000
@@ -33,6 +33,9 @@
 		pid = int(spid)
 		self.pid = pid
 		self.libc.ptrace(16, self.pid, 0, 0) #ptrace attach
+		status = 0
+		self.libc.waitpid(self.pid, status, 0)
+		print status
 	
 	def read(self, addr, size):
 		out = 
@@ -60,4 +63,7 @@
 	def detach(self):
 		if self.pid>0:
 			self.libc.ptrace(17, self.pid, 0, 0) #ptrace detach
+			status = 0
+			self.libc.waitpid(self.pid, status, 0)
+			print status
 			self.pid = 0
  • There are still some minor problems, e.g. when trying to set anything in the creature-editor, but at least healing and resting from the creature-list works now as expected. I will try to take a look at the creature-editor ...

--Penguin dwarf08 14:14, 11 September 2008 (EDT)

Thanks for this ! Bartavelle 09:20, 17 March 2009 (UTC)


Happydorf.py

I ran into a bug with a fortress that my dorfs were suiciding so I hacked this up to force their happiness to max, and it got me over the hump. It might help someone someday. Save as happydorf.py and dump it in your DC/scripts folder.

from dwarfdbg import * from eventname import jobName import sys dbg = dwarfdbg() #init dbg cl = dbg.getCreatures(0) #get the whole creature list (slow) for id in cl:

    if cl[id][1] != 'dwarf': #keep Dwarf (both alive and dead)
         continue
    c = cl[id][13] # creature structure
    if c.fe4&2:
         continue
    c.happiness = 65534 #Set happy to max -1, (max is 65535 as of 40D)
    dbg.saveCreature(c) #save

--Kittyz 14:56, 27 January 2009 (EST) Kittyz

A quick question

Does this work in 0.28.181.40d11? It says DF isn't running or can't be found when I try. --Simmura McCrea 18:16, 12 May 2009 (UTC)