Sign in to follow this  
Followers 0
Simucal

Help with Pangya Golf Game Script

15 posts in this topic

#1 ·  Posted (edited)

I am currently playing a game called, Albatross18. www.albatross18.com

It is a Japanese made, golfing MMO. That may sound strange, but considering it is free... and new courses, items, etc are being added every day it is worth checking out.

Here is where I need help:

In a golf swing you have a power meter like this:

Posted Image

You hit the space bar to start the bar on the meter moving to the right. Once it reaches your desired distance you hit space bar again, and it will start coming back to the left. The tricky part, is you want it to stop at the exact spot coming back down, otherwise your accuracy is shot all to hell. This exact spot I am trying to reach is called the "Pangya" spot.

What I am interested in doing with AutoItv3 is detecting when the bar that moves on the meter gets to the perfect stop point, and then have it hit space bar for me. This way, I will hit my distance perfectly each time.

Here is the bar that moves across the meter:

Posted Image

The exact point I would like the bar to stop at is as follows:

Posted Image

The shot cannot be timed with a conventional macro because different clubs/terrain result in the bar moving at different speeds.

What I was thinking I could have a script do is once I hit, say the F1 key.. it would constantly check as fast as it could for a pixel on the screen to turn black. The black pixel will be the top part of the bar that moves across.

Posted Image

I would be checking for Pixel #1 to turn black, since it is the left-most pixel of the moving bar, it will be the first to get into the correct position for me to hit the space bar.

The coordinates for the pixel that I wish to detect when it turns black are: 134, 702

Posted Image

So, as a quick recap of what I was looking to be able to do is:

1. I'll manually hit SPACE to start the shot.

2. I will then manually hit SPACE again to stop the bar at the correct power level that I desire.

3. Then the bar will being moving back down to the left. I would like to hit a hotkey to activate a AutoItv3 script which will be checking the coordinates 134, 702 in a loop to see if its value is black.

4. Once the value equals black the script would simply hit SPACE bar for me and then the script will exit. This will ensure I get "Pangya" hits (100% accuracy) each time.

If ANYONE more skilled than I could help me out with this, it would be GREATLY appreciated. I've tried to make everything as clear as possible but if there are any questions feel free to ask me. Thanks again.. this community is terrific!

Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites



Here's attempt at how I interpreted your thread request:

Opt("PixelCoordMode", 0); did you set coords up with window coords?  If not, you'll need to change the "0" to 1 or 2 (check help under "Opt" to explain)
Opt("MouseCoordMode", 0); same as above
Opt("SendKeyDelay", 1)

HotKeySet("{Space}", "Start_Golf")
Dim $Reset = 0
While 1
    Sleep(100)
    While $Reset <> 0
    If PixelGetColor(134, 702) == 0x000000 Then Send("{SPACE}"); replace 0x000000 with the actual colour using AutoInfo Tool
;Sleep(10); if it takes a long time, you might consider a sleep
    WEnd
WEnd

Func Start_Golf()
    If $Reset = 0 Then
        $Reset = 1
        Return $Reset
    Else
        $Reset = 0
        Return $Reset
    EndIf
EndFunc

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

First off, thank you VERY much ron for your help. After looking at what you had written I simply tweaked it as you suggested in your comments.

To start with... I changed the PixelCoordMode and MouseCoordMode to "1". I think this was the right decision because the program runs in full screen at 1024x768. I also got my coords for the pixel I am detecting by taking a screenshot while in the program and opening it up in photoshop.

I then added a $Reset = 0 to the If statement so if it did detect the black color it would hit Space only once rather than over and over. After checking the pixel color in a screenshot I took, I confirmed it was 0x000000. The only other thing I changed was I made the hotkey F1, so I would hit space myself in the game, then again to set power... then hit f1 for it to start searching for the black pixel.

However.. It doesnt seem to work while in game and I am at a loss for why. In out of game tests it seems to work... I will open an all black command prompt and hit F1 and I will get a single space.. and if I move the window to the far right and hit F1 I will get no such space. So.. that would imply that it SHOULD work.. however I must of made a mistake. Here is a full screenshot of the game if someone could double check my coordinates for the black pixel.

