BigRedBot / NeverwinterInvokeBot

Neverwinter Invoke Bot
https://github.com/BigRedBot/NeverwinterInvokeBot/blob/master/README.md
19 stars 21 forks source link

BRB, I can't seem to get the script to run... #2

Closed BorisValkov closed 9 years ago

BorisValkov commented 9 years ago

now b4 we get into the coordinate system... I know how that is supposed to work... ie. Screenshot then pick pixel in an image manipulator (drawing program, etc.), get color code and insert in script...

OK, did that... script sits at "Waiting for screen"... and sits... and sits... and blinks... and blinks some more... etc... ;(

PS: why paste the settings into the script? why not use "#include "[path]settings.au3" instead?

BigRedBot commented 9 years ago

The first screen it is waiting for is the character selection screen. If that screen is not detected, it will wait for it forever.

And, I think I will add an #include for the settings file. I also plan to rename the settings file to just: Settings.au3

BorisValkov commented 9 years ago

The first screen it is waiting for is the character selection screen.

I understood that part... ;) What I don't get, is why... I mean I have entered three distinct coordinates, that do not appear on other screens, and it is not picking them up...

let's see if I have the correct parameters to start with...

I play the game on a 4k monitor, invoking is done on a windowed screen with the resolution 1920x1080...

the coordinates I used where from that window screenshot (ALT+Print then saved to a PNG file, loaded into PhotoImpact, from which I then pick the coordinates as well as the color, in hex (displayed bottom left))...

now the million dollar question:

should the screenshots be from full-screen view or from the windowed mode of the game?

BTW: one thing I am totally unclear about is the "Safe LogIn button", where does one find that one?

BigRedBot commented 9 years ago

The coordinates are taken from the full screen location. I suppose I might be able to set it up to take the location from the game window also. Perhaps a simple option that enables this feature as well.

BorisValkov commented 9 years ago

The coordinates are taken from the full screen location.

K... gotta try that one then also... ;)

btw. thnx for the script...

BigRedBot commented 9 years ago

For now it is using the full screen location. Moving the game window would mess this location up at the moment. I might consider adding an option for this in the future. Resizing the window would mess the location up no matter how I got the location of the pixels.

BorisValkov commented 9 years ago

I had asked earlier, probably got overlooked due to editing (on my part), where one would find the "Safe Login Button" ( I am unclear on what is meant by that)...

BigRedBot commented 9 years ago

The safe login button is only shown when your character has logged out while in the middle of zoning.

Try zoning to a new location and in the middle of the process manually end the process for the game. The next time you log into that character it may ask you if you want to use safe login. Take a screen shot of the game window if it does, so that you may get the location of that button.

BigRedBot commented 9 years ago

I have updated the latest version to look for the window's relative pixel location by default. This can be set back to using the old full screen fixed location if required.

In this way the window will be able to be moved, but it will still not be able to be resized.

gomsnothereman commented 9 years ago

I have attempted to set it up for this "relative" pixel location so i can let it play in a tiny screen (running it on a VM after all)

can't seem to even get it to recognize the 1st screen... (i had use your old version and heavily modified it at one time to do more screen "detection" i see you incorporated some of those methods :) )

one thing i am not sure on, is the question of is it using the ENTIRE window (border/title/all) or just the data/image inside the window.. i have tried using both coordinates and still didn't seem to pick up... that changes the coordinates position by quite a bit.. and for all i know it isn't even finding the game window in the first place (the game window does not become "active")

gomsnothereman commented 9 years ago

little bit more.. i see you have a "position" function that should detect a window with the title "Neverwinter" running the script without even having neverwinter open does not throw out an error (like it looks like it should) so i believe my problem is at the very start if not even detecting the window so it can DO a get position on it...

This is in Windows 8.1 if it makes any difference..

BigRedBot commented 9 years ago

Well, I tested the position with the window's Snipping Tool, and it seemed to get the correct location. I am not sure of what differences would be in windows 8. I am using windows 7.

