Jump to content



Photo
- - - - -

ROM Tilt detection help


Best Answer kiwi , 25 February 2021 - 08:48 AM

Taito Space Shuttle light Tilt is 150.

Go to the full post


  • Please log in to reply
33 replies to this topic

#1 zimbakin

zimbakin

    Hobbyist

  • Members
  • PipPip
  • 44 posts

  • Flag: Australia

  • Favorite Pinball: Diner, Eightball Deluxe, T2

Posted 22 February 2021 - 10:53 AM

Wanting to detect a tilt event on a basic ROM table. 

' Nudging
    vpmNudge.TiltSwitch = 30
    vpmNudge.Sensitivity = 3
    vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)


' Solenoid
SolCallback(18) = "vpmNudge.SolGameOn"

When the tilt / vpmNudge.TiltObj array activates, I want to PlaySound "sound" change lighting etc.

I tried calling a sub from SolmodCallback(18), however that didn't work out... not sure how to call vpmNudge.TiltObj ?

 

///maybe I need to add (Byval)?

 


Edited by zimbakin, 22 February 2021 - 11:25 AM.


#2 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 22 February 2021 - 11:32 AM

Are you wanting to make the tilt function?
or are you just wanting to add some extra things that happen when the table tilts?

 

vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot, dummyobject)

 

So if you made a dummy object, like a slingshot (named dummy object here)

could you not just have a timer check if dummyobject is disabled.
If it is, then the table is tilted, so do your stuff

Or a light?
If you put a light someplace, with a power of 0 so technically you will never see it
and set the light to be normally on, if it is part of the tilt array, when the table is tilted will it turn the lamp off when it disables the other tilt objects?

If so, you could just watch for dummyobject.state = 0

The other objects i am not sure what you watch for?
would it be dummyobject.disabled = 1 ?

 

eh just some ideas, on a non DMD table it is easy, just watch for the tilt lamp to go on

 

maybe there is a way to watch for vpmNudge.tiltobject to be triggered, but i am not sure what the syntax would be?

 

I think it was something like this, but not 100% sure as i never wound up using it

 

Sub TiltTimer_Timer()

If TiltObjects = True then

PlaySound "Tilted"

LampName.State = 1

LampName2.State = 0

   else

LampName.State = 0

LampName2.State = 1

StopSound "Tilted"

End If

End Sub


Edited by wiesshund, 22 February 2021 - 11:32 AM.

If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#3 zimbakin

zimbakin

    Hobbyist

  • Members
  • PipPip
  • 44 posts

  • Flag: Australia

  • Favorite Pinball: Diner, Eightball Deluxe, T2

Posted 22 February 2021 - 11:38 AM

Thanks wiesshund.

I tried a dummy switch earlier tonight, however I missed the timer thanks. Think I'll just add a light, much easier. 

 

 

////  I was too quick to post...

 

Tried a Light, however the array has nil affect on lights

