440 likes | 450 Views
Learn how to customize the backdrop, add pictures, and use scripting in Visual Pinball. Find out how to resize images and write code for objects. Advanced users only.
E N D
In this guide: • The Backdrop • Adding Pictures • The Script!!!! (Advanced users only need to read this part)
1. The Backdrop The black rectangles shown are “Text Boxes”, and show information such as score, or number of balls remaining. These can of course, be customised using the options on the right when selected Pressing the backdrop button shows the overall view around the machine the player will have during play
One of the main uses for this view is to sort out the background image Once an image is loaded, it will appear in this drop-down menu.
2. Adding Pictures Adding pictures to the editor is very easy. Getting them to look exactly how you want them to on the table can be a little bit more tricky.
Go to “Table” menu and select “Image Manager” 2. Adding Pictures Open the image manager and import a picture
2. Adding Pictures Open the image manager and import a picture Click “Import” and then find the picture you want in your table
2. Adding Pictures Open the image manager and import a picture
3. Putting Pictures On The problem with putting pictures on Visual Pinball is their size If a picture is put on the “playfield” it will fill the entire playfield e.g. “Marge on the playfield” Easy!
3. Putting Pictures On The problem with putting pictures on Visual Pinball is their size If a picture is put on the “playfield” it will fill the entire playfield However, if you wanted to put a picture of Marge on the slingshots, you would see very little because the picture again tries to fill the entire playfield! :-( All we see is part of her hands!
3. Putting Pictures On To use a picture on a wall, or slingshot, or on anything that is not the playfield, we must first make it the right size. To know what size to make it, we need to fit it to a “Blueprint” of the playfield To make a “blueprint image” go to the “File” menu, and choose “Export”
3. Putting Pictures On Save this image as a bitmap (.bmp) file You can then edit this blueprint image in any graphic editing software (e.g. Paint, or Photoshop, etc). Here, I have shrunk the image of Marge so that it now fits where the slingshot is You can now save this as a new image and use it to put on the slingshots (after importing it through the image manager). Marge is now the right size
4. The Script! “The Script” is a piece of visual basic code (program) that tells the table what to do. In order for anything to work it must have the right code in the script. The Tutorial Table has script already written so that any flipper, wall, spinner, plunger, bumper or kicker will work straight away…but lights will not change from the way they are set in the editor. To see the script click the “Script” button
No Yes No Yes If you have never tried any computer programming before, the script probably looks very complicated. Most scripting is complicated, but some can be quite easy. Scripting basically follows a flow-chart style pattern: e.g. A flow chart might say: Has Wall1 been hit? END (Do nothing) END (Do nothing) Can Wall1 drop? Drop the wall & add 10 points to score Play the sound “Wall Drop” End
In a script this would look like this: Sub Wall1_hit If Wall1.CanDrop = true then Wall1.IsDropped = true Score = Score + 10 ScoreText.Text = Score Playsound “WallDrop” End If End Sub The script is known as a “routine” – and each event must be inside a “Sub-routine”, called a “Sub” in the script. All subs must have an “End Sub” to tell the script when that event is finished
In a script this would look like this: Sub Wall1_hit If Wall1.CanDrop = true then Wall1.IsDropped = true Score = Score + 10 ScoreText.Text = Score Playsound “WallDrop” End If End Sub Any questions can be asked as “If” statements. These must “then” tell the script what to do. Any if statement must be ended also.
In a script this would look like this: Sub Wall1_hit If Wall1.CanDrop = true then Wall1.IsDropped = true Score = Score + 10 ScoreText.Text = Score Playsound “WallDrop” End If End Sub Some words are reserved and cannot be used for anything else – these are shown in blue in the script Some phrases are specific to Visual Pinball, and also specific to a particular object: e.g. Walls can have a setting “.IsDropped” (notice the full stop between the object “Wall1” and its setting) The full range of settings for all objects is shown at the end of this presentation
In a script this would look like this: Sub Wall1_hit If Wall1.CanDrop = true then Wall1.IsDropped = true Score = Score + 10 ScoreText.Text = Score Playsound “WallDrop” End If End Sub ‘ This line does nothing You can put statements into the script that do nothing in the program, but help you understand the script. These lines are shown in green in the script They can be put anywhere by putting a ‘ before them
In a script this would look like this: Sub Wall1_hit If Wall1.CanDrop = true then Wall1.IsDropped = true Score = Score + 10 ScoreText.Text = Score Playsound “WallDrop” End If End Sub In the Tutorial Table script, a different type of Sub-routine called a “Function” is used to update the score Functions can be helpful when a frequently used set of instructions is asked for e.g. adding score, and then updating the Score text box. In the Tutorial Table this function is called “AddScore” (So the lines “Score=Score+10” and “ScoreText.Text=Score” are replaced by a single line “AddScore 10” – the “Function AddScore” is described later in the script)
Scripting can be very difficult, but it can also be very rewarding as you can get the table to do anything if you can get the script right. Learning script takes time, but don’t worry about trying anything now. A good way to start is to use an existing script (like the Tutorial Table) and try to change parts of it. (You are welcome to change the script in any of my tables – you would be wise to save a copy of the table first though) If you are interested in learning script for Visual Pinball and need help you can always contact me via wizardshat@hotmail.com
INDEX On the following pages are the “Object Settings” for Visual Pinball. These settings will help if you are trying to script anything for a table. BALLBUMPERCOLLECTIONDRAGPOINT (Control Point)EMREEL FLIPPERGATEIDECALITABLEKICKERLIGHT LIGHTSEQPLUNGERRAMPSPINNERTABLETEXTBOXTIMERTRIGGERWALL (TARGET) (Click on any object to go straight to its settings)
BALLPropertiesBackDecal (Editor)/Script As String) in editor only the default ball can be changedColor (Script As OLE_Color)FrontDecal (Editor/Script As String) in editor only the default ball can be changedImage (Editor/Script As String) in editor only the default ball can be changedUserValue (Script As Variant)VelX (Script As Double)VelY (Script As Double)VelZ (Script As Double)X (Script As Double)Y (Script As Double)Z (Script As Double) INDEX
BUMPERPropertiesBlinkInterval (Editor/Script as Integer) BlinkPattern (Editor/Script as String) "0"=off, "1"=onCastsShadow (Editor As Boolean)Centre X (Editor as Single) Centre Y (Editor as Single)Color (Editor As OLE_Color)Disabled (Script As Boolean)FlashWhenHit (Editor/Script as Boolean)Force (Editor/Script As Single)Image (Editor As String)Overhang (Editor as Integer)Radius (Editor as Integer)SideColor (Editor as OLE_Color)State (Editor/Script as LightState) 0=off, 1=on, 2=blinkSurface(Editor As String)Threshold (Editor/Script As Single)TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer)UserValue (Editor/Script as Variable) EventsSub _Hit()(Script) when Bumper is hit, procedures are carried outSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
COLLECTIONProperties_NewEnum (Script As UNKNOWN)Count (Script As Integer)Item (Script As IDispatch)EventsSub _Hit(idx)(Script: idx As Integer) when collection item is hit, procedures are carried outSub _Init(idx)(Script: idx As Integer) when table is loaded, procedures are carried outSub _Slingshot(idx) (Script: idx As Integer) when slingshot is hit, procedures are carried outSub _Spin(idx) (Script: idx As Integer) when spinner spins, procedures are carried outSub _Timer(idx) (Script: idx As Integer) time interval will cycle, procedures are carried outSub _Unhit(idx) (Script: idx As Integer) when collection item is no longer hit, procedures are carried out INDEX
DRAGPOINT (CONTROL POINT)PropertiesIsAutoTextureCoordinate (Editor As Boolean)Smooth (Editor As Boolean)TextureCoordinateU (Editor As Single)X (Editor As Single)Y (Editor As Single) INDEX
EMREELPropertiesBackColor (Editor/Script As OLE_Color)Font (Editor As IFontDisp)FontColor (Editor As OLE_Color)Height (Editor As Single)Image (Editor As String)ImagesPerGridRow (Editor As Integer)IsShading (Editor As Boolean)IsTransparent (Editor/Script As Boolean)Name (Editor As String)Range (Editor As Single)ReelColor (Editor As OLE_Color)Reels (Editor As Single)Sound (Editor/Script As String)Spacing (Editor As Single)Steps (Editor/Script As Single)TimerEnabled (Editor/Script As Boolean) TimerInterval (Editor/Script As Boolean) Type (Editor As ReelType (0=Text, 1=Image))UpdateInterval (Editor/Script As Integer)UseImageGrid (Editor As Boolean)UserValue (Editor/Script As Variant) Width (Editor As Single)X (Editor As Single)Y (Editor As Single)MethodsAddValue (Script: Value As Integer)ResetToZero (Script)SetValue (Script: Value As Integer)SpinReel (Script: ReelNumber As Integer, PulseCount As Integer)EventsSub _Init() (Script) procedures are carried out when table is loadedSub _Timer() (Script) procedures are carried out after timer interval INDEX
FLIPPERPropertiesBaseRadius (Editor as Single)Color (Editor as OLE_Color)CurrentAngle (Script (read-only!) As Single)Elasticity (Editor/Script as Single)EndAngle (Editor as Single)EndRadius (Editor as Single)Length (Editor as Single)Name (Editor as String)Rubberthickness (Editor as Integer)Rubberthickness (Editor as OLE_Color)Speed (Editor/Script as Single)StartAngle (Editor as Single)Strength (Editor/Script as Single)Surface (Editor as String)TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer)UserValue (Editor/Script as Variable) Visible (Script as Boolean)X (Editor as Single) Y (Editor as Single) MethodsRotatetoEnd (Script) rotates Flipper to flip positionRotatetoStart (Script) rotates Flipper to Start positionEventsSub _Hit()(Script) when Flipper is hit, procedures are carried outSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
GATEPropertiesLength(Editor As Single) Name(Editor As String) Open(Script As Boolean) Rotation(Editor As Single) Surface(Editor As String) TimerEnabled (Script As Boolean) TimerInterval (Script AS Integer) UserValue(Editor As String) X (Editor As Single) Y (Editor As Single)EventsSub _Hit() (Script) when Gate is hit, procedures are carried outSub _Init() (Script) procedures are carried out when table is loaded Sub _Timer() (Script) procedures are carried out after timer interval INDEX
IDECAL (this is an interface, a decal has no name, therefore it can't be accessed in the script)PropertiesFont (Editor As IFontDisp)FontColor (Editor As OLE_Color)HasVerticalText (Editor As Boolean)Height (Editor As Single)Image (Editor As String)Rotation (Editor As Single)SizingType (Editor As SizingType) 0=AutoSize, 1=AutoWidth, 2=ManualSizeSurface (Editor As String)Text (Editor As String)Type (Editor As DecalType) 0=DecalText, 1=DecalImageWidth (Editor As Single)X (Editor As Single)Y (Editor As Single) INDEX
ITABLE (another interface, use the following properties without any object name)PropertiesActiveBall (Script as Object) AddCreditKey (Editor/Script As Integer) CenterTiltKey (Editor/Script As Integer) GameTime (Script As Integer) elapsed time in millisecondsGetPlayerHWnd (Script As Integer) window handle of main table player windowLeftFlipperKey (Editor/Script As Integer) LeftTiltKey (Editor/Script As Integer) PlungerKey (Editor/Script As Integer) RightFlipperKey (Editor/Script As Integer) RightTiltKey (Editor/Script As Integer) StartGameKey (Editor/Script As Integer) UserDirectory (Script As String) MethodsGetTextFile (Script: FileName As String)LoadValue (Script: TableName As String, ValueName As String) loads from VPReg.stg Nudge (Script: Angle As Single, Force As Single) PlaySound (Script: Sound As String (wav or wma), [LoopCount As Integer], [Volume As Single])
ITABLE (continued) Methods (continued) SaveValue (Script: TableName As String, ValueName As String, Value As Variant) saves to VPReg.stg StopSound (Script: Sound As String (wav or wma), Filename Specific) PlayMusic (Script: String As String.mp3)EndMusic (Script: Not Filename Specific) Sub _MusicDone() (Script) when mp3 file is finished, procedures are carried out INDEX
KICKERPropertiesColor (Editor/Script As OLE_Color) DrawStyle (Editor As KickerStyle) 0=KickerHidden, 1=KickerHole, 2=KickerCupEnabled (Editor/Script as Boolean) Name (Editor as String) Surface (Editor as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer) UserValue (Editor as Variable) X (Editor As Single)Y (Editor As Single) MethodsCreateBall (Script)CreateBall.Color (Script as OLE_Color)CreateBall.Image (Script as String)DestroyBall (Script)Kick (Script: Angle As Single, Speed As Single, [Inclination As Single])EventsSub _Hit()(Script) when Kicker is hit, procedures are carried outSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
LIGHTPropertiesBlinkInterval (Editor/Script as Integer) BlinkPattern (Editor/Script as string) "0"=off, "1"=onBorderColor (Editor As OLE_Color) BorderWidth (Editor As OLE_Color) Color (Editor As OLE_Color) Name (Editor As String) Radius (Editor As Single) Shape (Editor As ShapeType) 0=ShapeCircle, 1=ShapeCustomState (Editor/Script as LightState) 0=off, 1=on, 2=blink Surface (Editor as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer) UserValue (Editor as Variable) X (Editor as Integer) Y (Editor as Integer)EventsSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
LIGHTSEQPropertiesCenterX (Editor as Single) CenterY (Editor as Single)Collection (Editor as String)Name (Editor as String)TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer)UpdateInterval (Editor/Script as Integer)UserValue (Editor/Script as Variable) MethodsPlay (Script: Animation As SequencerState, [TailLength As Integer], [Repeat As Integer], [Pause As Integer])StopPlay (Script)EventsSub _Init()(Script) when table is loaded, procedures are carried outSub _Playdone() (Script) procedures are carried out when Light Sequence Animation endsSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
PLUNGERPropertiesFireSpeed (Editor/Script As Single) Name (Editor as String) PullSpeed (Editor/Script As Single) Surface (Editor as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer) UserValue (Editor as Variable)X (Editor as Single) Y (Editor as Single) MethodsCreateBall (Script) Fire (Script) PullBack (Script)EventsSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
RAMPPropertiesColor (Editor as OLE_Color) HasWallImage (Editor as Boolean) HeightBottom (Editor As Single) HeightTop (Editor as Single) Image (Editor as String) ImageAlignment (Editor as RampImageAlignment) 0=world, 1=wrapName (Editor as String) Type (Editor as RampType) 0=Flat, 1=2-wire, 2=4-wire, 3=3-wire left, 4=3-wire rightUserValue (Editor as Variable) WidthBottom (Editor as Single) WidthTop (Editor as Single) EventsSub _Init()(Script) when table is loaded, procedures are carried out INDEX
SPINNERPropertiesCastsShadow (Editor as Boolean) Color (Editor as OLE_Color) Friction (Editor/Script as Single) Height (Editor as Single) ImageBack (Editor as String) ImageFront (Editor as String) Length (Editor as Single) Name (Editor as String) Rotation (Editor as Single) Surface (Editor as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer)X (Editor as Single) Y (Editor as Single) EventsSub _Init()(Script) when table is loaded, procedures are carried outSub _Spin() (Script) when spinner spins, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
TABLEPropertiesBackdropColor (Editor as OLE_Color)BackdropImage (Editor as String) BallBackDecal (Editor as String) BallFontDecal (Editor as String) BallImage (Editor as String) DisplayBackdrop (Editor as Boolean) DisplayGrid (Editor as Boolean) FieldOfView (Editor as Single) GlassHeight (Editor as Single) GridSize (Editor as Single) Height (Editor as Single) Image (Editor as String) Inclination (Editor as Single) Name (Editor as String) PlayfieldColor (Editor as OLE_Color) RenderShadows (Editor as Boolean) Slope (Editor/Script as Single) Width (Editor as Single) YieldTime (Script as Variable)
TABLE (continued) MethodsNudge (Script: Angle As Single, Force As Single) EventsSub _Exit() (Script) when table exits, procedures are carried outSub _Init()(Script) when table is loaded, procedures are carried outSub _KeyDown (Script) keycode As Integer: when a key is pressed, procedures are carried outSub _KeyUp (Script) keycode As Integer: when a key is released, procedures are carried out Sub _MusicEnded()(Script) when music is ended, procedures are carried outSub _Paused()(Script) when table is paused, procedures are carried outSub _UnPaused()(Script) when table is resumed, procedures are carried out INDEX
TEXTBOXPropertiesAlignment (Editor/Script as TextAlignment) script must refresh Text property BackColor (Editor/Script as OLE_Color) script must refresh Text property Font (Editor as IFontDisp) select from Font settings FontColor (Editor/Script OLE_Color) script must refresh Text property Height (Editor as Single) IsTransparent (Editor/Script Boolean) script must refresh Text property Name (Editor as String) Text (Editor/Script as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer)UserValue (Editor/Script as Variable) Width (Editor as Single)X (Editor as Single)Y (Editor as Single) EventsSub _Init()(Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
TIMERPropertiesEnabled (Editor/Script as Boolean) Interval (Editor/Script as Integer) Name (Editor as String) UserValue (Editor/Script as Variant) EventsSub _Init() (Script) when table is loaded, procedures are carried out Sub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX
TRIGGERPropertiesEnabled (Editor/Script as Boolean) Name (Editor as String) Radius (Editor as Single) Shape (Editor as Shape) Surface (Editor as String) TimerEnabled (Editor/Script as Boolean) TimerInterval (Editor/Script as Integer) UserValue (Editor as Variable)Visible (Editor as Boolean) X (Editor as Single) Y (Editor as Single) EventsSub _Hit() (Script) when trigger is hit, procedures are carried outSub _Init() (Script) when table is loaded, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried outSub _Unhit() (Script) when trigger is no longer hit, procedures are carried out INDEX
WALL (TARGET)PropertiesCanDrop (Editor as Boolean) CastsShadow (Editor as Boolean) Disabled (Editor/Script as Boolean) DisplayTexture (Editor as Boolean) Elasticity (Editor as Single)FaceColor (Editor as OLE_Color) Has HitEvent (Editor as Boolean) HeightBottom (Editor as Single) HeightTop (Editor as Single) Image (Editor as String) ImageAlignment (Editor as Boolean) IsDropped (Script as Boolean) "CanDrop" must be checked in OptionsName (Editor as String) SideColor (Editor as OLE_Color) SideImage (Editor as String) SideVisible (Editor as Boolean) SlingshotStrength (Editor as Single)Threshold (Editor as Single) TimerEnabled (Script as Boolean) TimerInterval (Script as Integer) UserValue (Editor as Variable) Visible (Editor as Boolean)
WALL (TARGET) (continued) EventsSub _Hit()(Script) when trigger is hit, procedures are carried outSub _Init()(Script) when table is loaded, procedures are carried outSub _Slingshot() (Script) when slingshot is hit, procedures are carried outSub _Timer() (Script) time interval will cycle, then procedures are carried out INDEX