Automatic Game Reset Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Golisuine

Automatic Game Reset  Topic is solved

20 Jun 2018, 01:37

Hello there!

So I'm pretty new to this forum and I'm not sure if I'm writing in the write one or not, but I need help with making a script for this game I'm playing called Pokemon phoenix rising which it's a fan-made Pokemon essentials game with a demo that came out recently. So in the demo their is the part where the scientist tells you to choose a Pokemon and when that happens theirs like this little bubble on the side where it shows the clear image of what the Pokemon looks like on the side. So what I want to do specifically is make some sort of automatic reset when that specific image shows up and the reason why I want to do this is because I want to obtain a "shiny version of that Pokemon, but the problem is that I can't seem to get it to work right, it just skips right over to the naming screen.

So what I'm asking is if you guys can give me any pointers in the right direction to make this possible? I'm pretty new to the whole ahk coding business so forgive me if I do have alot of errors in this script

Here's the script I managed to come up based around another script I found online with a similar concept found online, and some helpful tips from other people:

Code: Select all


#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
^!z::SetTimer, ShinyCheck, 500
Loop
{
ShinyCheck:
{
    IfWinExist, Pokemon Phoenix Rising
    {
    	    WinActivate
    }
    resetcolour = CD8D40
    targetcolour = E9F2F1
    MouseGetPos, MouseX, MouseY
    PixelGetColor, colour, %MouseX%, %MouseY%
    ifEqual, colour, %resetcolour%
    {
    ifEqual, colour, %targetcolour%
    {
	    MsgBox Congrats it is found!
	    Break
    }
    SetTimer, ShinyCheck, off
}
return
And here's what the thing I told you about looks above:

https://cdn.discordapp.com/attachments/ ... nknown.png
Last edited by joedf on 20 Jun 2018, 08:12, edited 2 times in total.
Reason: fix code tags
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Automatic Game Reset

20 Jun 2018, 09:15

Cool game! I'll have to try this when time permits :+1:
Have you tried ImageSearch ?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Golisuine
Posts: 2
Joined: 20 Jun 2018, 01:39

Re: Automatic Game Reset

22 Jun 2018, 03:48

joedf wrote:Cool game! I'll have to try this when time permits :+1:
Have you tried ImageSearch ?
Hi there sorry for the late reply, I've been busy attending to other stuff, but thanks for the reply I really appreciate it! Anyways, when you said how I should try ImageSearch, what do you mean by that exactly?

Forgive me if I sound clueless, but as I said before I'm pretty new to the whole scripting business so their is some commands/words/phrases I'm not familiar with as of yet, so if you may, do you mind elaborating me on what's its about so I can have a better grasp on what your trying to tell me? And as I said again, I appreciate that you took the time to reply to my thread, and the same gratitude will be given if you can help me out with this.
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Automatic Game Reset

22 Jun 2018, 08:12

Yeah! You can look for images on the screen: https://autohotkey.com/docs/commands/ImageSearch.htm
Just make sure to use small images, as this can be rather intensive for the computer.

Example script from the docs :+1:

Code: Select all

ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\test.bmp

CoordMode Pixel  ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *Icon3 %A_ProgramFiles%\SomeApp\SomeApp.exe
if ErrorLevel = 2
    MsgBox Could not conduct the search.
else if ErrorLevel = 1
    MsgBox Icon could not be found on the screen.
else
    MsgBox The icon was found at %FoundX%x%FoundY%.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Golisuine
Posts: 2
Joined: 20 Jun 2018, 01:39

Re: Automatic Game Reset

22 Jun 2018, 08:26

joedf wrote:Yeah! You can look for images on the screen: https://autohotkey.com/docs/commands/ImageSearch.htm
Just make sure to use small images, as this can be rather intensive for the computer.

Example script from the docs :+1:

Code: Select all

ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\test.bmp

CoordMode Pixel  ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *Icon3 %A_ProgramFiles%\SomeApp\SomeApp.exe
if ErrorLevel = 2
    MsgBox Could not conduct the search.
else if ErrorLevel = 1
    MsgBox Icon could not be found on the screen.
else
    MsgBox The icon was found at %FoundX%x%FoundY%.
Oh okay then I think I have a better understand of what I should do now! thanks for the help!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 44 guests