Sign in to follow this  
Followers 0
dragonme

D2 Fast Exit

4 posts in this topic

Aight I am new to the forums but recently got back into autoit. So sup all. Anyway I made a script earlyier today and been working on it off and on for a while. (totaly changed from what it used to be) I want some suggestions on this script of mine.

;   Made By: Dragonme       X          Y
;       D2 Exit Script -={*800*}-=x=-{*600*}-=-={*res*}=-
;       D2 Exit Script -={*640*}-=x=-{*480*}-=-={*res*}=-
;
$meow = 0
$moose = 0

while $moose = 0

While $meow = 0
If WinExists("Diablo II") or WinExists("Diablo 2") then
$meow = 1
else
Sleep(500)
endif
wend

While $meow = 1
$state01 = WinGetState("Diablo II", "")
$state02 = WinGetState("Diablo 2", "")
If not WinExists("Diablo II") and not WinExists("Diablo 2") then
$meow = 0
endif
If WinExists("Diablo II") and not WinExists("Diablo 2") then
WinSetTitle("Diablo II", "", "Diablo 2")
endif
If BitAnd($state01, 8) Then
HotKeySet("{ESCAPE}", "Myfunc1")
endif
If BitAnd($state02, 8) Then
HotKeySet("{ESCAPE}", "Myfunc2")
endif
Sleep(10)
WEnd

while $meow = 2
sleep(5000)
wend
wend

func myfunc1()
$meow = 2
BlockInput(1)
MouseMove(400, 420, 0)
ControlSend("Diablo II", "", "", "{Esc}")
ControlSend("Diablo II", "", "", "{Up}")
ControlSend("Diablo II", "", "", "{Enter}")
BlockInput(0)
$meow = 1
EndFunc

func myfunc2()
$meow = 2
BlockInput(1)
MouseMove(400, 420, 0)
ControlSend("Diablo 2", "", "", "{Esc}")
ControlSend("Diablo 2", "", "", "{Up}")
ControlSend("Diablo 2", "", "", "{Enter}")
BlockInput(0)
$meow = 1
EndFunc

Also I think I forgot to mention it works with 2 instances of the game running at the same time.

My last fix on it made it so when no d2 windows existed it wouldnt close.... have no clue why it was closing but i fixed it. :o

I made this for HC. (die once and lose everything on that char and the char itself)

Any pro's want to help me learn how to use pixel detection for a self made chicken bot or any suggestions?

(P.S: Tried the pixel detection chicken bot thing before but it would go off if my mouse crossed that pixel also normal variable names make it so i don't know wtf they do so I use dumb ones B) )

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Welcome to the forums!

You can make infinite loops without using a variable, which will make your code more readable because you won't need a $moose variable:

While 1
   ; ...
WEnd

You can also send multiple keystrokes within one ControlSend() call:

ControlSend('Diablo II', '', '', '{Esc}{Up}{Enter}')
Edited by LxP

Share this post


Link to post
Share on other sites

You can also send multiple keystrokes within one ControlSend() call:

ControlSend('Diablo II', '', '', '{Esc}{Up}{Enter}')
I will check out what you have to say..... on a copy of my script of course im tired of debugging for 5 hours straight. Thx for the input. (going to continue working on it tommorow. Have some friends that want it and there is a still a bug with it working while both games are minimized.) B)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

;   Made By: Dragonme       X          Y
;       D2 Exit Script -={*800*}-=x=-{*600*}-=-={*res*}=-
;       D2 Exit Script -={*640*}-=x=-{*480*}-=-={*res*}=-
$meow = 0
while 1

While $meow = 0
If WinExists("Diablo II") or WinExists("Diablo 2") then
$meow = 1
else
Sleep(500)
endif
wend

While $meow = 1
$state01 = WinGetState("Diablo II", "")
$state02 = WinGetState("Diablo 2", "")
If not WinExists("Diablo II") and not WinExists("Diablo 2") then
$meow = 0
endif
If WinExists("Diablo II") and not WinExists("Diablo 2") then
WinSetTitle("Diablo II", "", "Diablo 2")
endif
If BitAnd($state01, 16) and BitAnd($state02, 16) Then
HotKeySet("{ESCAPE}", "Myfunc3")
endif
If BitAnd($state02, 8) Then
HotKeySet("{ESCAPE}", "Myfunc2")
endif
If BitAnd($state01, 8) Then
HotKeySet("{ESCAPE}", "Myfunc1")
endif
Sleep(10)
WEnd

while $meow = 2
sleep(5000)
wend
wend

func myfunc1()
$meow = 2
BlockInput(1)
MouseMove(400, 420, 0)
ControlSend("Diablo II", "", "", "{Esc}{Up}{Enter}")
BlockInput(0)
$meow = 1
EndFunc

func myfunc2()
$meow = 2
BlockInput(1)
MouseMove(400, 420, 0)
ControlSend("Diablo 2", "", "", "{Esc}{Up}{Enter}")
BlockInput(0)
$meow = 1
EndFunc

func myfunc3()
sleep(500)
EndFunc

Aight this is my fix to it. It now has no problems with the Escape key on desktop. I dont use any other programs where I realy need the escape key so this should work. Maybe another game...... hmm guess I will have to fix that lol should be simple.

Edited by dragonme

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0