Sign in to follow this  
Followers 0
Rauchster

Something's wrong here

2 posts in this topic

Script to automate pinball - All values for pixel checks do correspond, I double checked.

But only the launcher works, I can't get the flippers working...

Any ideas?

Run ("C:\Program Files\Windows NT\Pinball\PINBALL.EXE")

WinWaitActive ("3D Pinball for Windows")

Send ("{F2}")

Do

$GameStartMessage = PixelGetColor (686, 518)

Until $GameStartMessage = 2629720

Sleep (2500)

Send ("{SPACE down}")

Sleep (500)

Send ("{SPACE up}")

Func Z1()

Do

$FlipperZArea1 = PixelGetColor (381, 567)

Until $FlipperZArea1 <> 6834308

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z1")

EndFunc

Func Z2()

Do

$FlipperZArea2 = PixelGetColor (355, 548)

Until $FlipperZArea1 <> 1579064

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z2")

EndFunc

Func Z3()

Do

$FlipperZArea3 = PixelGetColor (374, 538)

Until $FlipperZArea1 <> 7362700

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z3")

EndFunc

Func Z4()

Do

$FlipperZArea3 = PixelGetColor (370, 561)

Until $FlipperZArea1 <> 6834308

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z4")

EndFunc

Func Z5()

Do

$FlipperZArea3 = PixelGetColor (372, 556)

Until $FlipperZArea1 <> 5251152

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z5")

EndFunc

Func Z6()

Do

$FlipperZArea3 = PixelGetColor (365, 550)

Until $FlipperZArea1 <> 5783724

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z6")

EndFunc

Func Z7()

Do

$FlipperZArea3 = PixelGetColor (364, 546)

Until $FlipperZArea1 <> 4731020

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z7")

EndFunc

Func Z8()

Do

$FlipperZArea3 = PixelGetColor (379, 558)

Until $FlipperZArea1 <> 6834308

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z8")

EndFunc

Func Z9()

Do

$FlipperZArea3 = PixelGetColor (373, 541)

Until $FlipperZArea1 <> 6834308

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z9")

EndFunc

Func Z10()

Do

$FlipperZArea3 = PixelGetColor (357, 543)

Until $FlipperZArea1 <> 4731020

Send ("{z down}")

Sleep (50)

Send ("{z up}")

Sleep (100)

Call ("Z10")

EndFunc

Func Slash1()

Do

$FlipperSlashArea1 = PixelGetColor (411, 564)

Until $FlipperZArea1 <> 6834308

Send ("{/ down}")

Sleep (50)

Send ("{/ up}")

Sleep (100)

Call ("Slash1")

EndFunc

Func Slash2()

Do

$FlipperSlashArea2 = PixelGetColor (417, 537)

Until $FlipperZArea1 <> 6307960

Send ("{/ down}")

Sleep (50)

Send ("{/ up}")

Sleep (100)

Call ("Slash2")

EndFunc

Func Slash3()

Do

$FlipperSlashArea3 = PixelGetColor (431, 544)

Until $FlipperZArea1 <> 4731020

Send ("{/ down}")

Sleep (50)

Send ("{/ up}")

Sleep (100)

Call ("Slash3")

EndFunc

Func NewBall()

Do

$NewBall = PixelGetColor (536, 549)

Until $NewBall = 13946060

Sleep (5000)

Send ("{SPACE down}")

Sleep (850)

Send ("{SPACE up}")

Call ("NewBall")

EndFunc

While 1 = 1

Call ("NewBall")

Call ("Z1")

Call ("Z2")

Call ("Z3")

Call ("Z4")

Call ("Z5")

Call ("Z6")

Call ("Z7")

Call ("Z8")

Call ("Z9")

Call ("Z10")

Call ("Slash1")

Call ("Slash2")

Call ("Slash3")

WEnd

Exit

Share this post


Link to post
Share on other sites



Looks like a lot of checking for 1 ball, 1 plunger and 2 flippers. I made a small variation to autoplay pinball.

This is in window mode and checks for the white on top of the ball.

Opt('SendKeyDownDelay', 200)
Opt('PixelCoordMode', 2)
Opt('MouseCoordMode', 2)
If Not WinExists("3D Pinball for Windows") Then
    Run(@ProgramFilesDir & "\Windows NT\Pinball\PINBALL.EXE")
EndIf
WinActivate("3D Pinball for Windows")
WinWaitActive("3D Pinball for Windows")
Send("{F2}")
Sleep(3000)
$color = 0xFFFFFF

While 1
    If WinActive("3D Pinball for Windows") Then
        Send("{SPACE down}")
        Sleep(1000)
        Send("{SPACE up}")
        ExitLoop
    Else
        WinActivate("3D Pinball for Windows")
        Sleep(1000)
    EndIf
WEnd

Do
    Sleep(100)
    PixelSearch(130, 370, 160, 390, $color)
    If Not @error Then
        If WinActive("3D Pinball for Windows") Then
            Send('z')
            Sleep(1000)
        EndIf
    EndIf
    PixelSearch(190, 370, 240, 390, $color)
    If Not @error Then
        If WinActive("3D Pinball for Windows") Then
            Send('/')
            Sleep(1000)
        EndIf
    EndIf
Until Not WinActive("3D Pinball for Windows")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0