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.

User:Valdemar/Bedroom Macro

From Dwarf Fortress Wiki
Jump to navigation Jump to search

For instructions, go back to User:Valdemar

bedroom.ini[edit]

[rooms]
; Width of your bedrooms
width          = 3     
; Height of your bedroom
height         = 3     
; Number of bedrooms placed per row
number_per_row = 5     
; Number of rows placed
number_of_rows = 1     
; Directions rooms will be built (right, left)
build_dir      = right 
; Directions rows will be build (down, up)
row_dir        = down  


[doors]
; (yes, no)
enable_doors   = yes    
; Direction doors will be in (left, right, top, bottom)
door_dir       = bottom 
; Column doors will be in
door_pos       = 2   

bedroom.ahk[edit]

SetKeyDelay 5
$!R::
    GoSub Read
    Loop %numrows%
    {
        Loop %number%
        {
            if(builddir=="right")
            {
                Send {Enter}{Right %width%}{Down %height%}{Enter}
                if(enabledoors="yes")
                {
                    if(doordir="bottom")
                        Send {Down}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Up}
                    if(doordir="top")
                        Send {Up %height%}{Up}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Down %height%}{Down}
                    if(doordir="right")
                        Send {Up %doorpos2%}{Right}{Enter 2}{Down %doorpos2%}{Left}
                    if(doordir="left")
                        Send {Left %width%}{Left}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Right %width%}{Right}
                }
                Send {Right 2}{Up %height%}   
            }
            if(builddir=="left")
            {
                Send {Enter}{Left %width%}{Down %height%}{Enter}
                if(enabledoors="yes")
                {
                    if(doordir="bottom")
                        Send {Down}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Up}
                    if(doordir="top")
                        Send {Up %height%}{Up}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Down %height%}{Down}
                    if(doordir="left")
                        Send {Up %doorpos2%}{Left}{Enter 2}{Down %doorpos2%}{Right}
                    if(doordir="right")
                        Send {Right %width%}{Right}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Left %width%}{Left}
                }
                Send {Left 2}{Up %height%}   
            }
        }
        if(builddir=="right")
            Send {Left %backnum%}
        if(builddir=="left")
            Send {Right %backnum%}
        if(rowdir=="down")
            Send {Down %height%}{Down 2}
        if(rowdir=="up")
            Send {Up %height%}{Up 2}
    }
return


Read:
    IniRead, width, bedroom.ini, rooms, width
    IniRead, height, bedroom.ini, rooms, height
    IniRead, number, bedroom.ini, rooms, number_per_row
    IniRead, numrows, bedroom.ini, rooms, number_of_rows
    IniRead, builddir, bedroom.ini, rooms, build_dir
    IniRead, rowdir, bedroom.ini, rooms, row_dir
    IniRead, enabledoors, bedroom.ini, doors, enable_doors
    IniRead, doordir, bedroom.ini, doors, door_dir
    IniRead, doorpos, bedroom.ini, doors, door_pos
    backnum := number * (width +1)
    doorpos2 := width - doorpos
    width := width-1
    height := height-1  
return