Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Discussion: structure de sub

  1. #1
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    mars 2016
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : mars 2016
    Messages : 6
    Points : 4
    Points
    4

    Par défaut structure de sub

    bonjour
    je suis sur script pour un pinball et j'arrive pas à me dépatouiller d'un problème de kicker avec 2 conditions distinctes et aussi "complémentaires"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    '****************KICKER********************
    Sub Kicker1_Hit()
    	If fpTilted = True Then Exit Sub
    	Timer1.Set True,1000
    	if l44.state=1 then
    		AddScore (1000)
    		incrementbonus(3) 
    		else
    		AddScore (1000)
    	end if
     
    	if l20.state=1 then
    		l20.state=0
    		nvCredits = nvCredits + 1
    		Playsound"knocker"
    	end if
     
     
    	if l21.state=1 then
    		timer2.set true,400
    		timer1.set false,1000
    	end if
    End Sub
     
     
    Sub Timer1_Expired()
    	Timer1.Set False
    	Kicker1.SolenoidPulse
    End Sub
     
     
    sub timer2_expired
    	l21.state=0
    	timer2.set false,3000
    	incrementbonus(-1)
    	AwardPoints = 1000 * BonusMultiplier(CurrentPlayer)
    	b20.Set Bulboff, "100000000000", 150
    	b10.Set Bulboff, "010000000000", 150
    	b9.Set Bulboff,  "001000000000", 150
    	b8.Set Bulboff,  "000100000000", 150
    	b7.Set Bulboff,  "000010000000", 150
    	b6.Set Bulboff,  "000001000000", 150
    	b5.Set Bulboff,  "000000100000", 150
    	b4.Set Bulboff,  "000000010000", 150
    	b3.Set Bulboff,  "000000001000", 150
    	b2.Set Bulboff,  "000000000100", 150
    	b1.Set Bulboff,  "000000000010", 150
    	playsound"bonus"
    	bonus=0
    	Kicker1.SolenoidPulse	
    end sub
    l44 est une lumière , si allumée (1) alors kicker1 pulse avec +3 de bonus.
    l21 est une lumière , si allumée (1) alors kicker1 conserve la bille jusqu'au vidage de bonus , puis pulse.
    l20 est une lumière pour le spécial
    il y a une 3e lumière pour la spécial, mais là ; je peux faire l'impasse. mon problème est que le kicker1 marche correctement pour l44 mais pas avec l21, car il y a 2 timers differents , un pour la l21 et l'autre pour l44, et j'arrive pas a structurer logiquement mon sub (avec les if/then)

  2. #2
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    février 2006
    Messages
    1 208
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : février 2006
    Messages : 1 208
    Points : 3 294
    Points
    3 294

    Par défaut

    bonjour,

    par "l21 ne marche pas" je suppose que tu veux dire que les deux dernières conditions de Kicker1_Hit ne sont pas évaluées correctement
    le problème est qu'on ignore le contexte dans lequel le vbscript tourne (c'est un script de Visual Pinball ?)
    sous windows script host par exemple, le vbscript n'est - normalement - pas multi-threads, ce qui signifie que l'activation d'un timer figera l'exécution du script
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

  3. #3
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    mars 2016
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : mars 2016
    Messages : 6
    Points : 4
    Points
    4

    Par défaut

    merci pour ta réponse , le script est écrit pour future pinball , la table est panthera (gottlieb) . J'avais réglé le timer2 à 20000 (20s) , le temps de l'animation du vidage bonus , sauf qu'au décompte du 1er bonus , le vidage se bloque ; alors qu'il décrémente très bien jusqu'au bout. en game ou fin de game avec perte de bille ; donc çà ne vient pas du sub du bonus. il y a un conflit d'état du kicker (timer) ou bien faudrait rajouter une variable ?

    Panthéra :

    https://framadrop.org/r/wH34sI5BhI#c...ncreWyBnZgthQ=

    sinon script complet :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309
    1310
    1311
    1312
    1313
    1314
    1315
    1316
    1317
    1318
    1319
    1320
    1321
    1322
    1323
    1324
    1325
    1326
    1327
    1328
    1329
    1330
    1331
    1332
    1333
    1334
    1335
    1336
    1337
    1338
    1339
    1340
    1341
    1342
    1343
    1344
    1345
    1346
    1347
    1348
    1349
    1350
    1351
    1352
    1353
    1354
    1355
    1356
    1357
    1358
    1359
    1360
    1361
    1362
    1363
    1364
    1365
    1366
    1367
    1368
    1369
    1370
    1371
    1372
    1373
    1374
    1375
    1376
    1377
    1378
    1379
    1380
    1381
    1382
    1383
    1384
    1385
    1386
    1387
    1388
    1389
    1390
    1391
    1392
    1393
    1394
    1395
    1396
    1397
    1398
    1399
    1400
    1401
    1402
    1403
    1404
    1405
    1406
    1407
    1408
    1409
    1410
    1411
    1412
    1413
    1414
    1415
    1416
    1417
    1418
    1419
    1420
    1421
    1422
    1423
    1424
    1425
    1426
    1427
    1428
    1429
    1430
    1431
    1432
    1433
    1434
    1435
    1436
    1437
    1438
    1439
    1440
    1441
    1442
    1443
    1444
    1445
    1446
    1447
    1448
    1449
    1450
    1451
    1452
    1453
    1454
    1455
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    1467
    1468
    1469
    1470
    1471
    1472
    1473
    1474
    1475
    1476
    1477
    1478
    1479
    1480
    1481
    1482
    1483
    1484
    1485
    1486
    1487
    1488
    1489
    1490
    1491
    1492
    1493
    1494
    1495
    1496
    1497
    1498
    1499
    1500
    1501
    1502
    1503
    1504
    1505
    1506
    1507
    1508
    1509
    1510
    1511
    1512
    1513
    1514
    1515
    1516
    1517
    1518
    1519
    1520
    1521
    1522
    1523
    1524
    1525
    1526
    1527
    1528
    1529
    1530
    1531
    1532
    1533
    1534
    1535
    1536
    1537
    1538
    1539
    1540
    1541
    1542
    1543
    1544
    1545
    1546
    1547
    1548
    1549
    1550
    1551
    1552
    1553
    1554
    1555
    1556
    1557
    1558
    1559
    1560
    1561
    1562
    1563
    1564
    1565
    1566
    1567
    1568
    1569
    1570
    1571
    1572
    1573
    1574
    1575
    1576
    1577
    1578
    1579
    1580
    1581
    1582
    1583
    1584
    1585
    1586
    1587
    1588
    1589
    1590
    1591
    1592
    1593
    1594
    1595
    1596
    1597
    1598
    1599
    1600
    1601
    1602
    1603
    1604
    1605
    1606
    1607
    1608
    1609
    1610
    1611
    1612
    1613
    1614
    1615
    1616
    1617
    1618
    1619
    1620
    1621
    1622
    1623
    1624
    1625
    1626
    1627
    1628
    1629
    1630
    1631
    1632
    1633
    1634
    1635
    1636
    1637
    1638
    1639
    1640
    1641
    1642
    1643
    1644
    1645
    1646
    1647
    1648
    1649
    1650
    1651
    1652
    1653
    1654
    1655
    1656
    1657
    1658
    1659
    1660
    1661
    1662
    1663
    1664
    1665
    1666
    1667
    1668
    1669
    1670
    1671
    1672
    1673
    1674
    1675
    1676
    1677
    1678
    1679
    1680
    1681
    1682
    1683
    1684
    1685
    1686
    1687
    1688
    1689
    1690
    1691
    1692
    1693
    1694
    1695
    1696
    1697
    1698
    1699
    1700
    1701
    1702
    1703
    1704
    1705
    1706
    1707
    1708
    1709
    1710
    1711
    1712
    1713
    1714
    1715
    1716
    1717
    1718
    1719
    1720
    1721
    1722
    1723
    1724
    1725
    1726
    1727
    1728
    1729
    1730
    1731
    1732
    1733
    1734
    1735
    1736
    1737
    1738
    1739
    1740
    1741
    1742
    1743
    1744
    1745
    1746
    1747
    1748
    1749
    1750
    1751
    1752
    1753
    1754
    1755
    1756
    1757
    1758
    1759
    1760
    1761
    1762
    1763
    1764
    1765
    1766
    1767
    1768
    ' *********************************************************************
    ' **                                                                 **
    ' **                        FUTURE PINBALL                           **
    ' **                                                                 **
    ' **                   Generic Table Script v1.0                     **
    ' **                                                                 **
    ' **     (C) 2007 Chris Leathley - BSP Software Design Solutions     **
    ' **                                                                 **
    ' ** This script should provide a simple frame work you can use in   **
    ' ** your own tables as a starting point.                            **
    ' **                                                                 **
    ' *********************************************************************
     
    Option Explicit				' Force explicit variable declaration
     
    ExecuteGlobal LoadExternalScript ("ZBRrollingballsoundslib.vbs")
     
    ZRBrampHeight = 40
    ZRBtablewide = 680
     
    ZRBsoundballchan = 6
    ZRBvolNormLevel = 0.30
    ZRBrollingSound="zfx_ballrollingb2"
    ZRBPitchTunning=-40
     
    ZRBrampSoundballchan = -1  'set to -1 to disable rampsound roll
    ZRBrampVolNormLevel = 0.40
    ZRBrampRollingSound="zfx_ballrolramp"
    ZRBrampPitchTunning=40
     
     
    ' === Dynamic Flipper Settings ===
     
    Const BAM_VERSION = 0
    AddDebugText BAM_VERSION
     
    Sub BAM_Init()
       If BAM_VERSION < 233 then Exit Sub
       Set RightFlipperExt      = xBAM.Flipper("RightFlipper")
       Set LeftFlipperExt       = xBAM.Flipper("LeftFlipper")
    End Sub
     
     
    If BAM_VERSION => 233 then
    Dim RightFlipperExt,LeftFlipperExt            ' Needed for BAM
    Dim omegaCorrectionR
    Dim omegaCorrectionL
    xBAM.BallSpeedLimit = 3000
    End If
     
    Sub OnPreHitFlipperSettings(FlipperExt)
       If BAM_VERSION < 233 then Exit Sub
     OnPreHitFlipperSettings_bounceControl(FlipperExt)
    End Sub
     
    ' FLIPPER OMEGA
     
    ' You may want to adjust the strength (also called omega) of the flippers when you add dynamic flipper to other tables.  
    ' Only change the values for "MaxOmega" and "MinOmega" These settings override the flipper omega listed in the XML.  
    ' You probably will want to adjust MaxOmega between 40 and 50 and MinOmega between 29 and 33.  
    ' You need to leave the section below "MinOmega" unchanged and then go on to "BOUNCE CCONTROL" below.
     
    If BAM_VERSION => 233 then
       const MaxOmega  = 45  ' Omega at base of flipper.  Must be > MinOmega. Default = 45
       const MinOmega  = 32  ' Omega at tip of flipper. Must be < MaxOmega. Default = 32
    End If
     
    Sub RightFlipper_prehit()
       If BAM_VERSION < 233 then Exit Sub
       OnPreHitFlipperSettings(RightFlipperExt)
       omegaCorrectionR = MaxOmega - (RightFlipperExt.ContactPoint * ((MaxOmega - MinOmega)/1.2)) 
          If RightFlipperExt.ContactPoint < 0.0 then RightFlipperExt.Omega = MaxOmega
          If RightFlipperExt.ContactPoint > 1.2 then RightFlipperExt.Omega = MinOmega
          If (RightFlipperExt.ContactPoint => 0.0) And (RightFlipperExt.ContactPoint =< 1.2) then 
             RightFlipperExt.Omega = omegaCorrectionR
          End if
    End Sub
     
    Sub LeftFlipper_prehit()
       If BAM_VERSION < 233 then Exit Sub
       OnPreHitFlipperSettings(LeftFlipperExt)
          omegaCorrectionL = MaxOmega - (LeftFlipperExt.ContactPoint * ((MaxOmega - MinOmega)/1.2))
          If LeftFlipperExt.ContactPoint < 0.0 then LeftFlipperExt.Omega = MaxOmega
          If LeftFlipperExt.ContactPoint > 1.2 then LeftFlipperExt.Omega = MinOmega
          If (LeftFlipperExt.ContactPoint => 0.0) And (LeftFlipperExt.ContactPoint =< 1.2) then 
             LeftFlipperExt.Omega = omegaCorrectionL
          End if
    End Sub
     
    ' BOUNCE CCONTROL
     
    ' Bounce control is the amount of bounce the ball makes when it hits the flippers.  You may want to leave these settings unchanged.  
    ' I would suggest small changes here of "base_elasticCoef" and "expected_ball_speed_after_hit".
     
    '(Note that bounce control over rides flipper elasticity listed in the XML. See lines "RightFlipperExt.Omega ="/"RightFlipperExt.Omega=")
    Sub OnPreHitFlipperSettings_bounceControl(FlipperExt)
       If BAM_VERSION < 233 then Exit Sub
       ' Params to tweak
       const base_elasticCoef                        = 0.90 ' very bouncy flipper rubber
       const expected_ball_speed_after_hit           = 350  ' calc elasticCoef to get desired ball speed after ball hit flipper
       const minimum_elasticCoef_to_scale_fast_balls = 0.15 ' we will add this to calculated elastiCoef, so ball after hit will have aditional 5% of speed before hit
       const reduction_for_flipper_in_motion         = 0.17 ' if flipper is not in starting point, reduce elasticCoef by 20%
     
       If FlipperExt.Hit Then
          Dim elasticCoef 
          Dim maxElasticCoef
          Dim ballSpeed
          ballSpeed = (FlipperExt.BallVSpeed + xBAM.Ball.Speed) * 0.5 ' averge speed of 
     
          maxElasticCoef = base_elasticCoef
          If FlipperExt.AngleDiff > 1 Then maxElasticCoef = maxElasticCoef - reduction_for_flipper_in_motion
     
          elasticCoef = base_elasticCoef
          If ballSpeed > 1 Then elasticCoef = expected_ball_speed_after_hit / ballSpeed
          elasticCoef = elasticCoef + minimum_elasticCoef_to_scale_fast_balls
     
          If elasticCoef > maxElasticCoef Then elasticCoef = maxElasticCoef
     
          FlipperExt.SetMaterial elasticCoef 
       End If
    End Sub
    ' === End of Dynamic Flipper Settings ===
     
     
     
    ' Define any Constants 
    Const constMaxPlayers 		= 4 		' Maximum number of players per game (between 1 and 4)
    Const constBallSaverTime	= 5000	' Time in which a free ball is given if it lost very quickly
    												' Set this to 0 if you don't want this feature
    Const constMaxMultiplier	= 6		' Defines the maximum bonus multiplier level
     
    ' Define Global Variables
    '
    Dim PlayersPlayingGame		' number of players playing the current game
    Dim CurrentPlayer				' current player (1-4) playing the game
    Dim BonusPoints(4)			' Bonus Points for the current player
    Dim BonusMultiplier(4)		' Bonus Multiplier for the current player
    Dim BallsRemaining(4)		' Balls remaining to play (inclusive) for each player
    Dim ExtraBallsAwards(4)		' number of EB's out-standing (for each player)
     
    ' Define Game Control Variables
    Dim LastSwitchHit				' Id of last switch hit
    Dim BallsOnPlayfield			' number of balls on playfield (multiball exclusive)
    Dim BallsInLock				' number of balls in multi-ball lock
     
    ' Define Game Flags
    Dim bFreePlay					' Either in Free Play or Handling Credits
    Dim bOnTheFirstBall			' First Ball (player one). Used for Adding New Players
    Dim bBallInPlungerLane		' is there a ball in the plunger lane
    Dim bBallSaverActive			' is the ball saver active 
    Dim bMultiBallMode			' multiball mode active ?
    Dim bEnteringAHighScore		' player is entering their name into the high score table
     
    Dim Bonus
    Dim AwardPoints
    Dim bExtraBallWonThisBall
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **               Future Pinball Defined Script Events              **
    ' **                                                                 **
    ' *********************************************************************
     
     
    ' The Method Is Called Immediately the Game Engine is Ready to 
    ' Start Processing the Script.
    '
    Sub FuturePinball_BeginPlay()
    	' seed the randomiser (rnd(1) function)
    	Randomize
    	initTrakedSoundBalls() 
    	' initalise the player display reel to the last known player scores 
    	DispSeg1.SetValue(nvScore1)
    	DispSeg2.SetValue(nvScore2)
    	DispSeg3.SetValue(nvScore3)
    	DispSeg4.SetValue(nvScore4)
         DispSegBallInPlay.setvalue(nvBallsPerGame)
     
    	' we use the match display to hold the number of credits
    	DispSegMatch.SetValue(nvCredits)
    	DispSegBallInPlay.SetValue(0)
     
    	' We want the player to put in credits (Change this 
    	bFreePlay = FALSE
     
    	' kill the last switch hit (this this variable is very usefull for game control)
    	set LastSwitchHit = DummyTrigger
     
    	' initialse any other flags
    	bOnTheFirstBall = FALSE
    	bEnteringAHighScore	= FALSE
    	BallsOnPlayfield = 0
    	BallsInLock	= 0
     
    	EndOfGame()
    End Sub
     
     
    ' This Method is Called when the user has exited the Game Player. It should
    ' save any RAM variables that need to be persistant.
    '
    Sub FuturePinball_EndPlay()
    End Sub
     
     
    ' The User Has Pressed A Key on the Keyboard..
    '
    Sub FuturePinball_KeyPressed(ByVal KeyCode)
    	'AddDebugText "KeyCode = " & KeyCode
    	'AddDebugText "Titled = " & fpTilted
    	'
    	' Process any keys which are valid at all times
    	'
     
    	' The Player has Inserted a Coin
    	If (KeyCode = GetKeyCode(InsertCoinKey)) Then
    		PlaySound "CoinIn"
    		nvCredits = nvCredits + 1
    		DispSegMatch.SetValue(nvCredits)
    		'AddDebugText "Insert Coin, Credits = " & nvCredits
    		' If not Tilted, then give some feed back to the player
    		If (fpTilted = FALSE) Then
    			' Flash the Slingshot Bulbs. This is rather Common on Pinball machines
    			' though you can do anything at this point
    			LeftSlingshotBulb1.FlashForMs  200, 100, BulbOff
    			LeftSlingshotBulb2.FlashForMs  200, 100, BulbOff
    			RightSlingshotBulb1.FlashForMs 200, 100, BulbOff
    			RightSlingshotBulb2.FlashForMs 200, 100, BulbOff
    			' Maybe play a sound at this point or put something on the display
    		End If
    	End If
     
    	' The Player is Pulling back the Plunger
    	If (KeyCode = GetKeyCode(PlungerKey)) Then
    		Plunger.Pull
    	End If
     
     
    	'
    	' Process The Next set of keys depeding of wether there is a game in progress or not
    	'
     
    	' Is A Game in Progress?
    	If (fpGameInPlay = TRUE) Then
    		' and not Tilted ?
    		If (fpTilted = FALSE) Then
     
    			' If the Left Flipper Key Has Been Press, Activate The Left Flipper(s)
    			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
    				LeftFlipper.SolenoidOn
    				PlaySound "Flipper"
    			End If
     
    			' If the Right Flipper Key Has Been Press, Activate The Right Flipper(s)
    			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
    				RightFlipper.SolenoidOn
    				PlaySound "Flipper"
    			End If
     
    			' Another player starting?
    			If (KeyCode = GetKeyCode(StartGameKey)) Then
    				' must be less than max players and must be on the the very first ball of the game
    				If ((PlayersPlayingGame < constMaxPlayers) And (bOnTheFirstBall = TRUE)) Then
    					' free play or credits
    					If (bFreePlay = TRUE) Then
    						' add the extra player
    						PlayersPlayingGame = PlayersPlayingGame + 1
    						'AddDebugText "Extra Player (Free Play)" & PlayersPlayingGame
    						' Update the stats
    						nvTotalGamesPlayed = nvTotalGamesPlayed + 1
    					Else
    						If (nvCredits > 0) then
    							PlayersPlayingGame = PlayersPlayingGame + 1
    							'AddDebugText "Extra Player (Credits)" & PlayersPlayingGame
    							' update the stats
    							nvTotalGamesPlayed = nvTotalGamesPlayed + 1
    							nvCredits = nvCredits - 1
    						Else
    							' Not Enough Credits to start a game.  
    							' Maybe Play a Sound or put "Insert Coin" on a display
    						End If
    					End If
    				End If
    			End If
    		End If ' If (fpTilted)
     
    	Else	' If (fpGameInPlay)
     
    		' there isn't a game in play (we are in the attract mode)
          ' wait for the start key to be pressed and start a new game
          If (KeyCode = GetKeyCode(StartGameKey)) Then
    			' Free Play Mode ?
    			If (bFreePlay = TRUE) Then
    				' Yep.  Only allow a game to Start if there are no balls on the playfield.
    				' This can happen if the player starts a game too quick after finishing the
    				' last game and the machine is ejecting any locked balls.
    				If (BallsOnPlayfield = 0) Then
    					' A Game is now in progress, reset the table for a new Game
    					ResetForNewGame()
    				End If
    			Else
    				' paying by credits, do we have any ?
    				If (nvCredits > 0) Then
    					' Yep.  Only allow a game to start if there are no balls on the playfield
    					If (BallsOnPlayfield = 0) Then
    						' remove a credit
    						nvCredits = nvCredits - 1
    						' much the same as above
    						ResetForNewGame()
    					End If
    				Else
    					' Not Enough Credits to start a game.  
    					' Maybe Play a Sound or put "Insert Coin" on a display
    				End If
    			End If
    		End If
     
    	End If ' If (fpGameInPlay)
    End Sub
     
     
    ' The User Has Released A Key on the Keyboard..
    '
    Sub FuturePinball_KeyReleased(ByVal KeyCode)
     
    	'
    	' Process any keys which are valid at all times
    	'
     
    	' The Player has released the Plunger, Let it go..
    	If (KeyCode = GetKeyCode(PlungerKey)) Then
    		Plunger.LetGo
    		PlaySound "PlungerRelease"
    	End If
     
    	'
    	' Process The Next set of keys depeding of wether there is a game in progress or not
    	'
     
    	' Is A Game in Progress?
    	If (fpGameInPlay = TRUE) Then
    		' and not tilted
    		If (fpTilted = FALSE) Then
     
    			' The Left Flipper Key has been released, Turn Off the Left Flipper(s)
    			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
    				LeftFlipper.SolenoidOff
    			End If
     
    			' The Right Flipper Key has been released, Turn Off the Right Flipper(s)
    			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
    				RightFlipper.SolenoidOff
    			End If
    		End If
    	End If
    End Sub
     
     
    ' The User Has Paused The Game.. 
    '
    Sub FuturePinball_Paused()
    End Sub
     
     
    ' The User Has UnPaused (Resumed) The Game.. 
    '
    Sub FuturePinball_UnPaused()
    End Sub
     
     
    ' The Played has Nudged the Table a little too hard/much and a Warning
    ' must be given to the player
    '
    Sub FuturePinball_TiltWarning(ByVal Warnings)
    	'AddDebugText "Tilt Warning" & Warnings
     
    	' play a sound at this point and put something on a display
    End Sub
     
     
    ' The Player has tilted the machine (Too Many Warnings)
    '
    Sub FuturePinball_Tilted()
    	'AddDebugText "**Tilted**"
     
    	' play a sound
    	PlaySound "Tilt"
     
    	' ensure that the flippers are down (as the keys won't work from now on)
    	LeftFlipper.SolenoidOff
    	RightFlipper.SolenoidOff
     
    	' you may wish to turn off any lights at this point. (The Light Sequencer
    	' will make this very easy)
     
    	' start the tilt recovery timer which waits until all balls have drained
    	' before doing the end of ball sequence (or end of game)
    	TiltRecoveryTimer.Interval = 2000
    	TiltRecoveryTimer.Enabled	= TRUE
    End Sub
     
     
    ' A Music Channel has finished Playing. 
    '
    ' Channel is set to the channel number that has finished.
    '
    Sub FuturePinball_MusicFinished(ByVal Channel)
    End Sub
     
     
    ' High Score entry has been completed by the player. 
    '
    ' Position is set to the position in the high score table (1 - 4)
    ' if it is set to 0 then there was no new High Score
    '
    ' Special is set to 1 if the Special High Score was beaten
    '
    Sub FuturePinball_NameEntryComplete(ByVal Position, ByVal Special)
    	' has the player beaten a high score
    	If (Position <> 0) Then
    		' maybe award something (like an extra credit) based on the high score position
    	End If
     
    	' has the player beaten the special score (if applicable)
    	If (Special <> 0) Then
    	End If
     
    	bEnteringAHighScore = FALSE
     
    	' check to see if there are any more players playing to the current game
    	EndOfBallComplete()
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                     User Defined Script Events                  **
    ' **                                                                 **
    ' *********************************************************************
     
    ' Initialise the Table for a new Game
    '
    Sub ResetForNewGame()
    	Dim	i
     
    	'AddDebugText "ResetForNewGame"
     
    	' get Future Pinball to zero out the nvScore (and nvSpecialScore) Variables
    	' aswell and ensure the camera is looking in the right direction.
    	' this also Sets the fpGameInPlay flag
    	BeginGame()
     
     
     
    	' increment the total number of games played
       nvTotalGamesPlayed = nvTotalGamesPlayed + 1
     
    	' Start with player 1
    	CurrentPlayer = 1
     
    	' Single player (for now, more can be added in later)
    	PlayersPlayingGame = 1
     
    	' We are on the First Ball (for Player One)
    	bOnTheFirstBall = TRUE
     
    	' initialise all the variables which are used for the duration of the game
    	' (do all players incase any new ones start a game)
    	For i = 1 To constMaxPlayers
    		' Bonus Points for the current player
    		BonusPoints(i)	= 0
    		' Initial Bonus Multiplier
    		BonusMultiplier(i) = 1
    		' Balls Per Game
    		BallsRemaining(i) = nvBallsPerGame 
    		' Number of EB's out-standing
    		ExtraBallsAwards(i) = 0
    	Next
     
    	' initialise any other flags
    	bMultiBallMode = FALSE
     
    	' you may wish to start some music, play a sound, do whatever at this point
     
    	' set up the start delay to handle any Start of Game Attract Sequence
    	FirstBallDelayTimer.Interval = 500
    	FirstBallDelayTimer.Enabled = TRUE
    End Sub
     
     
    ' This Timer is used to delay the start of a game to allow any attract sequence to 
    ' complete.  When it expires it creates a ball for the player to start playing with
    '
    Sub FirstBallDelayTimer_Expired()
    	' stop the timer
    	FirstBallDelayTimer.Enabled = FALSE
     
    	' reset the table for a new ball
    	ResetForNewPlayerBall()
     
    	' create a new ball in the shooters lane
    	CreateNewBall()
    End Sub
     
     
    ' (Re-)Initialise the Table for a new ball (either a new ball after the player has 
    ' lost one or we have moved onto the next player (if multiple are playing))
    '
    Sub ResetForNewPlayerBall()
    	' make sure the correct display is upto date
    	AddScore(0)
    	bonus=0
     
    	' set the current players bonus multiplier back down to 1X
    	SetBonusMultiplier(1)
     
    	' reset any drop targets, lights, game modes etc..
    	ShootAgainLight.State = 0
    	la1.state=0:la2.state=0:la3.state=0:la4.state=0
    	ld1.state=0:ld2.state=0:ld3.state=0:ld4.state=0
    	lc1.state=0:lc2.state=0:lc3.state=0:lc4.state=0
    	u1.state=0:u2.state=0:u3.state=0:u4.state=0
    	l16.state=0:l17.state=0:l18.state=0:l19.state=0
    	l20.state=0:l21.state=0:l41.state=0:l42.state=0
    	l43.state=0:l23.state=0:l40.state=0:l44.state=0
    	x2.state=0:x3.state=0:x4.state=0:x5.state=0:l22.state=0
    	b1.state=0:b2.state=0:b3.state=0:b4.state=0
    	b5.state=0:b6.state=0:b7.state=0:b8.state=0
    	b9.state=0:b10.state=0:b20.state=0:l45.state=0
     
    	' set the ball in play display
    	Dim BallInPlay
    	BallInPlay = nvBallsPerGame - BallsRemaining(CurrentPlayer) + 1
    	DispSegBallInPlay.SetValue(BallInPlay)
     
    End Sub
     
     
    ' Create a new ball on the Playfield
    '
    Sub CreateNewBall()
    	' create a ball in the plunger lane kicker.
    	PlungerKicker.CreateBall
    	addTrackedBall(PlungerKicker)
     
    	' There is a (or another) ball on the playfield
    	BallsOnPlayfield = BallsOnPlayfield + 1
     
    	' kick it out..
    	PlungerKicker.SolenoidPulse
    End Sub
     
     
    ' The Player has lost his ball (there are no more balls on the playfield).
    ' Handle any bonus points awarded
    '
    Sub EndOfBall()
    	Dim BonusDelayTime
     
    	'AddDebugText "EndOfBall"
     
    	' the first ball has been lost. From this point on no new players can join in
    	bOnTheFirstBall = FALSE
     
    	' only process any of this if the table is not tilted.  (the tilt recovery 
    	' mechanism will handle any extra balls or end of game)
    	If (fpTilted = FALSE) Then
    		'Dim AwardPoints
     
    		' add in any bonus points (multipled by the bunus multiplier)
    		AwardPoints = BonusPoints(CurrentPlayer) * BonusMultiplier(CurrentPlayer)
    		AddScore(AwardPoints)
    		'AddDebugText "Bonus Points = " & AwardPoints
     
    		' you may wish to do some sort of display effects which the bonus is 
    		' being added to the players score
     
    		' add a bit of a delay to allow for the bonus points to be added up
    		BonusDelayTime = 1000
    	Else
    		' no bonus, so move to the next state quickly
    		BonusDelayTime = 20
    	End If
     
    	' start the end of ball timer which allows you to add a delay at this point
    	EndOfBallTimer.Interval = BonusDelayTime
    	EndOfBallTimer.Enabled = TRUE
    End Sub
     
     
    ' The Timer which delays the machine to allow any bonus points to be added up
    ' has expired.  Check to see if there are any extra balls for this player.
    ' if not, then check to see if this was the last ball (of the currentplayer)
    '
    Sub EndOfBallTimer_Expired()
    	' disable the timer
    	EndOfBallTimer.Enabled = FALSE
    	' have we finished counting down the bonus ?
    	If Bonus = 0 Then
    		' if were tilted, reset the internal tilted flag (this will also 
    		' set fpTiltWarnings back to zero) which is useful if we are changing player LOL
    		fpTilted = FALSE
    		' has the player won an extra-ball ? (might be multiple outstanding)
    		If (ExtraBallsAwards(CurrentPlayer) <> 0) Then
    			'AddDebugText "Extra Ball"
    			' yep got to give it to them
    			ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) - 1
    			' if no more EB's then turn off any shoot again light
    			If (ExtraBallsAwards(CurrentPlayer) = 0) Then
    				ShootAgainLight.State = BulbOff
    			End If
    				' You may wish to do a bit of a song and dance at this point
    				' Create a new ball in the shooters lane
    				CreateNewBall()
    			Else		' no extra balls
    			BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) - 1
    			' was that the last ball ?
    			If (BallsRemaining(CurrentPlayer) <= 0) Then
    				'AddDebugText "No More Balls, High Score Entry"
    				' Submit the currentplayers score to the High Score system built into Future Pinball
    				' if they have gotten a high score then it will ask them for their initials.  If not
    				' it will call the FuturePinball_NameEntryComplete right away
    				bEnteringAHighScore = TRUE
    				EnterHighScore(CurrentPlayer)
    				' you may wish to play some music at this point
    				Else
    				' not the last ball (for that player)
    				' if multiple players are playing then move onto the next one
    				EndOfBallComplete()
    			End If
    		End If
    		Else	
    		' we are still counting down the bonus ?
    		If (Bonus > 0) Then
    			' minus one from the bonus strip (this also updates the lights)
    			IncrementBonus(-1)
    		End If
    		' add in any bonus points (multipled by the bunus multiplier)
    		'Dim AwardPoints
    		AwardPoints = 1000 * BonusMultiplier(CurrentPlayer)
    		AddScore(AwardPoints)
    		' play a sound
    		PlaySound "Bonus"
    		' set the timer to repeat, but quicker each time
    		If (EndOfBallTimer.Interval > 50) Then
    			EndOfBallTimer.Interval = EndOfBallTimer.Interval - 50
    		End If
    		EndOfBallTimer.Enabled = True
    	End If
    End Sub
     
     
    ' This function is called when the end of bonus display
    ' (or high score entry finished) and it either end the game or
    ' move onto the next player (or the next ball of the same player)
    '
    Sub EndOfBallComplete()
      Dim NextPlayer
     
    	'AddDebugText "EndOfBall - Complete"
     
    	' are there multiple players playing this game ?
    	If (PlayersPlayingGame > 1) Then
    		' then move to the next player
    		NextPlayer = CurrentPlayer + 1
    		' are we going from the last player back to the first
    		' (ie say from player 4 back to player 1)
    		If (NextPlayer > PlayersPlayingGame) Then
    			NextPlayer = 1
    		End If
    	Else
    		NextPlayer = CurrentPlayer
    	End If
     
    	'AddDebugText "Next Player = " & NextPlayer
     
       ' is it the end of the game ? (all balls been lost for all players)
    	If ((BallsRemaining(CurrentPlayer) <= 0) And (BallsRemaining(NextPlayer) <= 0)) Then
    		' you may wish to do some sort of Point Match free game award here
    		' generally only done when not in free play mode
    		' set the machine into game over mode
    		EndOfGame()
    		' if not in free play mode
    		If (bFreePlay <> True) Then
    			Dim i
    			Dim RndMatch
    			Dim Last2Digits
    			' do the match feature.  on older game this is quiet simple and 
    			' just picks a single number and uses that..
    			RndMatch = int(Rnd(1) * 10)   ' pick a number between 0 and 9
    			RndMatch = RndMatch * 10      ' convert it to 00 -> 90
    			' put it on the display
    			DispSegMatch.SetValue(RndMatch)
    			' have any of the got this value as the last 2 digits of their score
    			For i = 1 To PlayersPlayingGame
    				Last2Digits = nvScore(i) mod 100
    				' if they match then award a free credit
    				If (Last2Digits = RndMatch) Then
    					AwardFreeCredit(1)
    				End If
    			Next
    		End If
    		' you may wish to put a Game Over message on the 
    		Else
    		' set the next player
    		CurrentPlayer = NextPlayer
    		' make sure the correct display is upto date
    		AddScore(0)
    		' reset the playfield for the new player (or new ball)
    		ResetForNewPlayerBall()
    		' and create a new ball
    		CreateNewBall()
    	End If
    End Sub
    Sub AwardFreeCredit(Credits)
    	' set the amount of games (credits) to award (accumlative)
    	AwardKnockerTimer.UserData = AwardKnockerTimer.UserData + Credits
    	' start the timer which awards the credit and fires the backbox knocker
    	If (AwardKnockerTimer.Enabled = False) Then
    		AwardKnockerTimer.Set True, 500
    	End If
    End Sub
     
    ' the award kocker timer has expired, make a noise and award a credit
    '
    Sub AwardKnockerTimer_Expired()
    	' disable the timer
    	AwardKnockerTimer.Enabled = False
    	' increment the credits
    	nvCredits = nvCredits + 1
    	' player the knocker sound
    	PlaySound "Knocker"
    	' one less to award
    	AwardKnockerTimer.UserData = AwardKnockerTimer.UserData - 1
    	' if any more still outstanding then do it all again
    	If (AwardKnockerTimer.UserData > 0) Then
    		AwardKnockerTimer.Set True, 500
    	End If
    End Sub
     
     
    ' This frunction is called at the End of the Game, it should reset all
    ' Drop targets, and eject any 'held' balls, start any attract sequences etc..
    Sub EndOfGame()
    	'AddDebugText "End Of Game"
    	DispSeg1.ResetToZero
    	DispSeg2.ResetToZero
    	DispSeg3.ResetToZero
    	DispSeg4.ResetToZero
    'dt
    	a1.solenoidpulse:a2.solenoidpulse:a3.solenoidpulse:a4.solenoidpulse
    	d1.solenoidpulse:d2.solenoidpulse:d3.solenoidpulse:d4.solenoidpulse
    	c1.solenoidpulse:c2.solenoidpulse:c3.solenoidpulse:c4.solenoidpulse
     
    	' let Future Pinball know that the game has finished.  
    	' This also clear the fpGameInPlay flag.
    	EndGame()
     
    	' ensure that the flippers are down
    	LeftFlipper.SolenoidOff
    	RightFlipper.SolenoidOff
     
    	' turn off the reel bulbs
     
     
    	' set any lights for the attract mode
    	SetAllLightsForAttractMode()
     
    	' dt
    	La1.Set	BulbBlink, "0001000100011111110101010101", 150
    	La2.Set	BulbBlink, "0100010001111111101010101010", 150
    	La3.Set	BulbBlink, "0010001111111111110101010101", 150
    	La4.Set	BulbBlink, "0001111111111111101010101010", 150
     
    	Ld1.Set	BulbBlink, "0001000100011111110101010101", 150
    	Ld2.Set	BulbBlink, "0100010001111111101010101010", 150
    	Ld3.Set	BulbBlink, "0010001111111111110101010101", 150
    	Ld4.Set	BulbBlink, "0001111111111111101010101010", 150
     
    	Lc1.Set	BulbBlink, "0001000100011111110101010101", 150
    	Lc2.Set	BulbBlink, "0100010001111111101010101010", 150
    	Lc3.Set	BulbBlink, "0010001111111111110101010101", 150
    	Lc4.Set	BulbBlink, "0001111111111111101010101010", 150
     
     
    	' bonus
    	b1.Set		BulbBlink, "100000100000", 75
    	b2.Set		BulbBlink, "010000010000", 75
    	b3.Set		BulbBlink, "001000001000", 75
    	b4.Set		BulbBlink, "000100000100", 75
    	b5.Set		BulbBlink, "000010000010", 75
    	b6.Set		BulbBlink, "000001000001", 75
    	b7.Set		BulbBlink, "100000100000", 75
    	b8.Set 		BulbBlink, "010000010000", 75
    	b9.Set 		BulbBlink, "001000001000", 75
    	b10.Set		BulbBlink, "000100000100", 75
    	b20.Set		BulbBlink, "000010000010", 75
     
     
    	' Outlane and Inlane Lights
    	L16.Set	BulbBlink, "01010000", 100
    	L17.Set	BulbBlink, "00000101", 100
    	L18.Set	BulbBlink, "00000101", 100
    	L19.Set   BulbBlink, "01010000", 100
    	L20.Set	BulbBlink, "00000101", 100
    	L21.Set   BulbBlink, "01010000", 100
     
     
    	' Bonus Multiplier Lights
    	x2.Set		BulbBlink, "1000010", 150
    	x3.Set		BulbBlink, "0100100", 150
    	x4.Set		BulbBlink, "0100100", 150
    	x5.Set		BulbBlink, "1000010", 150
     
    	' Top Rollover Lights
    	u1.Set		BulbBlink, "10100000", 150
    	u2.Set		BulbBlink, "00001010", 150
    	u3.Set		BulbBlink, "10100000", 150
    	u4.Set		BulbBlink, "00001010", 150
     
    	l41.Set		BulbBlink, "1000010", 150
    	l42.Set		BulbBlink, "0100100", 150
    	l43.Set		BulbBlink, "0010001", 150
     
    	l22.Set		BulbBlink, "10110010", 150
    	l44.Set		BulbBlink, "01001101", 150
     
     
    	' you may wish to light any Game Over Light you may have
    End Sub
     
     
    ' The tilt recovery timer waits for all the balls to drain before continuing on 
    ' as per normal
    '
    Sub TiltRecoveryTimer_Expired()
    	' disable the timer
    	TiltRecoveryTimer.Enabled	= FALSE
    	' if all the balls have been drained then..
    	If (BallsOnPlayfield = 0) Then
    		' do the normal end of ball thing (this dosn't give a bonus if the table is tilted)
    		EndOfBall()
    	Else
    		' else retry (checks again in another second)
    		TiltRecoveryTimer.Interval = 1000
    		TiltRecoveryTimer.Enabled = TRUE
    	End If
    End Sub
     
     
    ' Set any lights for the Attract Mode.
    '
    Sub SetAllLightsForAttractMode()
    	ShootAgainLight.State = BulbBlink
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                   Drain / Plunger Functions                     **
    ' **                                                                 **
    ' *********************************************************************
     
    ' lost a ball ;-( check to see how many balls are on the playfield.
    ' if only one then decrement the remaining count and test for End of game
    ' if more than 1 ball (multi-ball) then kill of the ball but don't create
    ' a new one
    '
    Sub Drain_Hit()
    	' Destroy the ball
    	Drain.DestroyBall
    	BallsOnPlayfield = BallsOnPlayfield - 1
    	' pretend to knock the ball into the ball storage mech
    	PlaySound "Drain"
     
    	' if there is a game in progress and 
    	If (fpGameInPlay = TRUE) And (fpTilted = FALSE) Then
     
    		' is the ball saver active,
    		If (bBallSaverActive = TRUE) Then
     
    			' yep, create a new ball in the shooters lane
    			CreateNewBall()
    			' you may wish to put something on a display or play a sound at this point
     
    		Else
     
    			' cancel any multiball if on last ball (ie. lost all other balls)
    			'
    			If (BallsOnPlayfield = 1) Then
    				' and in a multi-ball??
    				If (bMultiBallMode = True) then
    					' not in multiball mode any more
    					bMultiBallMode = False
    					' you may wish to change any music over at this point and
    					' turn off any multiball specific lights
    				End If
    			End If
     
    			' was that the last ball on the playfield
    			If (BallsOnPlayfield = 0) Then
    				' handle the end of ball (change player, high score entry etc..)
    				EndOfBall()
    			End If
     
    		End If
    	End If
    End Sub
     
     
    ' A ball is pressing down the trigger in the shooters lane
    '
    Sub PlungerLaneTrigger_Hit()
    	bBallInPlungerLane = TRUE
     
    	' remember last trigger hit by the ball
    	set LastSwitchHit = PlungerLaneTrigger
    End Sub
     
     
    ' A Ball may of rolled into the Plunger Lane Kicker, if so then kick it 
    ' back out again
    '
    Sub PlungerKicker_Hit()
    	PlungerKicker.SolenoidPulse
    End Sub
     
     
    ' The Ball has rolled out of the Plunger Lane.  Check to see if a ball saver machanisim
    ' is needed and if so fire it up.
    '
    Sub PlungerLaneGate_Hit()
    	' if there is a need for a ball saver, then start off a timer
    	' only start if it is currently not running, else it will reset the time period
    	If (constBallSaverTime <> 0) And (bBallSaverActive <> TRUE) Then
    		' and only if the last trigger hit was the plunger wire. 
    		' (ball in the shooters lane)
    		If (LastSwitchHit.Name = "PlungerLaneTrigger") Then
    			' set our game flag
    			bBallSaverActive = TRUE
    			' start the timer
    			BallSaverTimer.Enabled = FALSE
    			BallSaverTimer.Interval = constBallSaverTime
    			BallSaverTimer.Enabled = TRUE
    			' if you have a ball saver light you might want to turn it on at this 
    			' point (or make it flash)
    		End If
    	End If
    End Sub
     
     
    ' The ball saver timer has expired.  Turn it off and reset the game flag
    '
    Sub BallSaverTimer_Expired()
    	' stop the timer from repeating
    	BallSaverTimer.Enabled = FALSE
    	' clear the flag
    	bBallSaverActive = FALSE
    	' if you have a ball saver light then turn it off at this point
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                   Supporting Score Functions                    **
    ' **                                                                 **
    ' *********************************************************************
     
     
    Sub AddScore(points)
    	If (fpTilted = FALSE) Then
    		nvScore(CurrentPlayer) = nvScore(CurrentPlayer) + points
    		Select Case (CurrentPlayer)
    			Case 1:	DispSeg1.AddValue(points)
    			Case 2:	DispSeg2.AddValue(points)
    			Case 3:	DispSeg3.AddValue(points)
    			Case 4:	DispSeg4.AddValue(points)
    		End Select
    	End if
    End Sub
     
     
    '**************JACKPOT**************
     
     
    Sub AddJackpot(points)
    	If (fpTilted = False) Then
    		If (bMultiBallMode = TRUE) Then
    			nvJackpot = nvJackpot + points
    			' you may wish to limit the jackpot to a upper limit, ie..
    			'	If (nvJackpot >= 6000) Then
    			'		nvJackpot = 6000
    			' 	End if
    		End if
    	End if
    End Sub
     
     
    ' Will increment the Bonus Multiplier to the next level
    '
    Sub IncrementBonusMultiplier()
    	Dim NewBonusLevel
    	if (BonusMultiplier(CurrentPlayer) < constMaxMultiplier) then
    		' then set it the next next one and set the lights
    		NewBonusLevel = BonusMultiplier(CurrentPlayer) + 1
    		SetBonusMultiplier(NewBonusLevel)
       End if
    End Sub
     
     
    '*************MULTIPLIER**************
     
     
    Sub SetBonusMultiplier(Level)
    	' Set the multiplier to the specified level
    	BonusMultiplier(CurrentPlayer) = Level
     
    	' If the multiplier is 1 then turn off all the bonus lights
    	If (BonusMultiplier(CurrentPlayer) = 1) Then
    		x2.State = 0
    		x3.State = 0
    		x4.State = 0
    		x5.State = 0
    		Else
    		' there is a bonus, turn on all the lights upto the current level
    		If (BonusMultiplier(CurrentPlayer) >= 2) Then
    			x2.FlashForMs 1000, 100, BulbOn
    		End If
    		If (BonusMultiplier(CurrentPlayer) >= 3) Then
    			x3.FlashForMs 1000, 100, BulbOn
    		End If
    		If (BonusMultiplier(CurrentPlayer) >= 4) Then
    			x4.FlashForMs 1000, 100, BulbOn
    		End If
    		If (BonusMultiplier(CurrentPlayer) >= 5) Then
    			x5.FlashForMs 1000, 100, BulbOn
    		End If
    	End If
    End Sub
     
    '*********EXTRABALL**************
     
    Sub AwardExtraBall()
    	ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
    	bExtraBallWonThisBall = TRUE
    	If (LightShootAgain.State = 0) Then
    		LightShootAgain.State = 1
    	End if
    End Sub
     
    '************BONUS***************
     
    Sub IncrementBonus(Amount)
    	Dim Value
    	Bonus = Bonus + Amount
    	If (Bonus > 20) Then
    		Bonus = 20
    		l21.state=1
    	End If
    	If (Amount >= 0) Then
    		PlaySound ""
    	End If
    	b1.State = 0
    	b2.State = 0
    	b3.State = 0
    	b4.State = 0
    	b5.State = 0
    	b6.State = 0
    	b7.State = 0
    	b8.State = 0
    	b9.State = 0
    	b10.State = 0
    	b20.State = 0
    	Value = Bonus
     
    	If (Value >= 20) Then
    		b20.Set BulbBlink, "10", 150
    		Value = Value - 20
    		b1.Set	BulbBlink, "100000100000", 75
    		b2.Set	BulbBlink, "010000010000", 75
    		b3.Set	BulbBlink, "001000001000", 75
    		b4.Set	BulbBlink, "000100000100", 75
    		b5.Set	BulbBlink, "000010000010", 75
    		b6.Set	BulbBlink, "000001000001", 75
    		b7.Set	BulbBlink, "100000100000", 75
    		b8.Set	BulbBlink, "010000010000", 75
    		b9.Set	BulbBlink, "001000001000", 75
    		b10.Set   BulbBlink, "000100000100", 75
    	End If
     
     
    	If (Value >= 10) Then
    		b10.State = 1
    		Value = Value - 10
    	End If
     
     
    	if (Value >= 9) Then b9.State = 1 End If
    	if (Value >= 8) Then b8.State = 1 End If
    	if (Value >= 7) Then b7.State = 1 End If
    	if (Value >= 6) Then b6.State = 1 End If
    	if (Value >= 5) Then b5.State = 1 End If
    	if (Value >= 4) Then b4.State = 1 End If
    	if (Value >= 3) Then b3.State = 1 End If
    	if (Value >= 2) Then b2.State = 1 End If
    	if (Value >= 1) Then b1.State = 1 End If
    End Sub
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                     Table Object Script Events                  **
    ' **                                                                 **
    ' *********************************************************************
     
    ' The Left Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
    '
    Sub LeftSlingshotRubber_Hit()
    	' add some points
    	AddScore(50)
    	' flash the lights around the slingshot
    	LeftSlingshotBulb1.FlashForMs 100, 50, BulbOff
    	LeftSlingshotBulb2.FlashForMs 100, 50, BulbOff
    End Sub
     
     
    ' The Right Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
    '
    Sub RightSlingshotRubber_Hit()
    	' add some points
    	AddScore(50)
    	' flash the lights around the slingshot
    	RightSlingshotBulb1.FlashForMs 100, 50, BulbOff
    	RightSlingshotBulb2.FlashForMs 100, 50, BulbOff
    End Sub
     
     
    ' The Left InLane trigger has been Hit
    '
    Sub LeftInLaneTrigger_Hit()
    	If (l17.State <> 0) Then
    		AddScore(5000)
    		Else
    		AddScore(500)
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = LeftInLaneTrigger
    End Sub
     
     
    ' The Right InLane trigger has been Hit
    '
    Sub RightInLaneTrigger_Hit()
    	If (l18.State <> 0) Then
    		AddScore(5000)
    		Else
    		AddScore(500)
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = RightInLaneTrigger
    End Sub
     
     
    ' The Left OutLane trigger has been Hit
    '
    Sub LeftOutLaneTrigger_Hit()
    	If (l16.State <> 0) Then
    		AddScore(5000)
    		Else
    		AddScore(500)
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = LeftOutLaneTrigger
    End Sub
     
     
    ' The Right OutLane trigger has been Hit
    '
    Sub RightOutLaneTrigger_Hit()
    	If (l19.State <> 0) Then
    		AddScore(5000)
    		Else
    		AddScore(500)
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = RightOutLaneTrigger
    End Sub
     
    ' *********************************
    ' **                             **
    ' **    Top Rollover Triggers    **
    ' **                             **
    ' *********************************
     
    Sub T1_Hit()
     
    	If (fpTilted = False) Then
    		' add some points
    		If (u1.State <> 0) Then
    			' add some points
    			AddScore(1000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		If (u1.State = 0) Then
    			' turn on the rollover light
    			u1.State = 1
    			l16.state=1
    			' check to see if all the rollover lights are on
    			CheckTopRolloverLights()
    		End If
    		' Flash the GI bulbs in the Laneguides either side of the trigger
    		Bu1.FlashForMs 400, 200, Bu1.State
    		Bu2.FlashForMs 400, 200, Bu2.State
    		Bu3.FlashForMs 400, 200, Bu3.State
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = T1
    End Sub
     
    Sub T2_Hit()
     
    	If (fpTilted = False) Then
    		' add some points
    		If (u2.State <> 0) Then
    			AddScore(1000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		' turn on the rollover light
    		If (u2.State = 0) Then
    			' turn on the rollover light
    			u2.State = 1
    			l17.state=1
    			' check to see if all the rollover lights are on
    			CheckTopRolloverLights()
    		End If
    		' Flash the GI bulbs in the Laneguides either side of the trigger
    		Bu1.FlashForMs 400, 200, Bu1.State
    		Bu2.FlashForMs 400, 200, Bu2.State
    		Bu3.FlashForMs 400, 200, Bu3.State
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = T2
    End Sub
     
    Sub T3_Hit()
    	If (fpTilted = False) Then
    		If (u3.State <> 0) Then
    			AddScore(1000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		' turn on the rollover light
    		If (u3.State = 0) Then
    			' turn on the rollover light
    			u3.State = 1
    			l18.state=1
    			' check to see if all the rollover lights are on
    			CheckTopRolloverLights()
    		End If
    		' Flash the GI bulbs in the Laneguides either side of the trigger
    		Bu1.FlashForMs 400, 200, Bu1.State
    		Bu2.FlashForMs 400, 200, Bu2.State
    		Bu3.FlashForMs 400, 200, Bu3.State
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = T3
    End Sub
     
    Sub T4_Hit()
    	If (fpTilted = False) Then
    		If (u4.State <> 0) Then
    			AddScore(1000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		' turn on the rollover light
    		If (u4.State = 0) Then
    			' turn on the rollover light
    			u4.State = 1
    			l19.state=1
    			' check to see if all the rollover lights are on
    			CheckTopRolloverLights()
    		End If
    		' Flash the GI bulbs in the Laneguides either side of the trigger
    		Bu1.FlashForMs 400, 200, Bu1.State
    		Bu2.FlashForMs 400, 200, Bu2.State
    		Bu3.FlashForMs 400, 200, Bu3.State
    	End If
    	' remember last trigger hit by the ball
    	set LastSwitchHit = T4
    End Sub
     
    Sub CheckTopRolloverLights()
      If (u1.State <> 0) And (u2.State <> 0) And (u3.State <> 0) And (u4.State <> 0) Then
    		' increase the bonus level
    		IncrementBonusMultiplier()
    		' turn off the rollover lights
    		u1.State = 0
    		u2.State = 0
    		u3.State = 0
    		u4.State = 0
    	End If
    End Sub
     
    '************bumpers************
     
    sub bumper1_hit()
    	addscore(1000)
    end sub
     
    sub bumper2_hit()
    	addscore(1000)
    end sub
     
     
    '****************KICKER********************
    Sub Kicker1_Hit()
    	If fpTilted = True Then Exit Sub
    	Timer1.Set True,1000
    	if l44.state=1 then
    		AddScore (1000)
    		incrementbonus(3) 
    		else
    		AddScore (1000)
    	end if
     
    	if l20.state=1 then
    		l20.state=0
    		nvCredits = nvCredits + 1
    		Playsound"knocker"
    	end if
     
     
    	if l21.state=1 then
    		timer2.set true,400
    		timer1.set false,1000
    	end if
    End Sub
     
     
    Sub Timer1_Expired()
    	Timer1.Set False
    	Kicker1.SolenoidPulse
    End Sub
     
     
    sub timer2_expired
    	l21.state=0
    	timer2.set false,3000
    	incrementbonus(-1)
    	AwardPoints = 1000 * BonusMultiplier(CurrentPlayer)
    	b20.Set Bulboff, "100000000000", 150
    	b10.Set Bulboff, "010000000000", 150
    	b9.Set Bulboff,  "001000000000", 150
    	b8.Set Bulboff,  "000100000000", 150
    	b7.Set Bulboff,  "000010000000", 150
    	b6.Set Bulboff,  "000001000000", 150
    	b5.Set Bulboff,  "000000100000", 150
    	b4.Set Bulboff,  "000000010000", 150
    	b3.Set Bulboff,  "000000001000", 150
    	b2.Set Bulboff,  "000000000100", 150
    	b1.Set Bulboff,  "000000000010", 150
    	playsound"bonus"
    	bonus=0
    	Kicker1.SolenoidPulse	
    end sub
     
     
     
    '*********triggers**************
     
    Sub trigger5_hit
    	If (l41.State <> 0) Then
    		AddScore(10000)
    		Else
    		AddScore(100)
    	End If
     
    	l41.state=1
    	incrementbonus(1)
     
    	if l42.state=1 and l43.state=1 then
    		l22.state=1
    	End If
    end sub
     
    Sub trigger6_hit
    	If (l42.State <> 0) Then
    		AddScore(10000)
    		Else
    		AddScore(100)
    	End If
    	l42.state=1:l44.state=1
    	incrementbonus(1)
    	if l41.state=1 and l43.state=1 then
    		l22.state=1
    	End If
    end sub
     
    Sub trigger7_hit
    	If (l43.State <> 0) Then
    		AddScore(10000)
    		Else
    		AddScore(100)
    	End If
    	l43.state=1:l45.state=1
    	incrementbonus(1)
    	if l41.state=1 and l42.state=1 then
    		l22.state=1
    	End If
    end sub
     
    sub trigger9_hit
    	l23.state=1
    	addscore (50)
    	incrementbonus(1)
    end sub
     
    sub trigger10_hit
    	l40.state=1
    	addscore (50)
    	incrementbonus(1)
    end sub
     
    '*********spinner*********
     
    Sub spinner1_hit
    dim a
    	If (l45.State <> 0) Then
    		AddScore(10000)
    		Else
    		AddScore(100)
    	End If
    	incrementbonus(a)
    	if (a >=5) then 
    		a=5
    	end if
    end sub
     
     
    ' *********************************
    ' **                             **
    ' **         	target            **
    ' **                             **
    ' *********************************
     
    Sub target1_Hit()
    	incrementbonus(1)
    	if l41.state=1 and l42.state=1 and l42.state=1 then
    		l22.state=1
    	End If
     
    	If (l22.State <> 0) Then
    		AwardExtraBall()
    		l22.state=0:ShootAgainLight.state=BulbOn
    		PlaySound "Bonus"
    	End If
    End Sub
     
    ' *********************************
    ' **                             **
    ' **         Drop Targets        **
    ' **                             **
    ' *********************************
     
     
     
    Sub a1_Hit()
    	' if not tilted
    	If (fpTilted = False) Then
    		' if the light is on (or blinking)
    		If (La1.State <> 0) Then
    			' add some points
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		' Advance Defender Bonus
    		IncrementBonus(1)
    		' turn on the light
    		La1.FlashForMs 1000, 100, BulbOn
    		' check to see if all of the drop targets are down.
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub a2_Hit()
    	If (fpTilted = False) Then
    		If (La2.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		La2.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub a3_Hit()
    	If (fpTilted = False) Then
    		If (La3.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		La3.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub a4_Hit()
    	If (fpTilted = False) Then
    		If (La4.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		La4.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub d1_Hit()
    	If (fpTilted = False) Then
    		If (Ld1.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		' the four bank increments the alien bonus 
    		IncrementBonus(1)
    		Ld1.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub d2_Hit()
    	If (fpTilted = False) Then
    		If (Ld2.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		Ld2.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub d3_Hit()
    	If (fpTilted = False) Then
    		If (ld3.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		ld3.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub d4_Hit()
    	If (fpTilted = False) Then
    		If (Ld4.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		Ld4.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub c1_Hit()
    	If (fpTilted = False) Then
    		If (Lc1.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		' the four bank increments the alien bonus 
    		IncrementBonus(1)
    		Lc1.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub c2_Hit()
    	If (fpTilted = False) Then
    		If (Lc2.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		Lc2.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub c3_Hit()
    	If (fpTilted = False) Then
    		If (lc3.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		lc3.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
    Sub c4_Hit()
    	If (fpTilted = False) Then
    		If (Lc4.State <> 0) Then
    			AddScore(5000)
    			Else
    			AddScore(500)
    		End If
    		IncrementBonus(1)
    		Lc4.FlashForMs 1000, 100, BulbOn
    		CheckDropTargets()
    	End If
    End Sub
     
     
    ' Check to see if all of the Three and Four Bank Drop Targets are down.  If so
    ' then enable the next mode power up (Spawn, Invasion, Armada and Alien Bane)
    '
    Sub CheckDropTargets()
    	' if not tilted
    	If (fpTilted = False) Then
    		' are ALL the drop targets (both banks) down ?
    		If (a1.Dropped And a2.Dropped And a3.Dropped And a4.Dropped And _
    			d1.Dropped And d2.Dropped And d3.Dropped And d4.Dropped and _
    			c1.Dropped And c2.Dropped And c3.Dropped And c4.Dropped) Then
    			' for the next mode, blink the light so the player knows which one
    			' they are going for..  the flag will be false for the first mode
    			' we don't have
    			' if not in maximum mode then make the left star triggers cycle upwards
    			' reset the drop targets
    			ResetDropTargets()
    		End If
    	End If
    End Sub
     
    ' Reset All of the Drop Targets.  This uses a Timer to do one at a time
    ' so they reset in order.  
    '
    Sub ResetDropTargets()
    	' set the .userdata field to 0 (id marker so we know which target to reset)
    	ResetDropTargetsTimer.UserData = 0
    	' start the reset timer (every 200ms)
    	ResetDropTargetsTimer.Set True, 200
    End Sub
     
    ' Drop Tartet Reset Timers has expired..  Reset the next Drop Target..
    '
    Sub ResetDropTargetsTimer_Expired()
    	' disable the timer
    	ResetDropTargetsTimer.Enabled = False
    	l20.state=1
     
    	' depending on the userdata value for this timer, reset the drop targets
    	' one at a time
    	Select Case (ResetDropTargetsTimer.UserData)
    		' reset target 1
    		Case 0:	a1.SolenoidPulse
    					' this can also be called at the end of the game.. we only
    					' want to reset the targets and not set any lights here
    					If (fpGameInPlay = True) Then
    						La1.State = 0
    					End If
    					' move to the next target
    					ResetDropTargetsTimer.UserData = 1
    					' re-enable the timer (uses the existing .TimerInterval)
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 2
    		Case 1:	a2.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						La2.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 2
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 3
    		Case 2:	a3.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						La3.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 3
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 4
    		Case 3:	a4.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						La4.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 4
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 5
    		Case 4:	d1.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Ld1.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 5
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 3
    		Case 5:	d2.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Ld2.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 6
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 3
    		Case 6:	d3.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Ld3.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 7
    					ResetDropTargetsTimer.Enabled = True
    		Case 7:	d4.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Ld4.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 8
    					ResetDropTargetsTimer.Enabled = True
    		Case 8:	c1.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Lc1.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 9
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 3
    		Case 9:	c2.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Lc2.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 10
    					ResetDropTargetsTimer.Enabled = True
    		' reset target 3
    		Case 10:	c3.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Lc3.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 11
    					ResetDropTargetsTimer.Enabled = True
    		Case 11:	c4.SolenoidPulse
    					If (fpGameInPlay = True) Then
    						Lc4.State = 0
    					End If
    					ResetDropTargetsTimer.UserData = 12
    					ResetDropTargetsTimer.Enabled = True
    	End Select
    End Sub

  4. #4
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    février 2006
    Messages
    1 208
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : février 2006
    Messages : 1 208
    Points : 3 294
    Points
    3 294

    Par défaut

    tu actives le timer2 avant de désactiver le timer1 (1344-1345)
    es-tu sûr que plusieurs timers peuvent être actifs en même temps ?
    je ne connais pas la syntaxe de l'objet timer - et de façon générale celle de Future Pinball - mais je trouve étrange que sa désactivation impose de fournir aussi un param temps
    mais bon... le développeur est roi, il fait ce qu'il veut
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

  5. #5
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    mars 2016
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : mars 2016
    Messages : 6
    Points : 4
    Points
    4

    Par défaut

    développeur , faut vite le dire , dans mon cas il fait surtout ce qu'il peut. Je trouve bizarre , qu'il faille programmer un sub distinct (lorsque que la bille reste sur la playfield), alors que le décompte du bonus est strictement identique lorsque l'on perd les billes !!! J'ai essayé d'utiliser les instructions pour mon problème et ainsi simplifier le programme , mais rien n'y fait....
    j'obtiens toujours pas le même état , comme quoi en informatique une même cause peut provoquer 2 résultats différents !!!??? quant à savoir si plusieurs timers peuvent être actifs en même temps ....aucune idée , je présume que oui ??

    sinon l'as tu essayée pour évaluer la source du problème ( le soft est gratuit , librement téléchargeable)

    issu de l'aide du soft (timer)

    .Set ( <Boolean> Enabled, <Integer> Interval )

    This method allows you to set both the .Enabled and .Interval properties with a single command.

    Enabled is a b (True / False) which enables or disables the Timer.

    Interval is a positive number and is the time until the Timer expires. The Interval must be at least 10 milliseconds and if no value is specified, then the current value in the .Interval property is not changed.

  6. #6
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    février 2006
    Messages
    1 208
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : février 2006
    Messages : 1 208
    Points : 3 294
    Points
    3 294

    Par défaut

    sinon l'as tu essayée pour évaluer la source du problème ( le soft est gratuit , librement téléchargeable)
    hmm, je risque de ne pas avoir le temps de le tester dans l'immédiat mais je vais le télécharger par curiosité
    rien que l'extrait de la doc montre que le param Interval est facultatif et qu'il est plus logique d'écrire timer1.set false
    il doit y avoir une subtilité de syntaxe qui explique ton problème et que tu devrais trouver dans la doc
    RTFM comme ils disent...
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

  7. #7
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    mars 2016
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : mars 2016
    Messages : 6
    Points : 4
    Points
    4

    Par défaut

    tu as raison , le fait d'avoir supprimé interval 1000 , m'a débloqué la situation , le kicker pulse la bille cette fois ci ; après vidage bonus.
    vais le mettre en résolu , quoiqu'il persiste des "petits" hic , il n'incrémente pas le bonus au score ?!! et l'animation lumineuse du vidage bonus n'est pas la même que celle de la perte de bille !!????

  8. #8
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    février 2006
    Messages
    1 208
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : février 2006
    Messages : 1 208
    Points : 3 294
    Points
    3 294

    Par défaut

    pour moi, les petits "hic" ne relèvent pas de l'écriture du script mais de bugs dans la ROM
    ça ne devrait pas t'empêcher de "claquer"
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. recuperation de la structure d'une base
    Par pascalT dans le forum 4D
    Réponses: 7
    Dernier message: 07/06/2006, 15h32
  2. [tables systèmes] extraction de la structure d'une base
    Par laffreuxthomas dans le forum Autres SGBD
    Réponses: 6
    Dernier message: 23/03/2006, 13h24
  3. [VB6] [Fichier] Enregistrer des variables de structure
    Par de.bo dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 07/10/2002, 11h09
  4. Structure de données de type "RECORD"
    Par chaours dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 30/09/2002, 17h10
  5. longueur d'une structure
    Par bohemianvirtual dans le forum C
    Réponses: 6
    Dernier message: 28/05/2002, 18h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo