Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Diablo 2 Movement with WASD instead of mouse


  • Please log in to reply
19 replies to this topic
CraSH23000
  • Members
  • 40 posts
  • Last active: Apr 15 2013 06:03 AM
  • Joined: 22 Jun 2007
I was playing the ancient game Diablo again for kicks and was slightly irritated by the fact I could not use WASD like most games now a days. I took a shot at making the WASD keys work.

I got the keys to work individually with this code:

ScreenWidth := 795
ScreenHeight := 595

halfWidth := ScreenWidth/2
halfHeight := ScreenHeight/2

w::
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

But I do not know how I would make it work to allow you to go diagonal.

I was think of doing something like:

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:

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:

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

Truth is truth, whether you believe it or not.

Deller
  • Members
  • 239 posts
  • Last active: Dec 08 2011 08:36 PM
  • Joined: 21 Nov 2007

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.


To check that use GetKeyState in the help file.

CraSH23000
  • Members
  • 40 posts
  • Last active: Apr 15 2013 06:03 AM
  • Joined: 22 Jun 2007
Yeah, I was thinking of using GetKeyState(), wasnt that familiar with it, but I think I get it now.

ScreenWidth := 795
ScreenHeight := 595

halfWidth := 400
halfHeight := 300

^+z::

loop
{

wIsD := GetKeyState("w")
aIsD := GetKeyState("a")
sIsD := GetKeyState("s")
dIsD := GetKeyState("d")

;MouseGetPos, saveXpos, saveYpos

if   (wIsD=1 and aIsD=0 and sIsD=0 and dIsD=0)	
{;W is Down
MouseClick, left, %halfwidth%, 5, 1, 0, D
}
else if (wIsD=0 and aIsD=1 and sIsD=0 and dIsD=0)
{;A is Down
MouseClick, left, 5, %halfHeight%, 1, 0, D
}
else if (wIsD=0 and aIsD=0 and sIsD=1 and dIsD=0)
{;S is Down
MouseClick, left, %halfWidth%, %ScreenHeight%, 1, 0, D
}
else if (wIsD=0 and aIsD=0 and sIsD=0 and dIsD=1)
{;D is Down
MouseClick, left, %ScreenWidth%, %halfHeight%, 1, 0, D
}
else if (wIsD=1 and aIsD=1 and sIsD=0 and dIsD=0)
{;W & A are Down
MouseClick, left, 5, 5, 1, 0, D
}
else if (wIsD=1 and aIsD=0 and sIsD=0 and dIsD=1)
{;W & D are Downs
MouseClick, left, %ScreenWidth%, 5, 1, 0, D
}
else if (wIsD=0 and aIsD=1 and sIsD=1 and dIsD=0)
{;S & A are Down
MouseClick, left, 5, %ScreenHeight%, 1, 0, D
}
else if (wIsD=0 and aIsD=0 and sIsD=1 and dIsD=1)
{;S & D are Down
MouseClick, left, %ScreenWidth%, %ScreenHeight%, 1, 0, D
}
else
{
MouseClick, left,,, 1, 0, U
}

}

;MouseMove, %saveXpos%, %saveYpos%

return

There is a problem though, after I use it, I cant drag anything. :?
Truth is truth, whether you believe it or not.

orbik
  • Members
  • 36 posts
  • Last active: Jul 11 2015 05:35 PM
  • Joined: 09 Apr 2008
Ouch, is that an infinite loop i see there? How about using something like this instead:
SendMode, Input

ScreenWidth := 795 
ScreenHeight := 595 

halfWidth := 400 
halfHeight := 300 

clickX := halfWidth
clickY := halfHeight
wasdMoveActive := 0

w::
	clickY := 5
	Gosub, wasd_click
return
s::
	clickY := %ScreenHeight%
	Gosub, wasd_click
return
a::
	clickX := 5
	Gosub, wasd_click
return
d::
	clickX := %ScreenWidth%
	Gosub, wasd_click
return
w up::
	if (clickY < halfHeight)
		clickY := halfHeight
	Gosub, wasd_click
return
s up::
	if (clickY > halfHeight)
		clickY := halfHeight
	Gosub, wasd_click
return
a up::
	if (clickX < halfWidth)
		clickX := halfWidth
	Gosub, wasd_click
return
d up::
	if (clickX < halfWidth)
		clickX := halfWidth
	Gosub, wasd_click
return
	
wasd_click:
	if (clickX != halfWidth || clickY != halfHeight)
	{
		Click down %clickX% %clickY%
		if (!wasdMoveActive)
		{
			wasdMoveActive := 1
			MouseGetPos, mouseOldX, mouseOldY
		}
	}
	else
	{
		Click up
		if (wasdMoveActive)
		{
			wasdMoveActive := 0
			MouseMove, mouseOldX, mouseOldY
		}
	}
return

That aside, couldn't you move with the arrow keys in Diablo? If so, just remap them to wasd.

EDIT: Added MouseGetPos and MouseMove

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006
This should allow 8-direction movement (and can spam click optionally)

ScreenWidth := 795
ScreenHeight := 595

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" )
dy := GetKeyState( key3, "P" ) - GetKeyState( key1, "P" )
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 + Floor( halfwidth * 0.97 ) * dx) " "
		. (halfheight + Floor( halfheight * 0.97 ) * dy) " " TheSpam
	TheFlag = 1
}
else
{
	Click, Left Up
	Click, %memx% %memy% Left 0
	TheFlag = 0
	SetTimer, TheMover, off
}
return


