Sign in to follow this  
Followers 0
t0ddie

problems detecting screen

12 posts in this topic

#1 ·  Posted (edited)

i am trying to create a bot for Diablo II.

the window for the game is full screen sometimes, window mode.. and depending on the computer,different resolutions. so i need an idea for detecting this screen so my bot can add info (see attached screenshot) when it starts the game.

the bot will run diablo II.exe then should click a few things to get to this screen here.

i need a way to detect that it has gotten to this screen and to proceed.

Edited by t0ddie

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



Well... You could use a command (i forgot which) to get the screen resolution. Then use WinWaitActive so you can tell when the screen is up. Also, I suggest using Sleep(5000) after the WinWaitActive Command.

Share this post


Link to post
Share on other sites

why not just have the script run d2loader and force it to load under the resolutions u want it to? it's been a while since i've played d2, so if d2loader doesn't work anymore or something, sorry


[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

well the window may also be named random things.

i can just make it check the active window.

and i would basically do some type of pixelcheck.

but i would need it to check a certain color on the screen that may be in different places on different computers

how can i apply this? i can get width, height, x and y.. but how would i tell the script where to pixelcheck depending on what the results are?

EDIT:

why not just have the script run d2loader and force it to load under the resolutions u want it to? it's been a while since i've played d2, so if d2loader doesn't work anymore or something, sorry

i dont want to force the user to use the window size that i specify

Edited by t0ddie

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

#5 ·  Posted (edited)

/

Edited by Felix N.

Share this post


Link to post
Share on other sites

no. i DONT want a set resolution. i want to detect what the user has as their setup.

then i would need to get the information about their window and use some sort of formula to determine what coordinates to check the pixel color at, since the coordinates will vary depending on each screen size and resolution, the problem is coming up with the formula.


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

#7 ·  Posted (edited)

Try using WinGetTitle(""), it returns the active window's title. Build a Hot key to signal the script when you are in the application to pull the name, then do a look up on the window size.

HotKeySet("{PAUSE}", "TitleSize")

; set default screen size
$Screen_Width = 0
$Screen_Height = 0
$inf = "NO"

;-----------------------------------------------------------------------------------
; Hot Key function
;-----------------------------------------------------------------------------------
func TitleSize()
    $_title = WinGetTitle("")
    $_pos = WinGetClientSize($_title)
    $Screen_Width = $_pos[0]
    $Screen_Height = $_pos[1]
    $info = "YES"
EndFunc

;-----------------------------------------------------------------------------------
; Main Loop.  Just an idle script launched.
;-----------------------------------------------------------------------------------

While (1)
    
  ;if we have an active title and size do something

   if $info = "YES" then 
        Startaction()
   Endif

WEnd

no. i DONT want a set resolution. i want to detect what the user has as their setup.

then i would need to get the information about their window and use some sort of formula to determine what coordinates to check the pixel color at, since the coordinates will vary depending on each screen size and resolution, the problem is coming up with the formula.

Edited by Rraney

Share this post


Link to post
Share on other sites

THIS ONLY WORKS IN FULLSCREEN

Ok if i understand you right, you want to get the color at a certain point, right? Btw if you would tell me/us what you want to do your bot in the end, like does it log you on, we could help you better i think.

So say the point you want to get the color of is 320,500 and your screen resolution is 1280x1024

do:

320/1280=0.25

500/1024=0.48828125

those are your "formula"

Now you get the screen resolution with @DesktopWidth and @DesktopHeight. To find out the color of the pixel disregarding the resolution you do this:

$xofpoint=@DesktopWidth*0.25;we found this number above
$yofpoint=@DesktopHeight*0.48828125;we found this number above
$color = PixelGetColor($xofpoint,$yofpoint)
MsgBox(0,"The decmial color is", $color)
MsgBox(0,"The hex color is", Hex($color, 6))

I hope this helped you, if not be more specific with what you want

BTW, If you would set the resolution, you wouldn't have to deal with that. THats why i told you the switch.

HF

Felix N. (tdlrali)

Share this post


Link to post
Share on other sites

no it would need to work in fullscreen and window. and it doesnt have to get the color of anything, i just thought it would be one possibility.

i just need some sort of trigger that lets me know im at that screen, without having to adjust the users settings. autoit window info tells me nothing.


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

If you do a [CTRL][ALT][DEL] to bring up the task manager, what does it say in the application window for your game?

no it would need to work in fullscreen and window. and it doesnt have to get the color of anything, i just thought it would be one possibility.

i just need some sort of trigger that lets me know im at that screen, without having to adjust the users settings. autoit window info tells me nothing.

Share this post


Link to post
Share on other sites

when it first starts up its diablo II.exe

then the window appears and it changes to game.exe


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

if anyone plays diablo look to see what i mean. i tried looking at the window with "autoit window info" and it provides no information.

i just need something that will let me know when the user is at that screen.

anyone here that plays diablo want to help out?


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

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