Hey I think you should make a video of how to change the diablo keys to work as you say cause im a little confused = P
MouseGetPos, saveXpos, saveYpos
MouseClick, left, %halfwidth%, 5, 1, 0, D
MouseGetPos, new_saveXpos, new_saveYpos
;msgbox, orig: %saveXpos%, %saveYpos% new: %new_saveXpos%, %new_saveYpos%
KeyWait w
;msgbox, w was released
MouseClick, left,,, 1, 0, U
MouseMove, %saveXpos%, %saveYpos%
return
a::
MouseGetPos, saveXpos, saveYpos
MouseClick, left, 5, %halfHeight%, 1, 0, D
MouseGetPos, new_saveXpos, new_saveYpos
KeyWait a
MouseClick, left,,, 1, 0, U
MouseMove, %saveXpos%, %saveYpos%
return
s::
MouseGetPos, saveXpos, saveYpos
MouseClick, left, %halfWidth%, %ScreenHeight%, 1, 0, D
MouseGetPos, new_saveXpos, new_saveYpos
KeyWait s
MouseClick, left,,, 1, 0, U
MouseMove, %saveXpos%, %saveYpos%
return
d::
MouseGetPos, saveXpos, saveYpos
MouseClick, left, %ScreenWidth%, %halfHeight%, 1, 0, D
MouseGetPos, new_saveXpos, new_saveYpos
KeyWait d
MouseClick, left,,, 1, 0, U
MouseMove, %saveXpos%, %saveYpos%
return
[/code]
But I do not know how I would make it work to allow you to go diagonal.
I was think of doing something like:
Code:
w & d::
MouseGetPos, saveXpos, saveYpos
MouseClick, left, %ScreenWidth%, 5, 1, 0, D
MouseGetPos, new_saveXpos, new_saveYpos
KeyWait d ;THIS IS THE PROBLEM
MouseClick, left,,, 1, 0, U
MouseMove, %saveXpos%, %saveYpos%
return
the problem is if w is released then it keeps going north west because I dont know how to check if both keys are up.
EDIT: Thanks to VxE, I've got a good script that I will probably add more to. Heres my final version so far:Code:
ScreenWidth := 800
ScreenHeight := 585
halfWidth := ScreenWidth/2
halfHeight := ScreenHeight/2
keys = wasd ; ULDR
SetDefaultMouseSpeed, 0
StringSplit, key, keys
Loop, Parse, Keys
Hotkey, *$%A_LoopField%, TheTimer, on
Pause::Suspend
TheTimer:
SetTimer, TheMover, 5 ; this number is the speed adjustment, higher = slower
return
TheMover:
dx := GetKeyState( key4, "P" ) - GetKeyState( key2, "P" ) ;Right - Left
dy := GetKeyState( key3, "P" ) - GetKeyState( key1, "P" ) ;Down - Up
If !TheFlag
MouseGetPos, memx, memy
If ( dx + dy*2 )
{
TheSpam = Left Down
;////////////////////////// Uncomment the next line to stop the rapid-click
; IfEqual, TheFlag, 1, StringReplace, TheSpam, TheSpam, Down, 0
Click, % (halfwidth + 50 * dx) " "
. (halfheight + 50 * dy) " " TheSpam
TheFlag = 1
}
else
{
Click, Left Up
Click, %memx% %memy% Left 0
TheFlag = 0
SetTimer, TheMover, off
}
return
I changed it so that it does not click to the edge of the screen because it was not ideal that if you just tapped "w, a, s or d" it would go all the way to the edge of the screen, when you may have wanted to only take a few steps.
NOTE:Ran into a problem with finding the center because it was not (400,300) like you would think, because the character is higher than the center.
EDIT: (4/22/08) Well, I liked the sound of ControlClick, because its nice to move the mouse while walking around with wasd, so heres the new script, complete with a hotkey (hold down alt+e) that picks up special items (browns, greens, yellows and blues) and some scripts I use to use skills:Code:
SendMode Play
ScreenWidth := 800
ScreenHeight := 585
halfWidth := ScreenWidth/2
halfHeight := ScreenHeight/2
Skill := 0
xTL := 0
yTL := 0
xBR := 800
yBR := 553
Best1st := 1
keys = wasd ; ULDR
SetDefaultMouseSpeed, 0
StringSplit, key, keys
Loop, Parse, Keys
Hotkey, $%A_LoopField%, TheTimer, on
Pause::Suspend
TheTimer:
SetTimer, TheMover, 5 ; change speed, higher = slower
return
TheMover:
dx := GetKeyState( key4, "P" ) - GetKeyState( key2, "P" ) ;Right - Left
dy := GetKeyState( key3, "P" ) - GetKeyState( key1, "P" ) ;Down - Up
If !TheFlag
MouseGetPos, memx, memy
If (dx | dy)
{
TheSpam = Left Down
;////////////////////////// Uncomment the next line to stop the rapid-click
; IfEqual, TheFlag, 1, StringReplace, TheSpam, TheSpam, Down, 0
; Click, % (halfwidth + 50 * dx) " "
; . (halfheight + 50 * dy) " " TheSpam
xval := halfwidth + 50 * dx
yval := halfheight + 50 * dy
ControlClick, x%xval% y%yval%, Diablo,,,, D
TheFlag = 1
}
else
{
MouseGetPos, memx, memy
;ControlClick, x%xval% y%yval%, Diablo
Click, %xval% %yval% Left 1
Click, %memx% %memy% Left 0
TheFlag = 0
SetTimer, TheMover, off
}
return
q::
tmp_Skill := Skill
Send, {f1}
Loop
{
if not GetKeyState("q", "P" )
break
Sleep 250
Click Right
}
Skill := tmp_Skill
Send {f%Skill%}
return
f::
tmp_Skill := Skill
Send, {f6}
Loop
{
if not GetKeyState("f", "P" )
break
Sleep 250
Click Right
}
Skill := tmp_Skill
Send {f%Skill%}
return
r::
tmp_Skill := Skill
Send, {f2}
Click Right
Sleep 450
Send, {f5}
Click Right
Skill := tmp_Skill
Send {f%Skill%}
return
e::
tmp_Skill := Skill
Send, {f4}
Click Right
Skill := tmp_Skill
Send {f%Skill%}
return
!e::
FileAppend, %Best1st%`n , C:\best1st.txt
if (Best1st < 3)
{
xTL := 63
yTL := 72
Color := "0x588898" ;Gold Items
Gosub, SearchnClick ;Pickup Golds
xTL := 0
yTL := 0
}
else if (Best1st > 2 and Best1st < 5)
{
Color := "0x00C800" ;Green Items
Gosub, SearchnClick ;Pickup Greens
}
else if (Best1st > 4 and Best1st < 7)
{
Color := "0x205858" ;Yellow Items
Gosub, SearchnClick ;Pickup Yellows
}
else if (Best1st > 6 and Best1st < 9)
{
Color := "0xC85058" ;Blue Items
Gosub, SearchnClick ;Pickup Blues
}
else
{
Best1st := 0
}
return
SearchnClick:
Send {Alt Down}
PixelSearch, Px, Py, %xTL%, %yTL%, %xBR%, %yBR%, %Color%, 1, Fast
if ErrorLevel
{
Best1st := Best1st + 1
}
else
{
Px := Px+2
Py := Py+5
Click, %Px% %Py% Left 1
}
return
!x::
Send {esc}{up}{enter}
return
~f1::
Skill := 1
return
~f2::
Skill := 2
return
~f3::
Skill := 3
return
~f4::
Skill := 4
return
~f5::
Skill := 5
return
~f6::
Skill := 6
return
~f7::
Skill := 7
return
~f8::
Skill := 8
return
~f9::
Skill := 9
return
~f10::
Skill := 10
return
~f11::
Skill := 11
return
~f12::
Skill := 12
return
LWin::
send {Alt}
return
[/quote]