Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Tron, in game 8way to 4way - WORKING! 100%  (Read 23251 times)

0 Members and 1 Guest are viewing this topic.

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Tron, in game 8way to 4way - WORKING! 100%
« on: January 19, 2012, 10:14:45 pm »
Okay, so I'm trying to tackle the light bike diagonal issue in Tron.  My setup is a GGG Omni2 hooked to a servo controlled via DaOld Man's uber awesome JoyChoose Plugin.  Tron is of course an 8 way with a specialty restrictor.  As I don't have a dedicated stick (I'm using a wireless triggerstick hot-swap mod) I don't have that funky 8way but really a 4 way restrictor.  

What I want:  When I go into lightbikes I want the servo to clock over to 4way so I can stop getting ---my bottom--- handed to me.  

The way I think I can solve the issue now:  Run a batch on Tron start-up that initiates an AHK script that will call my batch for moving to 4way on a certain button press.  Another Script will run the 8way on a different button press once I'm done owning those dastardly yellow bikers.

Why I don't like this solution:  Press a button?  Seriously, there has gotta be a more elegant (read idiot proof) way.

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, like a call from MAME on that stage entry and then we could just route that call to my servo batch files.  

Is this possible, is there a better way I'm not thinking of, am I stuck having to press a button?  Will my press a button solution work?  Has anyone else cracked this nut?
« Last Edit: January 30, 2012, 07:05:43 pm by Le Chuck »

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4419
  • Last login:Yesterday at 12:13:19 am
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: Tron, in game 8way to 4way
« Reply #1 on: January 19, 2012, 11:02:09 pm »
the best way of course is using the TROn Stick or that special restrictor (if one exist).

If you want to push a button to activate it to be 4-way,  this works specially if you have 2 joysticks (1 8-way, 1 4-way). Just have both stick be configured for that game and when light cycles is choosen, just grab the other joy that is set to 4-way :)


I have not seen a HACK where they actually change the way TRON GAME works. So when Light Cycles is chossen, it trigger a realy switch to activate yto 4-way then back. So I say, IMPOSSIBLE but nice to dream about its existance (if there is).
Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #2 on: January 20, 2012, 01:03:14 am »
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

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

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:

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: Tron, in game 8way to 4way
« Reply #3 on: January 20, 2012, 01:14:19 am »
I know this won't help the OP since he is using an 8-way, but wanted to point out that Tron works just about perfectly with an analog stick + MAME's joystick mapping function + a custom Tron map that makes it harder to hit diagonals, just like the real game.

See this thread for more info:
http://forum.arcadecontrols.com/index.php?topic=99988.0

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #4 on: January 20, 2012, 10:43:33 am »
Thanks Nitz, I'll for sure dig in and see what I can come up with.  I think the lightbike boarder wall is consistent from stage to stage but I'll play with it this weekend.  I will need to run two scripts so I can have it for verticle and horizontal screen orientations.  I'll post up once I've got it going or have hit a wall and need more help.

Hoopz

  • Don't brand me a troublemaker!
  • Trade Count: (+8)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5285
  • Last login:June 13, 2025, 09:18:32 pm
  • Intellivision Rocks!
Re: Tron, in game 8way to 4way
« Reply #5 on: January 20, 2012, 11:08:23 am »
have hit a wall
Intentional pun there?  ;D

rockyrocket

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 372
  • Last login:January 01, 2019, 02:13:03 pm
Re: Tron, in game 8way to 4way
« Reply #6 on: January 22, 2012, 05:17:43 am »
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

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

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:
Now that is genius, who knew AHK could do that!.

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4419
  • Last login:Yesterday at 12:13:19 am
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: Tron, in game 8way to 4way
« Reply #7 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.
Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #8 on: January 22, 2012, 02:57:29 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.

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

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #9 on: January 22, 2012, 03:09:16 pm »
Now that is genius, who knew AHK could do that!.

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.

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. 

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
}
}

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
}

}

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.

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #10 on: January 22, 2012, 03:23:40 pm »
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

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #11 on: January 22, 2012, 04:03:23 pm »
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}

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

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #12 on: January 22, 2012, 04:40:41 pm »
 :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

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 818
  • Last login:July 06, 2022, 09:22:13 am
  • Your arcade games will be assimilated!
