Do you know how to use Collections & EVAL?
Previously:
We have, for example, 50 Walls, Flahers or any object that supports properties / methods at runtime.
We want each time one of them is hit to produce a series of performances.
Normally, we would build 50 subroutines of type _HIT. One for each WALL ...
Very bulky. Also, if we want to add a performance later, we must play all 50 routines.
We will create a collection with the desired elements. Name: C1.
Elements:
WALL1
WALL2
WALL3
...
WALL50
The HIT Event will be accompanied by n, which indicates the ordinal number of the trigger object counting from 0.
If the ball hits WALL1, n will be worth 0. In the example we will always add 1 to n.
(Another possibility would be to call the objects also numbering from zero ... WALL0, WALL1, ETC ...)
SUB C1_HIT (n)
EVAL ("WALL" & n + 1) .Isdropped = True
TIMER1.ENABLED = TRUE
PlaySound "SOME_SOUND" & n (If each WALL has its own sound ... etc ...)
ADDSCORE (1000)
IF EVAL ("WALL" & n) .XXX = ??? THEN '
XXX'X
XXX
END IF
End sub
We have reduced the number of font lines in a brutal way.
Greetings and Happy Holidays !!!
- View New Content
-
Getting Started
-
Tutorials
Tutorial Categories
Tutorials Main Page Installation and Setup Downloadable TutorialsROM Adjustments
Number of Balls Adjustments Volume Adjustments
-
Visual Pinball Tables
VP 8 Desktop Tables
All VPM Recreations VP Recreations VP/VPM MODs VP Originals ROMsVP 9 Desktop Tables
All VPM Recreations VP Recreations VP/VPM MODs VP Originals ROMsVP9 Cabinet Tables
All Full Screen Cabinet Full Screen B2S Cabinet Spanned Cabinet Tables Media Packs ROMsVPX Tables
All VPinMAME Recreations VPX- - /VPinMAME - MOD Tables VPX Recreations VPX Originals Media Packs ROMs VR
-
Frontend Media & Backglass
Media Packs
Complete Media Packs Wheel Logos VideosBackglasses
dB2S Animated Backglasses UVP Animated Backglasses Topper Images
- Future Pinball Tables
-
Design Resources
Main Resources
Table Templates Playfield Images Image Library Sound Library Key CodesVP Guides
VP8 Guide - English VP8 Guide - Deutsch VP9 Guide - English VP9.1.x Guide - English VP Object Guide VPM DocumentationFuture Pinball Resources
Playfield Images 3D Model LibraryFuture Pinball Guides
FP Script Guide Big Draco Script Guide FP Table Design Guide FP DMD Guide
- Other Features
- Bug Tracker
- Image Gallery
- Blogs
-
More



Top








are all trademarks of VPFORUMS.