FULL SCREEN SHOT: http://i13.photobucket.com/albums/a281/sim...gularPangya.jpg

Remember, this is the pixel I am trying to detect:

Posted Image

At first I thought that perhaps the bar is moving too fast for AutoIt to detect.. but I highly doubt this is the case. Because of the width of the moving bar, it has 8 black pixels along its top. So the script has 8 chances to detect the pixel change. It has got to be a different mistake on my part.

Any advice would be great.

Opt("PixelCoordMode", 1)
Opt("MouseCoordMode", 1)
Opt("SendKeyDelay", 1)

HotKeySet("{F1}", "Start_Golf")
Dim $Reset = 0
While 1
    Sleep(100)
    While $Reset <> 0
    If PixelGetColor(134, 702) == 0x000000 Then; replace 0x000000 with the actual colour using AutoInfo Tool
        Send("{SPACE}")
       ;Sleep(10); if it takes a long time, you might consider a sleep
        $Reset = 0
    EndIf
    WEnd
WEnd

Func Start_Golf()
    If $Reset = 0 Then
        $Reset = 1
        Return $Reset
    Else
        $Reset = 0
        Return $Reset
    EndIf
EndFunc

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

Well, I set it up like I did on purpose, because when the program sends "space" it was to reset the $Reset back to "0".

Number 2... Just because your getting pixels from a "full screen" doesn't mean you are getting "screen coords". Look in your AutoInfo tool, under Modes and Coords to see what you coords your actually getting, it will have a check mark next to it, then set the numbers accordingly.

Number 3...

You might want to add a line like this:

If Not WinActive("The 'Title' that AutoInfo Tool Gives you for the game window") Then WinActivate("The 'Title' that AutoInfo Tool Gives you for the game window") , this is to make sure that your pixel search is done on the actual game window itself.

Lastly...

You didn't change the colour (0x000000), which is pure black, seldom will you find this colour. Check the Coords, and what the Colour is under the mouse at the time.

Remember, when getting information from a screen shot, or a saved picture, that AutoInfo will only get proper information from a Bitmap file as of now.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Ah, I see now why you set it up that way with the Space key.

Now for the things you said:

Number 2... Just because your getting pixels from a "full screen" doesn't mean you are getting "screen coords". Look in your AutoInfo tool, under Modes and Coords to see what you coords your actually getting, it will have a check mark next to it, then set the numbers accordingly.

I used the AutoInfo tool and insured that Screen Coords was checked. I confirmed that the coordinates are correct at 134,702.

You might want to add a line like this:

If Not WinActive("The 'Title' that AutoInfo Tool Gives you for the game window") Then WinActivate("The 'Title' that AutoInfo Tool Gives you for the game window") , this is to make sure that your pixel search is done on the actual game window itself.

I've added this to the script. Thank you for pointing this out. However, the problem that it doesnt detect any black pixels remains while in game.

Lastly...

You didn't change the colour (0x000000), which is pure black, seldom will you find this colour. Check the Coords, and what the Colour is under the mouse at the time.

I've checked, and rechecked the color via BMP screenshot use AutoInfo Tool and confirmed the color is in fact 0x000000. I also ran the game in windowed mode and confirmed using the AutoInfo Tool itself of the color.

What else could be going wrong here? Here is the modified code:

Opt("PixelCoordMode", 1); did you set coords up with window coords?  If not, you'll need to change the "0" to 1 or 2 (check help under "Opt" to explain)
Opt("MouseCoordMode", 1); same as above
Opt("SendKeyDelay", 1)

HotKeySet("{F1}", "Start_Golf")
If Not WinActive("<Albatross18>") Then WinActivate("<Albatross18>")
Dim $Reset = 0
While 1
    Sleep(100)
    While $Reset <> 0
    If PixelGetColor(134, 702) == 0x000000 Then; replace 0x000000 with the actual colour using AutoInfo Tool
        Send("{SPACE}")
       ;Sleep(10); if it takes a long time, you might consider a sleep
        $Reset = 0
    EndIf
    WEnd
WEnd