gomsnothereman commented 9 years ago

ughhhhh had a long message here explaining that i thought they Array system was causing the issue, when i suddenly realized i was leaving the 3rd pixel option in there as 0,0,FFFFFF as soon as i removed that.. it detected the screens properly... so looks like it was 100% user error on my part...

Also the first issue i was having with it not detecting the window... it was because it was detecting the window that was open with your script unarchived.. it also started with "neverwinter" as long as that was open it seemed to be picking it up...

Thanks again for all you have done

BigRedBot commented 9 years ago

I have noticed that it seems to pick any window with the same name. I usually don't have any other windows open when I start it though. :)

There may be a more accurate way to detect the window, but I don't currently know of one.

gomsnothereman commented 9 years ago

BTW for anyone wondering the cords DO take into account the ENTIRE window titlebar/border and all.. so using Alt-printscreen (windows command) to get a screen shot of JUST that window seems to work best to find the correct coordinates..

gomsnothereman commented 9 years ago

not sure if i should start a new thread on this.. got it 99.9% working (seems to do GREAT on my Hyper-v running RemoteFX)

however i encountered something ODD!!! for the value that matches AND clicks for the "vault of piety" if you are full of coins.. i had a screen shot of it.. but kept getting hung on a 2nd character.. finally took a screen shot of him and started pasting/undoing the screenshot over the 1st one.. and realized the buttons are just SLIGHTLY different.. no CLUE why! it is like the buttons are 3-4 pixels longer (or shorter) on one version of that window vs the other.. they have the same god/diety even (thought it was the gods name screwing it up at first)

have you encountered this?? i fixed it by using the top 2 rows of pixels for the vault of piety button.. those stayed the same color even if the button(s) were slightly different in length.. if you want i can send you screen shots (don't want to post them here because of character names, AND i don't want to clip them for fear of getting the exact pixel positioning off)

wonder if this is some attempt to prevent people from doing JUST what we are doing..

BigRedBot commented 9 years ago

Well, I have noticed that some buttons work better if you get the colors from closer to the top of the button because they are sometimes resized if the wording inside of them changes.

NumberB commented 9 years ago

I don't know know if anyone else is worried about their window moving around, but if so just edit this little script and run it. It compares what you set to the window and if it's the same it tells you, and if not it sets it to your setting.

To easily get your window size you can open up "AutoIT Window Info" and drag the cursor crosshairs over the application, then look down in the "window" section for position & size.

You should only need to edit the Xpos/Ypos line.

; Set Neverwinter window size - for Neverwinter Invoke Bot
; By: NumberB

Local $WinTitle = "Neverwinter"

; Desktop Window Size & Position
Local $Xpos = 242, $Ypos = 0, $WinWidth = 1680, $WinHeight = 1040

; Check for window, then check it's current size
$ClientInfo = WinGetPos($WinTitle)
If @error = 1 Then
   Error($WinTitle & " window not found!")
EndIf

If $Xpos = $ClientInfo[0] and $Ypos = $ClientInfo[1] and $WinWidth = $ClientInfo[2] and $WinHeight = $ClientInfo[3] Then
   MsgBox ( 0, "Resize Script", "Window size looks good, nothing has changed!", 8 )
Else
   WinActivate($WinTitle)
   WinMove ( $WinTitle, "", $Xpos, $Ypos, $WinWidth, $WinHeight)
   MsgBox ( 64, "Resize Script", "Window size changed!", 8 )
EndIf
BigRedBot commented 9 years ago

Alright, so it resets the size of the window to what you configured it to work with.

I may add an option to the script itself to check window size to make sure that it is always at the correct width and height, but only if the desired width and height is manually specified in the settings file. I could also have the "Screen Detection.au3" script give the current window position information.

BigRedBot commented 9 years ago

Using image searching for most detection now. Will now also resize the window for you.