Re: Tron, in game 8way to 4way
« Reply #13 on: January 22, 2012, 05:24:31 pm »
I look forward to seeing how this goes as I also would like to use this method in Tron.  :applaud:

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #14 on: January 22, 2012, 06:05:57 pm »
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.

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #15 on: January 22, 2012, 06:11:17 pm »
I can always have it call a tskill batch if necessary. 

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #16 on: January 23, 2012, 10:46:46 pm »
Captured the images that I'll need.  I'll get them cropped down and start experimenting.  Should be pretty straight forward.


I'll use a portion the lightbike field wall for activate 4 way


Pieces of T in TRON and G in Game Over will both key back to 8 way

The only downside is that the servo will be called after every level.  If it's already in 8 way it will just buzz for a second and turn itself off but still. 

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #17 on: January 24, 2012, 01:17:32 am »
Hmm, am I missing something? I'm not sure why it would run after every level. Once it changes back to 8-way, the script should just stay in this loop:

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

until it sees lightBikeBegin.bmp again.

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #18 on: January 24, 2012, 08:27:59 am »
Hmm, am I missing something? I'm not sure why it would run after every level. Once it changes back to 8-way, the script should just stay in this loop:

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

until it sees lightBikeBegin.bmp again.

GENIUS!

joe35car

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:July 17, 2025, 11:43:10 pm
Re: Tron, in game 8way to 4way
« Reply #19 on: January 24, 2012, 09:05:47 pm »
the best way of course is using the TROn Stick or that special restrictor (if one exist).

If you want to push a button to activate it to be 4-way,  this works specially if you have 2 joysticks (1 8-way, 1 4-way). Just have both stick be configured for that game and when light cycles is choosen, just grab the other joy that is set to 4-way :)


I have not seen a HACK where they actually change the way TRON GAME works. So when Light Cycles is chossen, it trigger a realy switch to activate yto 4-way then back. So I say, IMPOSSIBLE but nice to dream about its existance (if there is).



I just ordered one from the guy he has 3 left if you have a Happs H.D. stick

http://forum.arcadecontrols.com/index.php?topic=78233.0

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #20 on: January 24, 2012, 09:34:17 pm »
the best way of course is using the TROn Stick or that special restrictor (if one exist).

If you want to push a button to activate it to be 4-way,  this works specially if you have 2 joysticks (1 8-way, 1 4-way). Just have both stick be configured for that game and when light cycles is choosen, just grab the other joy that is set to 4-way :)


I have not seen a HACK where they actually change the way TRON GAME works. So when Light Cycles is chossen, it trigger a realy switch to activate yto 4-way then back. So I say, IMPOSSIBLE but nice to dream about its existance (if there is).



I just ordered one from the guy he has 3 left if you have a Happs H.D. stick

http://forum.arcadecontrols.com/index.php?topic=78233.0

Appreciate the link but I'm sticking with a software solution.  I'm all about ---smurfing--- impossible in the ---uvula---

joe35car

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:July 17, 2025, 11:43:10 pm
Re: Tron, in game 8way to 4way
« Reply #21 on: January 24, 2012, 09:36:22 pm »
No problem let me know how the software works and I will give it a try also.  ;D

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #22 on: January 25, 2012, 01:36:56 am »
I'm all about ---smurfing--- impossible in the ---uvula---

Heh, me too, I love coming up with stuff like this. Can't wait to see how this works out for you. :applaud:

yotsuya

  • Trade Count: (+21)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19960
  • Last login:July 17, 2025, 10:00:30 pm
  • 2014 UCA Winner, 2014, 2015, 2016 ZapCon Winner
    • forum.arcadecontrols.com/index.php/topic,137636.msg1420628.html
Re: Tron, in game 8way to 4way
« Reply #23 on: January 25, 2012, 09:18:22 am »
I have to give kudos to nitz and you, Le Chuck. I thought you were on a fool's errand at first, but you made it happen.  :applaud:
***Build what you dig, bro. Build what you dig.***

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #24 on: January 29, 2012, 09:35:24 pm »
I am stuck on getting the script to find the images in TRON.  I cropped the .png screenshots down to super small but unique images for each screen and saved as .bmp then ran the script for each image on the corresponding screen and each returned "image not found" so when that didn't work I made larger ones, like the entire word TRON, and still no dice.  I don't think its my images, I'm hoping it's the script and I've done something retarded.  I wouldn't think the conversion from png to bmp would alter the image to a point where it wasn't recognized by the script. (I changed them because all the examples here and over on AHK forums are all .bmps).  Any ideas?

