Jump to content
Sign in to follow this  
Godownage

Little bot question

Recommended Posts

Godownage

Can soemone tell me a code on how i can keep a window open even if they click off the window?

I'm making a bot for diablo ii and i want to put a code in my bot if they click off the screen it will bring the window back up so it doesn't error on them, open any other programs, etc.


Share this post


Link to post
Share on other sites
t0ddie

lets see the code.

heres an easy solution

while 1
if not winactive("Diablo II") then
winactivate("Diablo II")
endif
wend

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
Godownage

Do
Sleep (5000)
Send("{ENTER}")
Sleep (1000)
Send("{!}" & "Bot has been running:: " & $Loops & ", ::Minute(s)." & "{!}")
Send("{ENTER}")
Sleep (54000)
$Loops = $Loops + 1
Until $Loops = -1
Exit

Thats my code, and i wanted it if somehow say a AOL messege pops up, it would bring back up the D2 window so nothing is harmed or whatever.


Share this post


Link to post
Share on other sites
DoctorX

Might also want to check out the WinSetOnTop() function.


-DRX

Share this post


Link to post
Share on other sites
Godownage

How would i use it in my while loop, at the begining or end? I'm completely puzzled on this part of my coding.


Share this post


Link to post
Share on other sites
DoctorX

How would i use it in my while loop, at the begining or end? I'm completely puzzled on this part of my coding.

Outside the loop, before you enter your Do/While loop.

It may or may not work for you, what it will do is force the window to remain always on top, but that may not mean it is always active. Also, if another window pops up that also has a "always on top" attribute, it may override your window.


-DRX

Share this post


Link to post
Share on other sites
Godownage

Yeah didn't work for me, if i click off my screen it just sits there, or it works once.


Share this post


Link to post
Share on other sites
Godownage

I used t0ddie's little script he gave me, and it seems to work fine for me, before it types every time it checks to make sure d2 is active.

Do
Sleep (5000)

if not winactive("Diablo II") then
winactivate("Diablo II")
endif

Send("{ENTER}")
Sleep (1000)
Send("{!}" & "Bot has been running:: " & $Loops & ", ::Minute(s)." & "{!}")
Send("{ENTER}")
Sleep (54000)
$Loops = $Loops + 1
Until $Loops = -1
Exit

Thank you all! :P

Edited by Godownage

Share this post


Link to post
Share on other sites
DoctorX

Cool. I was just about to suggest that. :P


-DRX

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  

×