Main > Main Forum

Tron, in game 8way to 4way - WORKING! 100%

Pages: << < (3/12) > >>

Le Chuck:

Nitz, I'll be getting the screen shots I'm using here soon... From there I just need to crop them down to a small unique trait or do I leave the image size alone but white out or delete everything that I don't want?

I think that this will work out pretty well once i get the trick of it so to speak.  I wonder if there are any other in game applications that this would be beneficial for?

nitz:

Crop them down to a small unique trait. Then you'll want to figure out more or less where that is on the screen, so that you know where imagesearch should search.

One way to find out exactly where it is, is to make a script like this


--- Quote ---F1::
ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, image.bmp
If (ErrorLevel = 0)
{
FileAppend, The x coordinate of the image is %OutputVarX%`nThe y coordinate of the image is %OutputVarY%`n, coords.txt
}
If (ErrorLevel != 0)
{
FileAppend, The image was not found.`n, coords.txt
}

send {esc}

--- End quote ---

Where image.bmp is whatever image you're trying to find. This script also assumes you use escape to exit mame, change that if you use something else. Make sure you have the pause brightness in mame set to 1 so that the screen doesn't dim when you pause. Load up tron, get to the point of whatever image you are trying to search for, pause the game, and hit F1. After a few seconds, mame should exit and you will have a file named coords.txt in the same directory as the script that will tell you where on the screen that image appears. Repeat as needed for each image you're trying to find.

This tells you the coordintates of the upper left pixel of the image. I usually subtract 5 from both the x and y, and use that as the upper left corner of the search area, and then just make sure the lower right corner is at a place where the entire image will be in range - this depends on the size of your image. It's generally ok to go slightly overboard, you just don't want to be searching the entire screen for the image since it really slows things down and is not necessary.

This will work. :cheers:

Le Chuck:

 :notworthy:  My mind has just been blown!  I'll get it up and working then finally get around to posting some new pics and video of how it all comes together.  You are da  :burgerking:

RetroBorg:

I look forward to seeing how this goes as I also would like to use this method in Tron.  :applaud:

nitz:

One thing I forgot to mention about the last script I posted: I'm not sure that mame will exit on its own since mame doesn't normally accept keypresses from a program, although I think straight-up hotkeys work. This is sort of like a hotkey as you have to press F1 for anything to happen, but not sure if it will work or not and don't have a mame install handy to test. If mame doesn't exit on it's own after 10 seconds or so, it's not going to and you'll just need to exit manually.

Pages: << < (3/12) > >>

Go to full version