Code: [Select]

F1::
ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, c:\arcade\tronswitch\endlightbike.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}

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #25 on: January 29, 2012, 10:11:43 pm »
PNGs converted to BMPs won't work. The image must match what's on the screen EXACTLY, and png is a compressed format and thus does not quite match.

Now you could try the variation parameter, that is putting *n in imagesearch's options, where n is a number between 0 and 255 which represents the allowed shades of variation in intensity for each pixel's color. This tends to work well if the image is brighter/dimmer or slightly "off", like if you messed with some of the color settings in mame. It may or may not work for a compressed format. However, even if it does work, I don't recommend that option except in cases where it's absolutely necessary, because of the chance of getting false positives.

Your best option is to load up Tron and take a screenshot of the image you need by pressing the print screen key when it shows up. Then open MS Paint (or photoshop or whatever) and paste the image in, then cut out the portion you need, and save it as a bmp. This should match exactly and you should be good to go. :cheers:

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #26 on: January 29, 2012, 10:42:35 pm »
I'll give that a shot now, I had been using MAME screenshots but I just noticed that they are reduced size from the actual so that's a no-go so I tried resizing to the correct resolution and of course that didn't work either.  Off to press print screen and try to get this off the ground. 

yotsuya

  • Trade Count: (+21)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19960
  • Last login:July 17, 2025, 10:00:30 pm
  • 2014 UCA Winner, 2014, 2015, 2016 ZapCon Winner
    • forum.arcadecontrols.com/index.php/topic,137636.msg1420628.html
Re: Tron, in game 8way to 4way
« Reply #27 on: January 29, 2012, 10:51:12 pm »
Nitz-

 :notworthy:
***Build what you dig, bro. Build what you dig.***

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #28 on: January 30, 2012, 12:09:36 am »
Have my values now. 

Nitz - I'm going to start a quasi religion with you as a deity.

That said, I'm still Forrest Gumping my way through this and need some help.  Again.  Because I'm dumb.


This is the error that I am getting.  Is it syntax?  Because the file is right there.

Here's the script:

Code: [Select]
Loop
{

run c:\arcade\tronswitch\ 8way.bat

Loop
{
ImageSearch,,, 223, 94, 252, 130, c:\arcade\tronswitch\startlightbike.bmp
If (ErrorLevel = 0)
{
break
}
}

run c:\arcade\tronswitch\ 4way.bat

Loop
{
ImageSearch,,, 304, 107, 350, 150, c:\arcade\tronswitch\endlightbike.bmp
If (ErrorLevel = 0)
{
break
}
ImageSearch,,, 334, 142, 510, 175, c:\arcade\tronswitch\gameover.bmp
If (ErrorLevel = 0)
{
break
}

}

}

$esc::
send {esc}
exitapp

If it would be easier to just insert the contents of my batch file that's fine too, and is as follows:

Code: [Select]

usccmd --servo 0,4000
sleep 1
usccmd --servo 0,0

Thanks for all your help thus far, I'm sure I'll be back at your feet a few more times. 




nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way
« Reply #29 on: January 30, 2012, 01:01:29 am »
I have a feeling you need to change this

Quote
run c:\arcade\tronswitch\ 8way.bat

to this

Quote
run c:\arcade\tronswitch\8way.bat

and probably do the same with c:\arcade\tronswitch\ 4way.bat as well. :)

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way
« Reply #30 on: January 30, 2012, 06:11:28 pm »
I have a feeling you need to change this

Quote
run c:\arcade\tronswitch\ 8way.bat

to this

Quote
run c:\arcade\tronswitch\8way.bat

and probably do the same with c:\arcade\tronswitch\ 4way.bat as well. :)

Either
you're a genius or <and> I'm retarded.  Thanks man that did the trick!

So I have the script running, start up a game of Tron, find the lightbike stage and within a fraction of a second the servo trips and I'm in 4 way... but at the same time MAME loses focus when the script runs. I will go fiddle with trying to get my batch file to run minimized or in the background as I'm pretty sure its the batch that's stealing focus and not the AHK script calling it... but what do I know, this thread has clearly demonstrated my ineptitude a few times already  ;D

