VPX Documentation
Light Sequences
15 min
events event detail example init timer playdone dispinterface ilightseqevents { properties methods \[id(dispid gameevents init)] void init(); \[id(dispid timerevents timer)] void timer(); \[id(dispid lightseqevents playdone)] void playdone(); } visual pinball contains a device called the 'light sequencer' (or ls for short) what this basically does is take a visual pinball collection of lights and runs a effect though the lights (in the collection) that you would see on a commercial pinball game the effects the light sequencer has are full table effects, i e it doesn't allow you to cycle though lights but it does do the more complex effects which make a pinball look good without coding hundreds if not thousands of script lines the light sequencer when running takes control of the lights you specify for it to use it does this by overlaying the effect over the lights without affecting the true state of the light as many scripts use lights for game conditionals (i e if light = on then award bonus and turn light off) the light sequencer ensures that your script does not need to worry about whether or not the sequencer is currently running it is totally transparent to your table changing the value of a light while a sequence is running will not actually turn a light on or off (or even to blinking), but it will remember what the current state is so when the sequence is finished, the lights will be restored to the last set state multiple light sequencer's can be placed on the table allowing for different sections of the table to have its own effects if needed (such as split playfield's) or effects which have use a different centre point (more of this in a bit) each light sequencer can have it's own collection so you can use different sequencer's to control different parts of the table a light can also exist in multiple collections so there is no limitations about which lights can be where adding a light sequencer to your table on the left hand tool palette, you will find a icon which looks like this click on it and place the element onto the table as you would do with any of the other types of table objects when you place it onto the table, it will generate 2 icons which look like this if you click onto the main table element for the light sequencer it will bring up the options the light sequencer is primary script driven so there isn't too many options to worry about in the editor name the objects name which is used to address the object though the script position table x and y centre the centre refernece point which the light sequencer uses to base all it's effects from state collection the collection of lights / bumpers to use (more of this in a minute) a light sequencer can only use a single collection and it cannot be changed during game play if you want to use more than one collection, use multiple light sequencer's update interval the speed that the light sequencer runs at it is best to define this in the script as it is definable per effect if you want all effects to run at a set speed then this is the place to do it misc timer interval if enabled will call lightseqname timer() in the script every n (interval) milliseconds user value holds any value put into it it is not used by the light sequencer setting up a collection for a light sequencer to use as mentioned above the light sequencer uses a collection to store the details about which lights (and bumpers) to use if you havn't not used 'collections' before, don't worry the light sequencer only uses it as a list of lights and you don't need to know how to use them at a script level open up the collection manager and click on new\ type in the name for which to want to call the collection click on 'edit' which will bring up the following screen in this screen select all the lights and bumpers that you want light sequencer to control when it performs an effect you don't need to select either 'fire events' or 'suppress events' and i recommend that you don't as if you are using bumpers in a collection then you could accidentally turn off the hit event for them things to be careful of! the light sequencer will work with any light/bumper placed onto the table (or the backglass) and will handle any width of table but it will not process lights which are placed off the table (in the table view in the editor) the ls works by subdividing the table into 20x20 unit cells (on a default table of 1000 x 2000 units this gives 5000 cells) only 1 light is handled per cell so if a single cell contains 2 lights then only one of them will be processed in order to test the positioning of the lights on your table you can set the editor grid to 20 units i checked a lot of tables and couldn't find any tables which had lights that close to each other if you do have lights very close to each other you can always use 2 light sequencer's with each light in a different collection visual pinball now has some editor tweaking options which you can set one of the these options is the ability to place a small cross hair or cross in the centre of lights and bumpers the cross hair is only shown for circular lights as custom definable lights already have a cross hair(or cross) which acts as the centre of the light (where the light comes from) by turning on the light centre and the layout grid (set to 20) you can check each light and ensure that there is no more than one 'cross hair' in each cell of the grid for example a standard circular light and bumper you can see exactly which grid cell it is in the custom shaped lights from my bk2k table (knights helmet) as you can see each cross hair has its own grid cell and doesn't share with another light the light sequencer centre reference point the light sequencer has a centre reference point which is marked by the smaller ls icon with the cross hair in it by centre reference i mean the point on the table which the ls uses as the centre point to base all effects on for example the circle out effect will start at this point and circle out each ls can have it's own centre point to allow for different parts of the playfield to be highlighted during an effect for example bk2k will have some effects which use the very centre of the table as a starting point whilst other effects use the knights helmet as the start point the effects and how they work the light sequencer basically only follows fixed pattern effects which it has been programmed with (over 50 different effects) but each one can be tweaked slightly by specifying how fast it runs, any pauses between effects and repeating the effect these effects are processed as 'head' effects the 'head' effect is the main effect for example if you are turning all the lights on from the bottom of the playfield and moving upwards the point at which the light turns on is where the 'head' of the effect is the head will change from frame to frame as it moves up the playfield each 'head' effect can have a 'tail' effect which follows the 'head' effect and inverts the state to which the 'head' sets a light for example if as above you are turning on lights moving up, then the 'tail' will turn them off if the 'head' turns them off, the 'tail' will turn them on the distance at which the 'tail' follows the 'head' is completely upto you or you may decide not to have a tail the 'tail' will always run at the same speed as the 'head' and the effect and not classified as finished until both the 'head'' & ''tail' have both finished how do i use the light sequencer in my table script? the actual light sequencer is very simple to use once the collection has been set up it only has 2 script methods ' play' and' stopplay', a property (' updateinterval') and one event (' playdone') to let you know when the sequencer has finished method play effect, taillength, repeat, pause method stopplay() property updateinterval event playdone()