Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DWARF JOB MACRO  (Read 737 times)

Zengief

  • Bay Watcher
    • View Profile
DWARF JOB MACRO
« on: November 14, 2006, 11:52:00 am »

I was tired of trying to remember which dwarves I assigned to which jobs, so I made this. It is in ACTool 5.3.0 like my others in here.  Try it out and let me know if you like it.
EDIT: one more thing.  The game should be in a paused state when you try it and the menu should be on the far left(no world map)
code:
//run in a windowed 800 by 600 mode with 800x600 font. 
//I have programmed for other windows (2 constants below should be changed)  but have not tested this
//it will output a text file on C: called DF.txt
//it seems slightly glitchy and will sometimes output a wrong value.  UserBeware
//run time is approx 3-4 sec per dwarf. It may take a minute or 2 for large numbers of dwarves.

SetActiveWindow Dwarf Fortress
Constants
   TotalDwarfs=16   //This value must be adjusted before running
 WindowX=800
 WindowY=600
 Framewidth=3  //3 may need adjustment should put mouse cursor just inside frame where tiles start
 Titlebarheight=29  //same as above
 OriginX = 0
 OriginY = 0
 CurrentX=0
 CurrentY=0
 tileheight=0
 tilewidth=0
 dwarf=0
 lineIndex=0
 Fileinput=Dwarf
End
Constructs
   File1=File
End

Procedure JobGet using jobs
   delay 20
   loop $lineindex=0 to $jobs
      compute $CurrentY=$OriginY + $lineindex*$tileheight
      compute $CurrentX=$OriginX
      
      while 1=1
         IsWhite  $CurrentX, $CurrentY
          setconst fileinput=$fileinput    X
          break
         Else
          Isgrey  $CurrentX, $CurrentY
             setconst fileinput=$fileinput    O
             break
          else
             inc $CurrentX
             if {loopno}>50
                setconst fileinput=$fileinput    NA
                break
             end
          end
         End
      end
   end   
End

Fileopen File1, c:\DF.txt //change this as you please
Filerewrite file1

setconst fileinput=$fileinput    Mning   WoodC   Carpy   Mason   StnDe   AniTr   AniCr   HealC   FishC   Butch   LthWk   Tning   FarmF   Fishn
setconst fileinput=$fileinput    Alchy   FurOp   AshOp   Metal   Jewel   Craft   Glass   SgEng   SgOpr   Mechs   XBowM   Weavn   Cloth   Milln
setconst fileinput=$fileinput    Huntn   Brewn   PlntG   FarmW   Cookn   Trapn   StonH   WoodH   ItemH   Buril   FoodH   RefuH   FurnH   AnimH
setconst fileinput=$fileinput    Clean   Archt
filewrite file1, $fileinput

compute $OriginX={WindowLeft}+$Framewidth
compute $OriginY={WindowTop}+$titlebarheight

Mousepos $originX,$originY //use this to find inside corner of frame

compute $tileheight=$WindowY/25
compute $tilewidth=$WindowX/80
compute $OriginX =$OriginX + $tilewidth*50
compute $OriginY =$OriginY + $tileheight*5.5

keys ucpl{SPACE}

loop $totaldwarfs
   keys u
   compute $dwarf={loopno}-1
   while $dwarf>18
      keys {pgdn}
      compute $dwarf=$dwarf-19
   end
   if $dwarf>0
      loop $dwarf
         keys {DOWN}
      end
   end
   keys c

   compute $Fileinput=$dwarf+1
   
   Call JobGet 13
   keys {Keypad *}
   Call JobGet 13
   keys {Keypad *}
   Call JobGet 13
   keys {Keypad *}
   Call JobGet 1
   keys {space}
   filewrite file1, $fileinput
end

fileclose file1


[ November 14, 2006: Message edited by: Zengief ]

Logged

dav

  • Bay Watcher
    • View Profile
Re: DWARF JOB MACRO
« Reply #1 on: November 14, 2006, 02:24:00 pm »

Do I need to download ACTool?
Logged

Pod

  • Bay Watcher
    • View Profile
Re: DWARF JOB MACRO
« Reply #2 on: November 14, 2006, 03:08:00 pm »

What does it do?
Logged

dav

  • Bay Watcher
    • View Profile
Re: DWARF JOB MACRO
« Reply #3 on: November 14, 2006, 03:32:00 pm »

Looks like it'll create a txt file in your c: drive (changeable) that tells you what dwarves do what job.
Logged

Zengief

  • Bay Watcher
    • View Profile
Re: DWARF JOB MACRO
« Reply #4 on: November 14, 2006, 03:32:00 pm »

dav: Yes, ACTool is a fairly common mouse macro program originally made for Asherons Call macroers.  If you download it, you should be able to copy and paste the macro into it.  I see that the current version is 5.4.0 while mine was made in 5.3.0, but I have used basic enough commands that it should still work in the newer version.

Once you paste the code in you will need to modify it slightly for your fort.  Most notably, you need to change the total dwarf constant to your current number of living dwarves.

Pod: the macro gives you a txt file with infomation like this:

code:
Dwarf    Mning   WoodC   Carpy   
1    X    O    O    
2    X    O    O    
3    X    O    O    
4    O    O    X    
5    O    X    O      


This shows my first 3 dwarfs have mining 4th has carpentry and 5th has wood cutting.
It covers all dwarves and all work prefs.

[ November 14, 2006: Message edited by: Zengief ]

Logged