Tried adding a dummy Bumper4 to the array with a timer to check then playsound, no luck...(can't do Bumper4.state = 0)

I'm sure it's something simple, but has me stumped for now.


Edited by zimbakin, 22 February 2021 - 12:30 PM.


#4 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 22 February 2021 - 05:15 PM

Tilt changes the bumper or wall hit threshold to 100, and then restores the original value when the table is not in Tilt.

 

You need an enabled timer, with an interval of 10, with which to check the threshold status:

Sub TiltTimer_Timer()
If Bumper1.Threshold = 100 Then
PlaySound "sound" change lighting etc
End If
End Sub

or with the slingshot

Sub TiltTimer_Timer()
If LeftSlingshot.SligshotThreshold = 100 Then
PlaySound "sound" change lighting etc
End If
End Sub

Edited by kiwi, 22 February 2021 - 05:17 PM.


#5 zimbakin

zimbakin

    Hobbyist

  • Members
  • PipPip
  • 44 posts

  • Flag: Australia

  • Favorite Pinball: Diner, Eightball Deluxe, T2

Posted 23 February 2021 - 06:27 AM

You've done it again Kiwi, thanks legend!

 

The vbs reference doc is my first port of call, however there's no .threshold reference in there.

Is there a more comprehensive or updated reference doc somewhere? Thanks.



#6 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 February 2021 - 06:59 AM

You've done it again Kiwi, thanks legend!

 

The vbs reference doc is my first port of call, however there's no .threshold reference in there.

Is there a more comprehensive or updated reference doc somewhere? Thanks.

 

Just tested this

Sub TiltTimer_Timer()
If TiltObjects = True then
PlaySound "Tilted"
LampName.State = 1
LampName2.State = 0
   else
LampName.State = 0
LampName2.State = 1
StopSound "Tilted"
End If
End Sub

seems to work

 

if table says tilted, regardless of what is or is not in the tilt array
then event happens


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#7 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 23 February 2021 - 08:13 AM

You've done it again Kiwi, thanks legend!

 

The vbs reference doc is my first port of call, however there's no .threshold reference in there.

Is there a more comprehensive or updated reference doc somewhere? Thanks.

In the Visual Pinball folder you should have this Command Reference text file.

 

 

@ wiesshund

It doesn't work for me either, maybe we don't have the same VBS scripts, I have to investigate.



#8 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 February 2021 - 09:08 AM

 

You've done it again Kiwi, thanks legend!

 

The vbs reference doc is my first port of call, however there's no .threshold reference in there.

Is there a more comprehensive or updated reference doc somewhere? Thanks.

In the Visual Pinball folder you should have this Command Reference text file.

 

 

@ wiesshund

It doesn't work for me either, maybe we don't have the same VBS scripts, I have to investigate.

 

 

the If tiltobjects?

 

Hmm, i will look at my scripts later 


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#9 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 February 2021 - 09:19 AM

By the way from core.vbs

 

If TypeName(mSlingBump(ii)) = "Bumper" Then mForce(ii) = mSlingBump(ii).Threshold
If vpmVPVer >= 9000 and TypeName(mSlingBump(ii)) = "Wall" Then mForce(ii) = mSlingBump(ii).SlingshotThreshold

so based on that syntax, what kiwi said should work?

 

If bumpername.Threshold = 100
If slingshotname.SlingshotThreshold = 100

etc ?

 

But also from core.vbs

Private Sub Class_Initialize()
		dim idx :for idx = 0 to 3 :FlipperSub(idx) = "NullFunction" : OnOff=True: ButtonState(idx)=0:SolState(idx)=0: Next
		Delay=0: FlippersEnabled=0: DebugOn=0 : LagCompensation=0 : Sol=0 : TiltObjects=1
		RomControlDelay = 100	'RomControlDelay MS between switching to rom controlled flippers
		FlipperSolNumber(0)=sLLFlipper :FlipperSolNumber(1)=sLRFlipper :FlipperSolNumber(2)=sULFlipper : FlipperSolNumber(3)=sURFlipper
	End Sub

so doing an If TiltObjects should work?

 

Keep in mind, at the moment i am looking at the newest scripts packed in the 10.7 beta

as those are the newest revisions, i have stock 10.6 scripts but on other pc

 

Also from core.vbs, they are using it in this sub it trigger the solenoid

Public Sub EnableFlippers(ByVal aEnabled) 'private
		aEnabled = abs(aEnabled) 'Might fix TMNT issue with vpmnudge.solgameon?
		dim idx
		'If aEnabled then execute SubL &" "& ButtonState(0) :execute SubR &" "& ButtonState(1) :execute subUL &" "& ButtonState(2): execute subUR &" "& ButtonState(3)':end if
		If aEnabled then : for idx = 0 to 3 : execute FlipperSub(idx) &" "& ButtonState(idx) : next : end If
		FlippersEnabled = aEnabled
		If TiltObjects then vpmnudge.solgameon aEnabled
		If Not aEnabled then
'			 execute subL & " " & 0 : execute subR & " " & 0
'			 execute subUL & " " & 0 : execute subUR & " " & 0
			for idx = 0 to 3 : execute FlipperSub(idx) &" "& 0 : Next
		End If
	End Sub

If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#10 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 23 February 2021 - 12:49 PM

Tried with regular VBS and beta, it doesn't work for me.

Do you load core.vbs via scripts?

 

If Bumper1.Threshold = 100
If Leftslingshot.SlingshotThreshold = 100

This checks the threshold state of the object itself, it doesn't interact with the core.vbs.



#11 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 February 2021 - 07:30 PM

Tried with regular VBS and beta, it doesn't work for me.

Do you load core.vbs via scripts?

If Bumper1.Threshold = 100
If Leftslingshot.SlingshotThreshold = 100

This checks the threshold state of the object itself, it doesn't interact with the core.vbs.

 

yes i have core loaded, it gets loaded with any machine type vbs during the loadVPM

like bally.VBS for example
 

Option Explicit
LoadCore
Private Sub LoadCore
	On Error Resume Next
	If VPBuildVersion < 0 Or Err Then
		Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") : Err.Clear
		ExecuteGlobal fso.OpenTextFile("core.vbs", 1).ReadAll    : If Err Then MsgBox "Can't open ""core.vbs""" : Exit Sub
		ExecuteGlobal fso.OpenTextFile("VPMKeys.vbs", 1).ReadAll : If Err Then MsgBox "Can't open ""vpmkeys.vbs""" : Exit Sub
	Else
		ExecuteGlobal GetTextFile("core.vbs")    : If Err Then MsgBox "Can't open ""core.vbs"""    : Exit Sub
		ExecuteGlobal GetTextFile("VPMKeys.vbs") : If Err Then MsgBox "Can't open ""vpmkeys.vbs""" : Exit Sub
	End If
End Sub

right, and the threshold gets changed on tilted to 100 correct?
So if your timer is looking for the state to go to 100, then should detect being tilted?

 

but you should be able to just check for If TiltObjects then

 

Maybe i will have to try on something from scratch, rather than an existing project and see what happens
 


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#12 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 23 February 2021 - 07:54 PM

Is this for not ROM tables?

 

If I try to load the core.vbs into a ROM table, I get a lot of errors, I've always seen only controller.vbs used.



#13 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 February 2021 - 08:30 PM

Is this for not ROM tables?

 

If I try to load the core.vbs into a ROM table, I get a lot of errors, I've always seen only controller.vbs used.

 yes, it is for ROM tables

If you are loading a machine VBS with a LoadVPM line, you are already loading core.vbs
in which case loading it a 2nd time by loading it by itself will cause errors, i guess due to redefining a whole bunch of stuff
that you already defined or something


Edited by wiesshund, 23 February 2021 - 08:31 PM.

If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#14 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 24 February 2021 - 10:01 AM

Did you have any luck Kiwi?


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#15 zimbakin

zimbakin

    Hobbyist

  • Members
  • PipPip
  • 44 posts

  • Flag: Australia

  • Favorite Pinball: Diner, Eightball Deluxe, T2

Posted 24 February 2021 - 10:10 AM

Thanks guys. Kiwi’s .threshold=100 on a dummy bumper within the nudge array works perfectly for my purpose.
However, I have to script some exceptions because ball drain flushes/resets the table and GI each time causing bumpers to hit 100 for a second time, triggering the “tilt” sub event. Should be an easy fix with some ball in play dims and maybe some carefully timed timers. (This is a ROM table).
I’ll also try Sub TiltTimer_.... tomorrow (I tried once without success, however will try again as it’s the most direct solution if it can work).)