Func Start_Golf()
    If $Reset = 0 Then
        $Reset = 1
        Return $Reset
    Else
        $Reset = 0
        Return $Reset
    EndIf
EndFunc

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

As a new development, I have written a simple script that just sends the SPACE key when I hit F1.. and it works outside of the game but not inside... so the game must have some way of differentiating between the two kinds of input.

Also, I put in a message box to come up when it detects the black pixel. When in the game, it detects black all the time no matter what... but outside, it works as it should. I am begining to think AutoIt might not be able to see the game, much like it cant see a video playing in WMP. I dont understand this though.. because you cant take a screenshot of the WMP movie playing.. but you CAN of the game.

Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

If the color is in fact 0x00000, try to find a more unique one. Also, try using the Window itself. If you using a pictur editor to view the coords, they are probably off.

Use AutoInfo, on the game itself for the location you want to click, and see the coords, I might also suggest you using actual Window or Client coords.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Apparently it has some protection feature that blocks certain API's like SendInput... i'm looking into it. Thanks for the help everyone.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

For any of those interested... especially those people who helped me, I bypassed the game's protection and have since gotten this macro to work.

Albatross18 uses a protection called nProtect. nProtect was hooking into all the APIs I needed to do my macro such as getpixelcolor and sendinput and preventing me from using them while in game. So, I restored all my APIs while nProtect was not running, then used Zone Alarm to restrict nProtects ability to write to my harddrive. Once nProtect couldnt rewrite over my APIs and I could run the game, the macro worked wonderfully.

Honestly, I feel this is an almost controversial protection method. I do not like the fact that my APIs had jumps written into them by nProtect. I dont know how you guys feel.

Thanks again,

-Simucal


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

For any of those interested... especially those people who helped me, I bypassed the game's protection and have since gotten this macro to work.

Albatross18 uses a protection called nProtect. nProtect was hooking into all the APIs I needed to do my macro such as getpixelcolor and sendinput and preventing me from using them while in game. So, I restored all my APIs while nProtect was not running, then used Zone Alarm to restrict nProtects ability to write to my harddrive. Once nProtect couldnt rewrite over my APIs and I could run the game, the macro worked wonderfully.

Honestly, I feel this is an almost controversial protection method. I do not like the fact that my APIs had jumps written into them by nProtect. I dont know how you guys feel.

Thanks again,

-Simucal

I don't understand. What API files should I restore?

Share this post


Link to post
Share on other sites

Hey all, iam realy new to the autoit thing and i was reading threw forums and i found this post, i play albatross and i was hoping to try this but i cannot figure out how u bypassed nprotect, i did a google search and it came back with how its a rootkit.

and sry for the newbie questions but whats a api and what ones do i reset.

thanks in advance Scrappy

(sry for the spelling)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hi guys I'm new to this forum and was lurking around here and there for a bit and decided to finally sign up. I been myself trying to learn to script here and there but barely managed to script some programs for TI-83 programs, really basic stuff. This caught my attention, how does the program actually recognize the input and how does it work internally? Not sure if I'm asking the right question, guess to put it simply, how does this work? Any help would be greatly appreciated for a newbie.

Thanks in advance.

Edited by m3forlife

Share this post


Link to post
Share on other sites

I'm assuming it moves at the same speed each time, could you not just time it and then hit space after a certain number of seconds?

Share this post


Link to post
Share on other sites

That is not true, I tested it and depending on which power you set, the speed coming back is different. Hm, I wonder how Simucal did it.

I so far "sort of," understand what he did and the script that was given to him but to additionally add in a function that would make any key act as a spacebar? Hm..

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Maybe you want to let the script press space when the color of the background changes when the thing goes over it.

So when it get's any different color then what it was it'll press spacebar...

like:

While 1
    Sleep(100)
    While $Reset <> 0
    If PixelGetColor(134, 702) <> 0x000000 Then; replace 0x000000 with the actual color of the back ground using AutoInfo Tool
        Send("{SPACE}")
       ;Sleep(100); if it takes a long time, you might consider a sleep
        $Reset = 0
    EndIf
    WEnd
WEnd

Hope this helps :shocked:

Edited by danner

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