Either way, Nitz - you've dragged me 100% of the way on this experiment and I will be singing your praises from here on out.  You rock man!

Do you think it would be easier to just make a second AHK script for vertical orientation or can it be built into this current script?  What I mean to say is if left to my own devices I'd just go through the same steps and make a second one but if there is a way to neatly do both in one without bogging anything down that'd be cool.

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #31 on: January 30, 2012, 07:14:43 pm »
Okay, went and pulled a simple script off google and now everything is running beyond awesome.  Go into lightbikes and presto 4 way, die and whammo 8 way, reenter lightbikes and zowie 4 way, die again and game over bam 8 way.  It all works, flawlessly with no flicker or weird slow down or anything.  So what did we change?

Wrote this script to run the servo batch invisibly: (read wrote as copy and pasted changing the parameters to suit my batch)
Code: [Select]
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\arcade\tronswitch\4way.bat" & Chr(34), 0
Set WshShell = Nothing

and modified the AHK script to call those rather than the bats.  
Here's the script:

Code: [Select]
Loop
{

run c:\arcade\tronswitch\8way.vbs

Loop
{
ImageSearch,,, 223, 94, 252, 130, c:\arcade\tronswitch\startlightbike.bmp
If (ErrorLevel = 0)
{
break
}
}

run c:\arcade\tronswitch\4way.vbs

Loop
{
ImageSearch,,, 304, 107, 360, 165, c:\arcade\tronswitch\endlightbike.bmp
If (ErrorLevel = 0)
{
break
}
ImageSearch,,, 334, 142, 510, 175, c:\arcade\tronswitch\gameover.bmp
If (ErrorLevel = 0)
{
break
}

}

}

$esc::
send {esc}
exitapp

This is a super awesome mod for Darkade.  This was my trigger to get fresh pics and a video made so I'll get to that this week.  I'll also distill this thread and get it as a tutorial on my build thread.  Thank you NITZ!   :notworthy:
« Last Edit: January 30, 2012, 07:17:54 pm by Le Chuck »

SammyWI

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 457
  • Last login:August 16, 2022, 07:58:00 pm
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #32 on: January 30, 2012, 07:26:27 pm »
 :applaud:  Look forward to the vids.l

