Jump to content

Rosve's Fading Lights Demo


rosve

Recommended Posts

  • Content Provider

Here is a demo table and a description on how to use my fading lights code.
This system is specially made to make it easy to create really good looking lights on EM and original tables. It gives you much more control over the lights than the standard VP lights.

I have been using this code in tables like Starship Troopers, SPACE:1999, Red Dwarf, SkyRocket and many more.
 


Demo table: FadingLights2.zip

 

 

---------------------------------------------------------------------------------
MANUAL (also included in the download)

- Add the Fading Lights code to the end of the table script.

- Create a new timer and name it "FLTimer". Set the interval to 33 and Enable it.

- Create a light somewhere besides the table and name it "DummyLight"

- Create 2 new collections, "L1" and "L2". Put the DummyLight in both collections.

- Make 3 playfield images with the Lights Off, Lights Half On, Lights Full On.

- Add all the lights needed on the playfield (light1 - 14 on the demo table).
On all the lights, Set the Off Image to the 'Lights Off' image. Set the On Image to the 'Lights Half On' image.

- Enter the lights into the "L1" collection.

- Copy and paste all the lights so that you get two lights in the same position.
On all the new lights, Set the Off Image to the 'Lights Half On' image. Set the On Image to the 'Lights Full On' image.

- Enter the new lights into the "L2" collection.

- set the variable "FLMaxLight" (3rd line in the fading lights code) to the number of lights that you made. 14 in the demo table.


YOU ARE NOW READY TO USE THE FADING LIGHTS.
-------------------------------------------

- Insert this line in the table _Init sub to initialize the fading lights system,
FLFlash 1, FLMaxLight, 0, 1, 4, 0



Use the following instructions to set a light (or a group of lights) ON, OFF or FLASHING


FLSetOn light1, light2, delay
- Light number from Light1 to Light 2 is set to ON.
- If the Delay is larger than 0 the code will wait the specified number of timer intervals before setting the lights ON.


FLSetOff light1, light2, delay
- Light number from Light1 to Light 2 is set to OFF.
- If the Delay is larger than 0 the code will wait the specified number of timer intervals before setting the lights OFF.



FLFlash light1, light2, repeats, on_duration, off_duration, delay
- Light number from Light1 to Light 2 is set to FLASHING.
- repeats is how many times the lights shall flash, 999 is continous flashing.
- on_duration and off_duration specifies how many timer intervals the light shall stay on and off in the flashing cycle.
- If the Delay is larger than 0 the code will wait the specified number of timer intervals before setting the lights to FLASHING.




EXAMPLES
--------

Set light 4 on.
FLSetOn 4, 4, 0

Set light 3 to 6 on after a small delay,
FLSetOn 3, 6, 10

Set light 4 off.
FLSetOff 4, 4, 0

Flash light 6 three times,
FLFlash 6, 6, 2, 2, 4, 0

Flash all light one time
FLFlash 1, FLMaxLight, 0, 1, 4, 0

------------------------------------------------------------------------------------

To use it with VPM you also need this code snippet to read the lamp states.

Dim NewState(200)
Dim OldState(200)

FLTimer.Interval = 21
LampTimer.Interval = 10
LampTimer.Enabled = 1

Sub SetFlasher(nr, value)
   NewState(nr) = abs(value)
End Sub


Sub LampTimer_Timer()
	 Dim chgLamp, num, chg, ii
	 chgLamp = Controller.ChangedLamps
	 If Not IsEmpty(chgLamp) Then
		 For ii = 0 To UBound(chgLamp) ' **UPDATE LAMP STATES ***'
			 If chgLamp(ii, 1)=0 then
	 		    FLSetOff chgLamp(ii, 0), chgLamp(ii, 0), 0
			 else
			    FLSetOn chgLamp(ii, 0), chgLamp(ii, 0), 0
			 end if
		 Next
	 End If
	 For ii=81 to 88 ' ******** FLASHER NUMBERS *************'
	 If NewState(ii) <> OldState(ii) then
		 OldState(ii)=NewState(ii)
		 If NewState(ii)=0 then
		    FLSetOff ii, ii. 0
		 else
		    FLSetOn ii, ii, 0
		 end if
	 end if
	 Next
End Sub


 

 

Solenoid controlled flasher states are read like this,

SolCallBack(25)="SetFlasher 81, "	 'red x 4'
SolCallBack(26)="SetFlasher 82, "	 'yellow x 4'
SolCallBack(27)="SetFlasher 83, "	 'green x 4'
SolCallBack(28)="SetFlasher 84, "	 'blue x 4'
SolCallBack(30)="SetFlasher 86, "	 'left ramp x 4'
SolCallBack(31)="SetFlasher 87, "	 'right ramp x 4'
SolCallBack(32)="SetFlasher 88, "	 'pops x 2'


 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...