Okay, I think I've got the movement mostly down.
It still needs a few tweaks, but here are my ahk scripts for dualboxing D2R on two PC's.
PC1 Script 1:
Code:
#NoEnv
CoordMode, Mouse, Window
SetTitleMatchMode 2
AutoTrim, Off
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
#If WinActive("box1") and MouseIsOver("box1")
LButton::
GetKeyState, capsstate, Pause, D
MouseGetPos, xpos, ypos
If (capsstate == "D")
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC2 := "MB|" slavexpos "|" slaveypos "|0|LEFT"
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC2 := ""
} else
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC1 := "MB|" xpos "|" ypos "|0|LEFT"
keypressPC2 := "MB|" slavexpos "|" slaveypos "|0|LEFT"
FileAppend, %keypressPC1%`n, commandPC1.txt
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC1 := ""
keypressPC2 := ""
}
return
#If WinActive("box1") and MouseIsOver("box1")
RButton::
GetKeyState, capsstate, Pause, D
MouseGetPos, xpos, ypos
If (capsstate == "D")
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC2 := "MB|" slavexpos "|" slaveypos "|0|RIGHT"
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC2 := ""
} else
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC1 := "MB|" xpos "|" ypos "|0|RIGHT"
keypressPC2 := "MB|" slavexpos "|" slaveypos "|0|RIGHT"
FileAppend, %keypressPC1%`n, commandPC1.txt
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC1 := ""
keypressPC2 := ""
}
return
#If WinActive("box1") and MouseIsOver("box1")
+LButton::
GetKeyState, capsstate, Pause, D
MouseGetPos, xpos, ypos
If (capsstate == "D")
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC2 := "MB|" slavexpos "|" slaveypos "|1|LEFT"
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC2 := ""
} else
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC1 := "MB|" xpos "|" ypos "|1|LEFT"
keypressPC2 := "MB|" slavexpos "|" slaveypos "|1|LEFT"
FileAppend, %keypressPC1%`n, commandPC1.txt
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC1 := ""
keypressPC2 := ""
}
return
#If WinActive("box1") and MouseIsOver("box1")
+RButton::
GetKeyState, capsstate, Pause, D
MouseGetPos, xpos, ypos
If (capsstate == "D")
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC2 := "MB|" slavexpos "|" slaveypos "|1|RIGHT"
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC2 := ""
} else
{
slavexpos := Round(3 * (xpos / 8), 0)
slaveypos := Round(3 * (ypos / 8), 0)
keypressPC1 := "MB|" xpos "|" ypos "|1|RIGHT"
keypressPC2 := "MB|" slavexpos "|" slaveypos "|1|RIGHT"
FileAppend, %keypressPC1%`n, commandPC1.txt
FileAppend, %keypressPC2%`n, \\192.168.1.2\shared\commandPC2.txt
xpos := ""
ypos := ""
slavexpos := ""
slaveypos := ""
keypressPC1 := ""
keypressPC2 := ""
}
return
PC1 Script 2:
Code:
#NoEnv
CoordMode, Mouse, Window
SetTitleMatchMode 2
SetControlDelay -1
Loop {
state := GetKeyState("LShift")
if (state == "U") {
ControlSend,,{LShift up}, box1
}
if FileExist("commandPC1.txt") {
FileReadLine, commandline, commandPC1.txt, 1
StringLen, Length, commandline
if (commandline != "") {
StringSplit, pos_array, commandline, "|"
If (pos_array1 == "MB") {
DllCall("SetCursorPos", int, pos_array2, int, pos_array3)
If (pos_array4 == "1") {
ControlSend,,{RShift down}, box1
ControlClick, x%pos_array2% y%pos_array3%, box1,, %pos_array5%
ControlSend,,{RShift up}, box1
} else {
ControlClick, x%pos_array2% y%pos_array3%, box1,, %pos_array5%
}
pos_array := ""
commandline := ""
}
else {
ControlSend,, %commandline%, box1
commandline := ""
}
FileDelete, commandPC1.txt
}
}
}
(PC2 scripts in post below, ran into character length restriction)
Renamed PC1 instance to "box1" and PC2 instance to "box2" with window title changer and the script is now completely compatible with Input Director. (I had some issues with active windows, having both instances active at times, but an extra test to check if the mouse is over the active window as well fixed that.
As you can see, even though I am not very familiar with this set up, it is already looking viable.
Right now I can mute the main instance and reasjust the second char. (Using my capslock key that is remapped to pause), I also need a pause on the second char still to make things even better. After that, its just more simply key cloning to allow with skill changing and I'm set.
All in all pretty happy with my little D2R beta project so far. Still a bit unhappy to be limited to one client per PC atm. Hoping that will change for release.
Connect With Us