#16 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 24 February 2021 - 11:47 AM

Did you have any luck Kiwi?

No, do you have a working table to share?

 

 

@zimbakin

You can enable the TiltTimer with a trigger placed in the launch lane, and with another trigger placed before the drain that disables the TiltTimer.

 

Out of curiosity, what table is it? Space Shuttle? Because light 3 is that of the Tilt.



#17 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 25 February 2021 - 02:07 AM

 

Did you have any luck Kiwi?

No, do you have a working table to share?

 

 

 

Seems same stuff does not work on all tables :(

 

maybe @Toxie has a universal recommendation for detecting a ROM being in a tilted state

 

Like Panthera for example, when tilted, the flippers disable because solenoid activated

The bumpers and slingshots remain physically active though they are in the tilt array

but no score is counted on them

And of course, if i monitor the thresholds, they remain at their in play values.

 

And nothing i monitor except the TILT lamp is of any use
I monitor tiltobjects and the value sits at one
i monitor the left slingshot threshold and the value remains at 3 (and it actually still slings)

the only thing i got to work on that table was

Sub TiltedTimer_Timer()


If Controller.Lamp(1) Then 'TiltObject=1
TiltedState.TEXT = "TILTED"
Else
TiltedState.TEXT = "NOT TILTED"
End If


End Sub

I have no idea at all why?
Nor do i know why the tilt objects remain active


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#18 zimbakin

zimbakin

    Hobbyist

  • Members
  • PipPip
  • 44 posts

  • Flag: Australia

  • Favorite Pinball: Diner, Eightball Deluxe, T2

Posted 25 February 2021 - 04:36 AM

 

Did you have any luck Kiwi?

No, do you have a working table to share?

 

 

@zimbakin

You can enable the TiltTimer with a trigger placed in the launch lane, and with another trigger placed before the drain that disables the TiltTimer.

 

Out of curiosity, what table is it? Space Shuttle? Because light 3 is that of the Tilt.

 

 

It is TAITO space shuttle.
There's no light 3 (maybe you were thinking williams space shuttle...just quietly, wish I did use Williams ;).
As mentioned earlier, I have it sort of working with a dummy bumper in the nudge.TiltObj array.

However on drain, the bumpers hit 100 which activates the TILT sub again. So I'm trying to get creative. I already had a drain and start trigger, however there's a brief second where the TILT sub is called again... so thinking to add another timer or a priority call on the TILT PUP (using pinup sys backglass) should ignore the second call nicely. I did a bit of that already with some other activations, however it makes the script bulky.

 

The best solution as wieshund suggests, would be if there's a simple ROM call for TILT actiavtion. However, I don't think there is.

 

---- edit

 

I stand corrected, the manual states L3 is tilt as kiwi suggests.
Although adding NFadeL 3, li3 or 7 to the table doesn't do anything.

 

 


Edited by zimbakin, 25 February 2021 - 05:06 AM.


#19 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 25 February 2021 - 04:53 AM

Hoping maybe there is something toxie could clue us in to


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#20 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 25 February 2021 - 05:56 AM

 

 

Did you have any luck Kiwi?

No, do you have a working table to share?

 

 

@zimbakin

You can enable the TiltTimer with a trigger placed in the launch lane, and with another trigger placed before the drain that disables the TiltTimer.

 

Out of curiosity, what table is it? Space Shuttle? Because light 3 is that of the Tilt.

 

 

It is TAITO space shuttle.
There's no light 3 (maybe you were thinking williams space shuttle...just quietly, wish I did use Williams ;).
As mentioned earlier, I have it sort of working with a dummy bumper in the nudge.TiltObj array.

However on drain, the bumpers hit 100 which activates the TILT sub again. So I'm trying to get creative. I already had a drain and start trigger, however there's a brief second where the TILT sub is called again... so thinking to add another timer or a priority call on the TILT PUP (using pinup sys backglass) should ignore the second call nicely. I did a bit of that already with some other activations, however it makes the script bulky.

 

The best solution as wieshund suggests, would be if there's a simple ROM call for TILT actiavtion. However, I don't think there is.

 

---- edit

 

I stand corrected, the manual states L3 is tilt as kiwi suggests.
Although adding NFadeL 3, li3 or 7 to the table doesn't do anything.

 

 

 

do it like this

Sub TiltedTimer_Timer()
If controller.Lamp(3) = 1 Then

'do your tilted actions here

Else

'stop any actions that need stopping, like a looping tilt sound etc
'or turning off an extra lamp you made and what not

End If
End Sub

If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow