Build Your Own Arcade Controls Forum
Main => Main Forum => Topic started by: Le Chuck 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?
-
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).
-
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:
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:
-
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 (http://forum.arcadecontrols.com/index.php?topic=99988.0)
-
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.
-
have hit a wall
Intentional pun there? ;D
-
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:
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!.
-
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.
-
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.
-
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
Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeEnd.bmp
If (ErrorLevel = 0)
{
break
}
}
to this
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.
-
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?
-
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
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:
-
: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:
-
I look forward to seeing how this goes as I also would like to use this method in Tron. :applaud:
-
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.
-
I can always have it call a tskill batch if necessary.
-
Captured the images that I'll need. I'll get them cropped down and start experimenting. Should be pretty straight forward.
(http://i479.photobucket.com/albums/rr155/vonjett/LightBikes.png)
I'll use a portion the lightbike field wall for activate 4 way
(http://i479.photobucket.com/albums/rr155/vonjett/LevelComplete.png) (http://i479.photobucket.com/albums/rr155/vonjett/GameOver.png)
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.
-
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:
Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeBegin.bmp
If (ErrorLevel = 0)
{
break
}
}
until it sees lightBikeBegin.bmp again.
-
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:
Loop
{
ImageSearch,,, X1, Y1, X2, Y2, lightBikeBegin.bmp
If (ErrorLevel = 0)
{
break
}
}
until it sees lightBikeBegin.bmp again.
GENIUS!
-
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 (http://forum.arcadecontrols.com/index.php?topic=78233.0)
-
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 (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---
-
No problem let me know how the software works and I will give it a try also. ;D
-
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:
-
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:
-
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?
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}
-
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:
-
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.
-
Nitz-
:notworthy:
-
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.
(http://i479.photobucket.com/albums/rr155/vonjett/AHKError.jpg)
This is the error that I am getting. Is it syntax? Because the file is right there.
Here's the script:
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:
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.
-
I have a feeling you need to change this
run c:\arcade\tronswitch\ 8way.bat
to this
run c:\arcade\tronswitch\8way.bat
and probably do the same with c:\arcade\tronswitch\ 4way.bat as well. :)
-
I have a feeling you need to change this
run c:\arcade\tronswitch\ 8way.bat
to this
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.
-
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)
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:
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:
-
:applaud: Look forward to the vids.l
-
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 (http://forum.arcadecontrols.com/index.php?topic=113249.0)) 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.)
-
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.
-
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
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 (http://www.autohotkey.com/forum/topic68539.html&highlight=picture+size)
Also, it is untested, but should work.
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:
-
You are a scholar and a gentleman. I'm building a wiki entry now.
-
Excellent work!, I just love this kind of solution.
-
Awesome! :applaud:
-
Couldn't you have used DaOldMan's Mrotate for this?
-
Couldn't you have used DaOldMan's Mrotate for this?
No, that application, along with DaOldMan's joychoose and controller choose send their commands on execution and closure of the target programs. This application is for switching mid game and selects only on the light cycle stages... or whatever visual cue you set up. I'm currently running Joychoose and this script together. Joychoose sets the 8way for the game and the script does the rest.
-
I seriously have to think about trying this, great job guys.
-
sweet christmas! i'm just now trying to wrap my head around an auto 4/8 and now this. what work, great job guys!
-
Couldn't you have used DaOldMan's Mrotate for this?
No, that application, along with DaOldMan's joychoose and controller choose send their commands on execution and closure of the target programs. This application is for switching mid game and selects only on the light cycle stages...
Oh. Right.
-
sweet christmas! i'm just now trying to wrap my head around an auto 4/8 and now this. what work, great job guys!
All praise goes to Nitz for his awesome script work. This is something that I showed to guests every now and then and they were never impressed. Now I just let them play TRON and listen to them talk about how perfect the gameplay is.
-
Good work guys!
Some pretty neat stuff here!
-
hey le chuck,
since you are up and running with this 100%, would you mind sharing your final ahk scripts that you and nitz figured out? i know there were a few edits and what not. can't wait to try this myself!
T
-
Le Chuck and all other contributors,
I just registered so I could ask you this ;) Have you got these scripts shared somewhere. This must make it to every arcade machine out there. It's amazing!
-
The same concept would allow us to detect when a game is in attract mode... I've been wondering if there would be a way to do that. We'll be able to have different led patterns, messages etc.
-
8x6 - I think it would be easier to key the setting off how long since there was an input from the CP. Kinda like a sleep mode, after 3 minutes have the LED go into attract mode. That's a perfect AHK application. I don't know if this has already been done but it seems to ring a bell. I think it would be easier than recognizing the switch into attract-mode by screen change unless it is always the same first screen.
SLCFoxy & Tony - I need to go in and get the settings off Darkade and get them uploaded here for the final solution to do both 4:3 and 3:4 orientations. I should be able to get that done in the next few days. For now the solution for a single orientation (doesn't matter which) is below and should satisfy the needs of most out there.
Following script allows you to call the servo batch file without stealing focus (necessary for in-game use). Saves as .vbs.
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 the .vbs files rather than the bats.
Here's the script:
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
Just get the screens mentioned earlier in this thread and trim them down to small unique chunks. Before you trim them note their parameters (doable in paint fairly easily) so you can tell the script where to look. I will try and put together a more coherent set of instructions in a bit as this is getting some renewed interest.
If anybody else has tackled this feel free to chime in.
-
The same concept would allow us to detect when a game is in attract mode... I've been wondering if there would be a way to do that. We'll be able to have different led patterns, messages etc.
That would work as long as the attract mode has some image that does not appear in the actual game - otherwise you would get false positives. Another hurdle is the fact that this would be a lot of work if you wanted to do it for a large number of games.
8x6 - I think it would be easier to key the setting off how long since there was an input from the CP. Kinda like a sleep mode, after 3 minutes have the LED go into attract mode. That's a perfect AHK application. I don't know if this has already been done but it seems to ring a bell. I think it would be easier than recognizing the switch into attract-mode by screen change unless it is always the same first screen.
Yep, that would be pretty easy. AHK has a built in variable that keeps track of idle time.
-
Where can I get this script? Like to use it with the new stick from ultimarc.
http://www.ultimarc.com/servostik.html (http://www.ultimarc.com/servostik.html)
-
Where can I get this script? Like to use it with the new stick from ultimarc.
http://www.ultimarc.com/servostik.html (http://www.ultimarc.com/servostik.html)
Please refer to this earlier post: http://forum.arcadecontrols.com/index.php/topic,117395.msg1287582.html#msg1287582 (http://forum.arcadecontrols.com/index.php/topic,117395.msg1287582.html#msg1287582)
That should be everything you need. I don't know what Andy's software looks like to do the switch but if it can be a .bat or .exe then you just need to write a .vbs script around it and point the AHK script at that.
-
Is there a step by step instruction guide on how to make this work?
-
I just read through this thread and my original solution is still best. Don't play Tron.
If this post hasn't helped you at all, click Like (http://internetmarketingadvices.webs.com/Like-button-small-2.png)
-
I just read through this thread and my original solution is still best. Don't play Tron.
If this post hasn't helped you at all, click Like (http://internetmarketingadvices.webs.com/Like-button-small-2.png)
I would have agreed with you a few months ago but I fell back in love with Tron on a recent trip to Denver. I played Tron on 3 different machines while there and am really looking forward to trying this solution once my cabinet is done.
-
Is there a step by step instruction guide on how to make this work?
Nope. There is a lot of information in this thread about how I went about it and the exact code I used. I will eventually get around to making a step by step but first I need to test out calling the servo directly from the AHK script and see if that has a focus issue. If that doesn't it will reduce everything by a step. However, the current solution posted is completely viable and hasn't misfired yet. If you want to cruise through the posts and put together some questions that aren't addressed I'd be happy to answer them and it could only help me out when I go to make a tutorial. What's got you stumped Foxy?
-
I know this thread is(was) dead but it always stuck in my mind as a really cool bit of code and figure some of you would like my usage of it,
Anyway it was either bump this old thread or my own equally dead starwars one so its this one.
So my Implementation is to use this to start a targeting animation ingame in starwars on the second screen, basically it loops one vid then waits for the "T" in tower at the start of the tower sequence then sleeps for a bit then starts the trench run animation.
The timing is a bit hit and miss and its still being tweaked but largely works as wanted, and personally I am super pleased that it works.
I now realize that the revolving trench transition will be a much better trigger and would negate the need for the sleeps but I guess that's for V2 :) .
I did not create any of the animation its a montage of vids all pulled from youtube.
Anyway the code is fairly self explanatory and looks like this..
Loop
{
run C:\Program Files\VideoLAN\VLC\vlc.exe --repeat C:\trench\Radar.mp4
Loop
{
ImageSearch,,, 1204, 95, 1393, 138, c:\trench\T.bmp
If (ErrorLevel = 0)
{
break
}
}
sleep 42000
run C:\Program Files\VideoLAN\VLC\vlc.exe --play-and-stop C:\trench\Trench Run.wmv
sleep 40000
run C:\Program Files\VideoLAN\VLC\vlc.exe --repeat C:\trench\Radar.mp4
}
And a badly played game video to demo this is here..
Mame starwars targeting animation sync via AHK (http://www.youtube.com/watch?v=hS84duI2RIs#ws)
-
This is a fantastic application of this script! :applaud: :applaud:
-
Thanks Le Chuck!
Not sure what youtube is upto with my vid though - it has repeated my 5m vid into a 10m one , I had the same thing happen before and it was magically corrected.
Just wish my gameplay was more like this...
Atari Starwars 1983 Arcade Game...10,000,000+ part 1 (http://www.youtube.com/watch?v=vRBfWvn5zAo#ws)