CraSH23000
  • Members
  • 40 posts
  • Last active: Apr 15 2013 06:03 AM
  • Joined: 22 Jun 2007

Ouch, is that an infinite loop i see there?


I thought that would not be the best thing, :lol: then again its the only way I could figure out how to do diagonal combinations like:

"w & a" at the same to go north west
"w & d" at the same to go north east
"s & a" at the same to go south west
"s & d" at the same to go south east


That aside, couldn't you move with the arrow keys in Diablo? If so, just remap them to wasd.


The reason I'm making this script is because the game does not support moving with keyboard.

This should allow 8-direction movement (and can spam click optionally)


Thanks alot VxE works great, your script fixes issue I had with not being able to drag things.

EDIT: Sweet, I took your code and have my final version for this aspect of the program

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.
Truth is truth, whether you believe it or not.

orbik
  • Members
  • 36 posts
  • Last active: Jul 11 2015 05:35 PM
  • Joined: 09 Apr 2008
@VxE
While your code works, it's terribly inefficient by being based on a loop running at short intervals, and by repeating redundant arithmetic operations. The only advantage to my version is maintainability, by allowing easy redefinition of the movement keys. This should be addressed by using a better language (that supports higher level abstraction) instead of compromising performance. You also managed to make one part both hard to read and slow. Change If ( dx + dy*2 ) to If (dx | dy)
</rant>

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006

@VxE
While your code works, it's terribly inefficient by being based on a loop running at short intervals, and by repeating redundant arithmetic operations. The only advantage to my version is maintainability, by allowing easy redefinition of the movement keys. This should be addressed by using a better language (that supports higher level abstraction) instead of compromising performance. You also managed to make one part both hard to read and slow. Change If ( dx + dy*2 ) to If (dx | dy)
</rant>

So sue me...

Really, what's your point? Are you disappointed to see code that hasn't been in development for at least 3 months? Or is it that you prefer your own spaghetti-code style to my semi-arcane style?

As for efficiency.... whoop-de-doo.... who's gonna notice?

And about easy redefinition of the keys, I think I've got you beat in that department since

keys = wasd ; ULDR

is unquestionably easier to deal with than 8 separate hotkeys.

Meh, anyone who's interested will just use whatever code they like better anyways. I suppose, If I really wanted to rewrite this code for myself, I'd use ControlClick instead of hijacking the mouse.

aobrien
  • Members
  • 77 posts
  • Last active: Mar 06 2014 04:42 AM
  • Joined: 14 Feb 2008
Hi CraSH,

I actually wrote a DiabloII leveling script not too long ago. It is pretty slick if I do say so myself. It will play endlessly, if you die it will recognize that fact and reload the last saved game.

I've been toying with the idea of posting it to the forum. I'll speed up my timeline if you are interested.

aobrien

CraSH23000
  • Members
  • 40 posts
  • Last active: Apr 15 2013 06:03 AM
  • Joined: 22 Jun 2007
Yes, I am very interested. I am curious how you are targeting enemies, and if your script works for multiple abilities and classes.
Truth is truth, whether you believe it or not.

aobrien
  • Members
  • 77 posts
  • Last active: Mar 06 2014 04:42 AM
  • Joined: 14 Feb 2008
Hi Crash,
Sorry it took so long to reply... I don't check my personal email as much as I should.

I tried several different methods of targeting enemies, but came to the conclusion that it was just better to flail around and let them come to me (Use the shift key while clicking left-mouse), it is actually pretty effective.

I have used the script to level my Druid (Dimensional Blade - undestructible - kind of important) and Amazon archer.

I posted the script here:
Diablo 2 Expansion Auto-Leveling Script

aobrien

SorryBut
  • Guests
  • Last active:
  • Joined: --
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:

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:

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:

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]

geigertron
  • Members
  • 7 posts
  • Last active: Jul 21 2011 01:25 PM
  • Joined: 06 Jul 2011
SorryBut (or [VxE],

If your still around, I can't get SorryBut's FINAL version to work. How do you run it anyway, with AutoHotKey?

I tried that program, but when I run the script (w/ game), NOTHING happens. What am I doing wrong??

Does this work with any version of Diablo 2 and it's expansion?

codybear
  • Members
  • 600 posts
  • Last active: Feb 09 2015 12:41 PM
  • Joined: 15 Sep 2009
I'll test it when I get some time today. I have to do some computer and tech support things today.

Edit: quick question, what version of AHK are you using? Basic or AHK_l? That way I can test it with that version if no one else replies with the solution before I am able to. (im on my phone at the dmv).
Disclaimer: I'm not an expert by any means; I just try to help out where I can.

geigertron
  • Members
  • 7 posts
  • Last active: Jul 21 2011 01:25 PM
  • Joined: 06 Jul 2011

I'll test it when I get some time today. I have to do some computer and tech support things today.

Edit: quick question, what version of AHK are you using? Basic or AHK_l? That way I can test it with that version if no one else replies with the solution before I am able to. (im on my phone at the dmv).

I'm using latest (I assume) AHK version, which 1.1

My operating system is Windows 7. I tried the tried the scripts with AHK, even created an .exe file. It seems to have no effect whatsoever. Does it require a patch version, or the expansion patch? The patch version I'm using is the old 1.08 expansion patch. I also have the one of the most recent patches, the 1.12 patch, just in case.

It's been said that Windows 7 is not AHK friendly.

I'm really quite new to this stuff, tried to do some tinkering, which often leads to no results.