Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; vim: ft=autohotkey ff=dos
- #SingleInstance force
- ; reminder: default escape char is backtick
- ; license: public domain (with Creative Commons CC0 as fallback for countries without a legal concept of public domain)
- ; Note that this script does not do any sanity-checking whatsoever!
- ; Making masterwork coins _WILL_ cause Dwarf Fortress to crash (this has been experimentally confirmed)!
- ; Item type --> HackWish menu access key sequence mapping
- ; Comma location (start of each continuing line) and closing-brace location (end of last line) must be cargo-culted
- item_selectors := { "Bars" : "bars"
- ,"Bed" : "bed"
- ,"Bin" : "bin"
- ,"Blocks" : "blocks"
- ,"Cabinet" : "cabinet"
- ,"Cage" : "cage"
- ,"Chain" : "chain"
- ,"Chest/Bag" : "box/bag"
- ,"Door" : "door"
- ,"Grate" : "grate"
- ,"Hatch cover" : "hatch{Down}"
- ,"Large Pot" : "pot{Down}{Down}"
- ,"Logs" : "logs"
- ,"Mechanisms" : "mechanism"
- ,"Thread" : "thread" }
- ;,"Coins" : "coin" ; crashes DF
- ; Material name --> HackWish menu access key sequence mapping
- ; Comma location (start of each continuing line) and closing-brace location (end of last line) must be cargo-culted
- material_selectors := { "Nether-cap" : "Pnether{Down}{Enter}{Down}"
- ,"Copper":"Icopper{Down}{Down}"
- ,"Adamantine":"Iadamantine{Down}" }
- ;; actually looks like gold, but crashes DF
- ;,"Gold":"Igold{Down}{Down}{Down}{Down}"
- ;; also crashes DF
- ;,"Gold":"Igold{Down}{Down}{Down}{Down}{Down}{Down}"
- ; Item quality --> HackWish menu access key sequence mapping; this array is perfect, do not mess with it.
- quality_selectors := { "None" : "", "Well-crafted" : "{Down}", "Superior" : "{Down}{Down}", "Exceptional" : "{Up}{Up}", "Masterful" : "{Up}" }
- Gui, Add, Text, section Right, Item Type:
- Gui, Add, Text, Right, Item Material:
- Gui, Add, Text, Right, Item Quality:
- Gui, Add, Text, Right, Item count:
- Gui, Add, Text, Right, Unroll factor:
- ;Gui, Add, Text, Right, Re-Enable MouseQuery:
- Gui, Add, CheckBox, Checked venableMouseQuery, Enable mouse query after exec?
- Gui, Add, Button, gGuiClose, Quit
- Gui, Add, DropDownList, ys vitemType
- for k, v in item_selectors
- GuiControl, Text, itemType, %k%
- Gui, Add, DropDownList, vitemMaterial
- for k, v in material_selectors
- GuiControl, Text, itemMaterial, %k%
- Gui, Add, DropDownList, vitemQuality
- for k,v in quality_selectors
- GuiControl, Text, itemQuality, %k%
- ; bumped Limit to 4 because I needed 5k gold coins to call a caravan
- Gui, Add, Edit, Number Limit4 vitemCount, 100
- Gui, Add, Edit, Number Limit3 vunrollCount, 20
- Gui, Add, Button, gGuiGo, Go
- Gui, Show, , Nether-Cap Item Spawner
- Return
- GuiGo:
- {
- Gui, Submit, nohide
- ; focus Dwarf Fortress
- ; activate cursor
- it := item_selectors[itemType]
- im := material_selectors[itemMaterial]
- iq := quality_selectors[itemQuality]
- ;MsgBox, var it is %it%`, var im is %im%`, var iq is %iq%
- ; loop optimization
- exact_loops := itemCount // unrollCount
- remainder_loops := Mod(itemCount , unrollCount)
- MsgBox, Please select a target location with the `"k`" cursor in DF`, and make sure you didn`'t leave a stateful DFHack command (such as `"lua`" or `"liquids`") open`!
- loop %exact_loops% {
- WinWait, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- IfWinNotActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe, , WinActivate, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- WinWaitActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- Send, mousequery plugin disabled{Enter}
- Send, multicmd{Space} ; The only good thing about cmd.exe: it isn't very sensitive to input timing, so it doesn't need a ton of sleeps! Yay!
- loop %unrollCount% {
- Send, hackwish{Space}`;{Space}
- }
- Send, {Enter}
- WinWait, Dwarf Fortress,
- IfWinNotActive, Dwarf Fortress, , WinActivate, Dwarf Fortress,
- WinWaitActive, Dwarf Fortress,
- ; these sleeps help keep DF from getting confused
- loop %unrollCount% {
- sleep 10 ; Dwarf Fortress doesn't process the input properly unless we sleep after every Send command
- Send, %it%{Enter}
- sleep 10
- Send, %im%{Enter}
- sleep 10
- Send, %iq%{Enter}
- sleep 10
- }
- }
- loop %remainder_loops% {
- WinWait, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- IfWinNotActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe, , WinActivate, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- WinWaitActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- Send, hackwish{Enter}
- WinWait, Dwarf Fortress,
- IfWinNotActive, Dwarf Fortress, , WinActivate, Dwarf Fortress,
- WinWaitActive, Dwarf Fortress,
- ; todo: this was actually caused by mouse movement + a DFHack plugin, re-test without sleeps
- sleep 10 ; Dwarf Fortress doesn't process the input properly unless we sleep after every {Enter}
- Send, %it%{Enter}
- sleep 10
- Send, %im%{Enter}
- sleep 10
- Send, %iq%{Enter}
- }
- if %enableMouseQuery% {
- WinWait, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- IfWinNotActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe, , WinActivate, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- WinWaitActive, C:\Users\fm3d\Desktop\MasterworkDF V.5.05\Dwarf Fortress\Dwarf Fortress.exe,
- Send, mousequery plugin enabled{Enter}
- WinWait, Dwarf Fortress,
- IfWinNotActive, Dwarf Fortress, , WinActivate, Dwarf Fortress,
- WinWaitActive, Dwarf Fortress,
- }
- ;Gui,Show
- }
- GuiClose:
- {
- ExitApp
- }
Add Comment
Please, Sign In to add comment