For those who still prefer trading over mass offering, I have cobbled together a pair of crude macros for AutoHotKey. (As of 2012-11-02, Stack Trading
is still untested for values of Quant (items traded per stack) over 99 Does not work for values >= 10. Sorry.
The issue appears to be the fact that the value of the variable StringForm is reset to the null string if := assignment is done more than once. (How is this possible?))
Stack Trading Auto.ahk
;
;
; This script takes three inputs: Quant, Iters, and Dir.
; This script trades Quant units from each stack for Iter stacks. Dir specifies whether the
; selection moves up or down.
;
; Up example:
; Coins [500] <-This is desginated fo trade last.
; ...
; Coins [500]
; ...
; Coins [500] <-Cursor starts here. This is designated for trade first.
;
; Down is the opposite.
;
; Based on GuiDumper.ahk
;
DetectHiddenWindows, on
Gui, Add, Text,, Items Traded per Stack
Gui, Add, Text,, Stacks to be Traded
Gui, Add, Text,, Direction up or down
Gui, Add, Edit, vQuant ym
Gui, Add, Edit, vIters
Gui, Add, DropDownList, vDir, up|down
Gui, Add, Button, Default, OK
Gui, Add, Button, Default, Cancel
Gui, Show,, Stack Trading Automator
Return
;
; end autoexec.
;
Enter::
GuiClose:
ButtonOK:
Gui, Submit, NoHide ; Save the input from the user to each control's associated variable.
IfWinExist, Dwarf Fortress ; make sure df is running
WinActivate
sleep, 3000 ;; three seconds to open the DF window if it doesn't open automatically.
SLEEPTIME = 12
StringForm := ""
NumForm := Quant
if (NumForm == 0 || NumForm == 1){
StringForm := "1" . StringForm
}else{
while(NumForm !=0){
StringForm := Mod(NumForm,10) . StringForm
NumForm //= 10
}
}
loop, %Iters% {
SendInput {Enter}
Sleep SLEEPTIME
SendInput {Enter}
Sleep SLEEPTIME
SendInput {Enter}
Sleep SLEEPTIME
SendInput {%StringForm%}
Sleep SLEEPTIME
SendInput {Enter}
Sleep SLEEPTIME
if (dir=="up"){
SendInput {up}
}else if(dir=="down"){
SendInput {down}
}
}
Escape::
ButtonCancel:
ExitApp
In summary, this is pretty much only applicable to trade-based stack-splitting, and does not work with single coins. That's where the next one is applicable.
Mass Enter.ahk
;
;
; This script takes Two inputs: Iters and Dir.
; This script presses Enter for Iter items. Dir specifies whether the selection moves up or down.
;
; Up example:
; Coins [1] <-Enter is pressed here last
; ...
; Coins [1]
; ...
; Coins [1] <-Cursor starts here. Enter is pressed here first.
;
; Down is the opposite.
; Invoke
; Based on GuiDumper.ahk
;
DetectHiddenWindows, on
Gui, Add, Text,, No. of items for Enter press
Gui, Add, Text,, Direction up or down
Gui, Add, Edit, vIters ym
Gui, Add, DropDownList, vDir, up|down
Gui, Add, Button, Default, OK
Gui, Add, Button, Default, Cancel
Gui, Show,, Stack Trading Automator
Return
;
; end autoexec.
;
Enter::
GuiClose:
ButtonOK:
Gui, Submit, NoHide ; Save the input from the user to each control's associated variable.
IfWinExist, Dwarf Fortress ; make sure df is running
WinActivate
sleep, 3000 ;; three seconds to open the DF window if it doesn't open automatically.
SLEEPTIME = 12
loop, %Iters% {
SendInput {Enter}
Sleep SLEEPTIME
if (dir=="up"){
SendInput {up}
}else if(dir=="down"){
SendInput {down}
}
}
Escape::
ButtonCancel:
ExitApp
Once there are only single coins left, this can be used to mass-designate. For that matter, it works for all enter-based designations (i.e. bringing stuff to the trade depot.)
The GUI is more or less self explanatory. The weakness of these scripts is that you need to know the no. of stacks/things to designate with the enter key beforehand. It is still less tiring than pressing the buttons individually.
For coin-trading, here's a cheat sheet for one coin stack; multiply by no. of stacks for more:
Format is:
Round [some number]: (what to do)
(What each party of the trade has afterwards. In this method, the parties come out with the same amount and type of stack at each step.)
Start: 1 stack of [500]
Round 1: Trade 250 over 1 stack
Trader:[250]
Self: [250]
Round 2: Trade 125 over 2 stacks
Trader:[125]x2
Self: [125]x2
Round 3: Trade 63 over 4 stacks
Trader:[63]x2 and [62]x2
Self:[63]x2 and [62]x2
Round 4: Trade 31 over 8 stacks
Trader: [32]x2 and [31]x6
Self:[32]x2 and [31]x6
Round 5: Trade 16 over 16 stacks
Trader:[16]x10 and [15]x6
Self:[16]x10 and [15]x6
Round 6: Trade 8 over 32 stacks
Trader:[8]x26 and [7]x6
Self:[8]x26 and [7]x6
Round 7: Trade 4 over 64 stacks
Trader:[4]x58 and [3]x6
Self:[4]x58 and [3]x6
Round 8: Trade 2 over 128 stacks
Trader:[2]x122 and [1]x6
Self:[2]x122 and [1]x6
Round 9:: Trade 1 over all 256 "stacks" (Using Stack Trading Auto will "pass over" stacks of 1 coin for designation, so they
remain "in circulation")
Trader: One coin ([1])x250
Self: One coinx250
Round 10: Use Mass Enter to get all coins remaining in Trader's clutches. Remember to have 250 Dwarfbucks worth of goods on hand per stack in case the traders round up the individual coin values to 1 dBuck apiece (This happened to me, and resulted in the elven caravan carrying away 150 bars worth of metal. I don't know if this is a bug or a feature of having an incompetent broker).
Sleep is there because my computer cannot handle all the strokes otherwise.
Oh, and remember to "bring back" to the depot (can be done while paused, as the coins are still physically there, just not being traded) the coins you buy back from the trader after each step (mass enter can be useful here).