Main > Main Forum

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

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

Hoopz:


--- Quote from: Le Chuck on January 20, 2012, 10:43:33 am ---have hit a wall

--- End quote ---
Intentional pun there?  ;D

rockyrocket:


--- Quote from: nitz on January 20, 2012, 01:03:14 am ---
--- Quote from: Le Chuck on January 19, 2012, 10:14:45 pm ---What I'm thinking:  It would be nice if a program running outside of MAME had a way to tell the lightbike stage apart from other stages

--- End quote ---

You can do this with AHK (I've done something very similar to this) provided the following 3 things are true:

1) There is some portion of the screen that is exactly the same everytime the lightbike stage comes up and is not that way anywhere else in the game.

2) There is some portion of the screen that is exactly the same everytime the lightbike stage is finished.

3) You don't mind doing some work. ;)

Take screen shots using the printscreen key to satisfy both 1 and 2. Use paint to cut out just the part of the image you need - the part that is always the same. Make sure you save them as bitmaps. Let's call them lightBikeBegin.bmp and lightBikeEnd.bmp

Then try this script:


--- Quote ---Loop
{

<run batchfile to switch to 8 way>

Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeBegin.bmp
If (ErrorLevel = 0)
{
break
}
}

<run batchfile to switch to 4 way>

Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeEnd.bmp
If (ErrorLevel = 0)
{
break
}
}

}

$esc::
send {esc}
exitapp

--- End quote ---

If you're not already familiar with imagesearch, see the relevant section in the AHK help file.

Basically this script sets it to 8 way, then the first imagesearch loop waits to see the lightbike part, that loop exits and sets it to 4 way, then the second imagesearch loop waits to see the lightbike part end, then jumps back to the top of the main loop to set to 8 way and start the process again. The esc hotkey allows you to exit mame and the script by pressing escape. Obviously you need to change this if you use something other than escape to exit mame.

A couple of points:

The image on screen must match your bitmap image EXACTLY. So if you fiddle with mame's brightness, try some new scanlines or change your resolution, the script will stop working.

The portion of the screen you search for should be as small as possible. You don't want the script to spend time searching a part of the screen where the image does not appear, because then the image may go away before the script sees it.

This should work for you if you want to take the time to try it out. :cheers:

--- End quote ---
Now that is genius, who knew AHK could do that!.

Thenasty:

what would happen if you're in the LOOP but GAME IS OVER (you're still in 4-way).
Maybe another script that detects it that it's GAME over or when game is exited, it switch it back to 8-way.
( I think it's to much work, and it could be a HIT or MISS).

IMHO, it's probably good if you just have 2 joysticks (4-way, 8-way) both map and when it LIght Cycle time, just grab the 4-way.

Le Chuck:


--- Quote from: Thenasty on January 22, 2012, 02:43:06 pm ---what would happen if you're in the LOOP but GAME IS OVER (you're still in 4-way).
Maybe another script that detects it that it's GAME over or when game is exited, it switch it back to 8-way.
( I think it's to much work, and it could be a HIT or MISS).

IMHO, it's probably good if you just have 2 joysticks (4-way, 8-way) both map and when it LIght Cycle time, just grab the 4-way.

--- End quote ---

When it's game over on lightbikes I can exit the game and Joychoose will take over control of the servo (in other words it already does what you're talking about) or if I want to get ---my bottom--- kicked again I can reenter the game and same deal, everything is copacetic.  There are a lot of good ways to do this, I was setting out to find a solution that worked with my current setup. 

nitz:


--- Quote from: rockyrocket on January 22, 2012, 05:17:43 am ---Now that is genius, who knew AHK could do that!.

--- End quote ---

Yeah, when I first started out with AHK, I was mainly just doing hotkeys and simple little stuff, but I dug a little deeper and found that it's practically become a general purpose language. You can do a ton of stuff in AHK that most people don't realize at first glance. I use it all the time at home and at work, and it has served me well.


--- Quote from: Le Chuck on January 22, 2012, 02:57:29 pm ---When it's game over on lightbikes I can exit the game and Joychoose will take over control of the servo (in other words it already does what you're talking about) or if I want to get ---my bottom--- kicked again I can reenter the game and same deal, everything is copacetic.  There are a lot of good ways to do this, I was setting out to find a solution that worked with my current setup. 

--- End quote ---

If you want to avoid having to exit and restart when it's game over on the lightbikes, try changing this


--- Quote ---Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeEnd.bmp
If (ErrorLevel = 0)
{
break
}
}

--- End quote ---

to this


--- Quote ---Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeEnd.bmp
If (ErrorLevel = 0)
{
break
}
ImageSearch,,, X1, Y1, X2, Y2, gameOver.bmp
If (ErrorLevel = 0)
{
break
}

}

--- End quote ---

where gameOver.bmp is an image from the game over screen. Then it would jump back to the top and change back to 8-way for you to start over again. :)

The only problem is, you are now alternating between two images instead of searching for just one, which could slow things down a bit. However, if your search areas are small and the image appears on the screen for at least a couple seconds, you should be fine.

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

Go to full version