Main > Main Forum
Tron, in game 8way to 4way - WORKING! 100%
nitz:
--- Quote from: Le Chuck 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.
--- End quote ---
:applaud: :cheers: Very cool, glad I could help!
--- Quote from: Le Chuck on January 30, 2012, 06:11:28 pm ---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.
--- End quote ---
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
--- End quote ---
I don't *think* there would be any slowdown/weirdness with this, but if there is you could just do a separate vertical script.
--- Quote from: Le Chuck on January 30, 2012, 08:00:11 pm ---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.
--- End quote ---
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
--- End quote ---
:cheers:
Le Chuck:
You are a scholar and a gentleman. I'm building a wiki entry now.
rockyrocket:
Excellent work!, I just love this kind of solution.
RetroBorg:
Awesome! :applaud:
Gray_Area:
Couldn't you have used DaOldMan's Mrotate for this?