DaveMMR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3244
  • Last login:April 28, 2025, 11:33:13 am
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #33 on: January 30, 2012, 07:34:42 pm »
I avoid Tron for precisely these reasons (you want a spinner AND a trigger stick?! and it has to be 8 AND 4 way restricted?!) but man, reading this thread has gotten me jazzed up about the versatility of the automatic servo you have there.  It's quite amazing. I hope you, Nitz and darthpaul (he wrote this tutorial) can document this on the wiki or something, because you've got me itching to do this on my still-being-planned bartop (particularly since I'm having trouble fitting a dedicated 4-way in the small panel.)  

Simply awesome!  :applaud: You're all  :burgerking:!

(P.S. - I still think Tron is a great game - don't hurt me.)

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #34 on: January 30, 2012, 08:00:11 pm »
Dave, this is totally the way to go, combine this mod with my wireless hotswap trigger stick and nobody will ever suspect you're rocking a frankenpanel in your bartop.  

Nitz - One other niggling issue, I notice that the script for mapping the coords to the images only provides the top left XY and not the bottom right XY.  I tried flipping the values but I'm not doing something right as it started tossing errors.  Anyway to get that script to spit out all four values?  Not a huge issue, I got around it by noting the approximate position when I was cropping in MS Paint but would like to tie off all the loose threads so to speak.
 
« Last Edit: January 31, 2012, 12:04:52 am by Le Chuck »

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #35 on: January 30, 2012, 08:59:28 pm »
Okay, went and pulled a simple script off google and now everything is running beyond awesome.  Go into lightbikes and presto 4 way, die and whammo 8 way, reenter lightbikes and zowie 4 way, die again and game over bam 8 way.  It all works, flawlessly with no flicker or weird slow down or anything.
:applaud: :cheers: Very cool, glad I could help!

Do you think it would be easier to just make a second AHK script for vertical orientation or can it be built into this current script?  What I mean to say is if left to my own devices I'd just go through the same steps and make a second one but if there is a way to neatly do both in one without bogging anything down that'd be cool.

If you name the vertical versions of the images vert_startlightbike.bmp, vert_endlightbike.bmp, and vert_gameover.bmp you could give this a try

Quote
Loop
{

run c:\arcade\tronswitch\8way.vbs

Loop
{
ImageSearch,,, 223, 94, 252, 130, c:\arcade\tronswitch\startlightbike.bmp
If (ErrorLevel = 0)
{
break
}

ImageSearch,,, 223, 94, 252, 130, c:\arcade\tronswitch\vert_startlightbike.bmp
If (ErrorLevel = 0)
{
break
}

}

run c:\arcade\tronswitch\4way.vbs

Loop
{
ImageSearch,,, 304, 107, 360, 165, c:\arcade\tronswitch\endlightbike.bmp
If (ErrorLevel = 0)
{
break
}
ImageSearch,,, 334, 142, 510, 175, c:\arcade\tronswitch\gameover.bmp
If (ErrorLevel = 0)
{
break
}

ImageSearch,,, 304, 107, 360, 165, c:\arcade\tronswitch\vert_endlightbike.bmp
If (ErrorLevel = 0)
{
break
}
ImageSearch,,, 334, 142, 510, 175, c:\arcade\tronswitch\vert_gameover.bmp
If (ErrorLevel = 0)
{
break
}

}

}

$esc::
send {esc}
exitapp

I don't *think* there would be any slowdown/weirdness with this, but if there is you could just do a separate vertical script.

Nitz - One other niggling issue, I notice that the script for mapping the coords to the images only provides the top left XY and not the bottom right XY.  I tried flipping the values but I'm not doing something right as it started tossing errors.  Anyway to get that script to spit out all four values?  Not a huge issue, I got around it by noting the approximate position when I was cropping in MS Paint but would like to tie off all the loose threads so to speak.

Give this a try, being sure to replace both instances of image.bmp with the name of the image you're searching for. I don't take credit for this, it borrows a function I found here: http://www.autohotkey.com/forum/topic68539.html&highlight=picture+size

Also, it is untested, but should work.

Quote
F1::

result := ImageWxH("image.bmp")

StringSplit, array, result, x

ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, image.bmp
If (ErrorLevel = 0)
{
bottomRightX := array1 + OutputVarX
bottomRightY := array2 + OutputVarY

FileAppend, The top left x coordinate of the image is %OutputVarX%`nThe top left y coordinate of the image is %OutputVarY%`nThe bottom right x coordinate of the image is %bottomRightX%`nThe bottom right y coordinate of the image is %bottomRightY%`n, coords.txt
}
If (ErrorLevel != 0)
{
FileAppend, The image was not found.`n, coords.txt
}

send {esc}
exitapp

ImageWxH(ImageFile) {
;Supports only GIF, JPG, BMP
IfNotExist, %ImageFile%
  Return ""
Size=2592
DHW:=A_DetectHiddenWindows
DetectHiddenWindows, ON
Gui, 99:-Caption
Gui, 99:Margin, 0, 0
Gui, 99:Show,Hide w%Size% h%Size%, ImageWxH.Temporary.GUI
Gui, 99:Add, Picture, x0 y0 , % ImageFile
Gui, 99:Show,AutoSize Hide, ImageWxH.Temporary.GUI
WinGetPos, , ,w,h, ImageWxH.Temporary.GUI
Gui, 99:Destroy
DetectHiddenWindows, %DHW%
Return w "x" h

 :cheers:

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #36 on: January 30, 2012, 09:07:55 pm »
You are a scholar and a gentleman.  I'm building a wiki entry now. 

rockyrocket

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 372
  • Last login:January 01, 2019, 02:13:03 pm
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #37 on: January 31, 2012, 04:26:26 am »
Excellent work!, I just love this kind of solution.

RetroBorg

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 818
  • Last login:July 06, 2022, 09:22:13 am
  • Your arcade games will be assimilated!
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #38 on: January 31, 2012, 07:11:35 pm »
Awesome! :applaud:

Gray_Area

  • -Banned-
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3363
  • Last login:June 23, 2013, 06:52:30 pm
  • -Banned-
Re: Tron, in game 8way to 4way - WORKING! 100%
« Reply #39 on: February 03, 2012, 09:43:10 pm »
Couldn't you have used DaOldMan's Mrotate for this?
-Banned-