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.

Difference between revisions of "User:Valdemar/Bedroom Macro"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(New page: For instructions, go back to User:Valdemar <pre> GoSub PromptBox SetKeyDelay 5 $+!R:: GoSub PromptBox return $!R:: Loop %numrow% { Loop %number% { ...)
 
Line 1: Line 1:
 
For instructions, go back to [[User:Valdemar]]
 
For instructions, go back to [[User:Valdemar]]
 +
==bedroom.ini==
 +
<pre>
 +
[rooms]
 +
width          = 3
 +
height        = 3
 +
number_per_row = 5
 +
number_of_rows = 1
 +
build_dir      = right ; right, left
 +
row_dir        = down  ; down, up
 +
 +
[doors]
 +
enable_doors  = yes    ; yes, no
 +
door_dir      = bottom ; left, right, top, bottom
 +
door_pos      = 2      ; Column doors will be in
 +
</pre>
 +
==bedroom.ahk==
 
<pre>
 
<pre>
GoSub PromptBox
 
 
SetKeyDelay 5
 
SetKeyDelay 5
$+!R::
 
    GoSub PromptBox
 
return
 
 
$!R::
 
$!R::
     Loop %numrow%
+
    GoSub Read
 +
     Loop %numrows%
 
     {
 
     {
 
         Loop %number%
 
         Loop %number%
 
         {
 
         {
             if builddir = 1
+
             if(builddir=="right")
 
             {
 
             {
 
                 Send {Enter}{Right %width%}{Down %height%}{Enter}
 
                 Send {Enter}{Right %width%}{Down %height%}{Enter}
                 if enabledoors=1
+
                 if(enabledoors="yes")
 
                 {
 
                 {
                     if doordir=1
+
                     if(doordir="bottom")
 
                         Send {Down}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Up}
 
                         Send {Down}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Up}
                     if doordir=2
+
                     if(doordir="top")
 
                         Send {Up %height%}{Up}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Down %height%}{Down}
 
                         Send {Up %height%}{Up}{Left %doorpos2%}{Enter 2}{Right %doorpos2%}{Down %height%}{Down}
                     if doordir=3
+
                     if(doordir="right")
 
                         Send {Up %doorpos2%}{Right}{Enter 2}{Down %doorpos2%}{Left}
 
                         Send {Up %doorpos2%}{Right}{Enter 2}{Down %doorpos2%}{Left}
                     if doordir=4
+
                     if(doordir="left")
 
                         Send {Left %width%}{Left}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Right %width%}{Right}
 
                         Send {Left %width%}{Left}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Right %width%}{Right}
 
                 }
 
                 }
 
                 Send {Right 2}{Up %height%}   
 
                 Send {Right 2}{Up %height%}   
 
             }
 
             }
             if builddir = 2
+
             if(builddir=="left")
 
             {
 
             {
 
                 Send {Enter}{Left %width%}{Down %height%}{Enter}
 
                 Send {Enter}{Left %width%}{Down %height%}{Enter}
                 if enabledoors=1
+
                 if(enabledoors="yes")
 
                 {
 
                 {
                     if doordir=1
+
                     if(doordir="bottom")
 
                         Send {Down}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Up}
 
                         Send {Down}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Up}
                     if doordir=2
+
                     if(doordir="top")
 
                         Send {Up %height%}{Up}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Down %height%}{Down}
 
                         Send {Up %height%}{Up}{Right %doorpos2%}{Enter 2}{Left %doorpos2%}{Down %height%}{Down}
                     if doordir=4
+
                     if(doordir="left")
 
                         Send {Up %doorpos2%}{Left}{Enter 2}{Down %doorpos2%}{Right}
 
                         Send {Up %doorpos2%}{Left}{Enter 2}{Down %doorpos2%}{Right}
                     if doordir=3
+
                     if(doordir="right")
 
                         Send {Right %width%}{Right}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Left %width%}{Left}
 
                         Send {Right %width%}{Right}{Up %doorpos2%}{Enter 2}{Down %doorpos2%}{Left %width%}{Left}
 
                 }
 
                 }
Line 44: Line 57:
 
             }
 
             }
 
         }
 
         }
         if builddir = 1
+
         if(builddir=="right")
 
             Send {Left %backnum%}
 
             Send {Left %backnum%}
         if builddir = 2
+
         if(builddir=="left")
 
             Send {Right %backnum%}
 
             Send {Right %backnum%}
         if rowdir = 1
+
         if(rowdir=="down")
 
             Send {Down %height%}{Down 2}
 
             Send {Down %height%}{Down 2}
         if rowdir = 2
+
         if(rowdir=="up")
 
             Send {Up %height%}{Up 2}
 
             Send {Up %height%}{Up 2}
 
     }
 
     }
 
return
 
return
  
PromptBox:
+
 
InputBox, width, Width, Width of Rooms
+
Read:
InputBox, height, Height, Height of Rooms
+
    IniRead, width, bedroom.ini, rooms, width
InputBox, number, Rows, Number of rooms in each row
+
    IniRead, height, bedroom.ini, rooms, height
InputBox, numrow, Columns, Number of rows to create
+
    IniRead, number, bedroom.ini, rooms, number_per_row
backnum := number * (width +1)
+
    IniRead, numrows, bedroom.ini, rooms, number_of_rows
InputBox, builddir, Direction, Direction to build 1=left to right 2=right to left
+
    IniRead, builddir, bedroom.ini, rooms, build_dir
InputBox, rowdir, Row Direction, Direction to build rows in 1=top to bottom 2=bottom to top
+
    IniRead, rowdir, bedroom.ini, rooms, row_dir
InputBox, enabledoors, Doors, Do you want to automatically add doors? 0=no 1=yes
+
    IniRead, enabledoors, bedroom.ini, doors, enable_doors
if enabledoors=1
+
     IniRead, doordir, bedroom.ini, doors, door_dir
{
+
     IniRead, doorpos, bedroom.ini, doors, door_pos
     InputBox, doordir, Doors, What side should doors be on? 1=bottom 2=top 3=right 4=left
+
    backnum := number * (width +1)
     InputBox, doorpos, Doors, What position should doors be at? 1=first row/column 2=second row/column and so on
 
 
     doorpos2 := width - doorpos
 
     doorpos2 := width - doorpos
}
+
    width := width-1
width := width-1
+
    height := height-1
height := height-1
 
 
return
 
return
 
</pre>
 
</pre>

Revision as of 19:18, 22 November 2007

For instructions, go back to User:Valdemar

bedroom.ini

[rooms]
width          = 3
height         = 3
number_per_row = 5
number_of_rows = 1
build_dir      = right ; right, left
row_dir        = down  ; down, up

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

bedroom.ahk

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