Main Forum > Pinball Discussion
How my coding has improved....
Itchigo:
As my coding has improved I've gone back into my old games and recoded them much more efficiently. What has surprised me is the number of lines I have been able to eliminate. So far I've been averaging taking out about 300 lines or so. It's almost become a game to see how few lines I can use. I have Olympics down to 500 lines, but that's not the best...
Distant World, my new wip was started some time ago. I went through it and started out with 2,250 lines. I got it down to 1,670 lines. Whoa.
yogiholzer:
It's because you just put the content from several lines into one, or? :tongue:
I couldn't even manage that. :grin:
faralos:
it's probably from collections
writing a collection takes about ten lines or so
but to do the coding without collections may take up to thirty lines of script
for that same routine
yogiholzer:
Probably. I just wanted to joke a little.
Itchigo:
Mainly collections. Some doubles, and not written out well. Knowing what I know now.... I'm surprised it worked at all. :whistle: I wasn't tooting my own horn I was just surprised at how much was eliminated. Just when I thought I couldn't find more, I am down to 1620. I'm shooting for 1500- ish, lol. Just for grins. :cheers: I remember Cowboys and Indians I thought was done so well, I had 9 collections. The Tomb has 49! :smiley-computer012:
Here's an example.
Sub C1_Hit() 'If the DropTarget C1 is hit...
If Tilt= False Then 'If the game isn't tilted.
PlaySound"DTDrop" 'Play the sound.
PlaySound"Nuke1" 'Play the sound.
AddScore 500 'Add the score.
CALL AddBonus(1000) 'Add bonus. Copy and paste this line to add Bonus with any event (Bonus is in increments of 1000).
C1.IsDropped=True 'Drop the target C1.
End If
End Sub
Sub C2_Hit() 'If the DropTarget C2 is hit...
If Tilt= False Then 'If the game isn't tilted.
PlaySound"DTDrop" 'Play the sound.
PlaySound"Nuke1" 'Play the sound.
AddScore 500 'Add the score.
CALL AddBonus(1000) 'Add bonus. Copy and paste this line to add Bonus with any event (Bonus is in increments of 1000).
C2.IsDropped=True 'Drop the target C2.
End If
End Sub
Sub C3_Hit() 'If the DropTarget C3 is hit...
If Tilt= False Then 'If the game isn't tilted.
PlaySound"DTDrop" 'Play the sound.
PlaySound"Nuke1" 'Play the sound.
AddScore 500 'Add the score.
CALL AddBonus(1000) 'Add bonus. Copy and paste this line to add Bonus with any event (Bonus is in increments of 1000).
C3.IsDropped=True 'Drop the target C3.
End If
End Sub
Sub C4_Hit() 'If the DropTarget C4 is hit...
If Tilt= False Then 'If the game isn't tilted.
PlaySound"DTDrop" 'Play the sound.
PlaySound"Nuke1" 'Play the sound.
AddScore 500 'Add the score.
CALL AddBonus(1000) 'Add bonus. Copy and paste this line to add Bonus with any event (Bonus is in increments of 1000).
C4.IsDropped=True 'Drop the target C4.
Lock1.State=2
End If
If Savelock1.State=1 Then
Kicker2CTimer.Enabled=True
End If
End Sub
Has become...
Sub CTargets_Hit(x) 'If target is hit...
If Tilt= False Then 'If the game isn't tilted.
PlaySound"DTDrop" 'Play the sound.
PlaySound"Nuke1" 'Play the sound.
AddScore 500 'Add the score.
CALL AddBonus(1000) 'Add bonus. Copy and paste this line to add Bonus with any event (Bonus is in increments of 1000).
CTargets(x).IsDropped=True 'Drop the target.
End If
If C4.Isdropped=True Then
Lock1.State=2
If Savelock1.State=1 Then
Kicker2CTimer.Enabled=True
End If
End If
End Sub
Or this:
'******************** Triggers *******************************************************************************************
Sub LeftInlane_Hit() 'Left Inlane has been hit.
If Tilt= False Then 'If the game isn't tilted.
Playsound"Inlane" 'Play the sound.
Wall180.IsDropped=True 'Drop the rollover switch.
AddScore 1000 'Add the score.
End If
End Sub
Sub LeftInlane_UnHit()
Wall180.IsDropped=False 'Raise the rollover switch.
End Sub
'UnHit means when the ball leaves the switch. The sound doesn't play when you hit it, but when the ball leaves the switch.
Sub RightInlane_Hit() 'Right Inlane has been hit.
If Tilt= False Then 'If the game isn't tilted.
Playsound"Inlane" 'Play the sound.
Wall446.IsDropped=True 'Drop the rollover switch.
AddScore 1000 'Add the score.
End If
End Sub
Sub RightInlane_UnHit()
Wall446.IsDropped=False 'Raise the rollover switch.
End Sub
'UnHit means when the ball leaves the switch. The sound doesn't play when you hit it, but when the ball leaves the switch.
Sub Rightoutlane_Hit() 'Right outlane has been hit.
If RSpecial.State=1 Then 'If the Right special light is on...
PlaySound"Knocker" 'Play the sound.
PlaySound "Replay" 'Play the sound.
AddScore 5000 'Add the score.
Wall449.IsDropped=True 'Drop the rollover switch.
Credits=Credits+1 'Add a credit.
EMReel3.SetValue(Credits) 'Update credit display.
'Controller.B2SSetscore 6,Credits
Else 'If the right special light is not on.
Playsound"Smartbomb" 'Play the sound.
AddScore 5000 'Add the score.
Wall449.IsDropped=True 'Drop the rollover switch.
End If
End Sub
Sub Rightoutlane_UnHit()
Wall449.IsDropped=False 'Raise the rollover switch.
End Sub
'UnHit means when the ball leaves the switch. The sound doesn't play when you hit it, but when the ball leaves the switch.
Sub Leftoutlane_Hit() 'Left outlane has been hit.
If LSpecial.State=1 Then 'If the Left special light is on...
PlaySound"Knocker" 'Play the sound.
PlaySound "Replay" 'Play the sound.
AddScore 5000 'Add the score.
Wall452.IsDropped=True 'Drop the rollover switch.
Credits=Credits+1 'Add a credit.
EMReel3.SetValue(Credits) 'Update credit display.
GI1Timer.Enabled=True
'Controller.B2SSetscore 6,Credits
Else 'If the left special light is not on.
Playsound"Smartbomb" 'Play the sound.
AddScore 5000 'Add the score.
Wall452.IsDropped=True 'Drop the rollover switch.
End If
End Sub
Sub Leftoutlane_UnHit()
Wall452.IsDropped=False 'Raise the rollover switch.
End Sub
Has become:
Sub Inlanes_Hit(x) 'Inlane has been hit.
If Tilt= False Then 'If the game isn't tilted.
Playsound"Inlane" 'Play the sound.
InlaneSwitches(x).IsDropped=True 'Drop the rollover switch.
AddScore 1000 'Add the score.
End If
End Sub
Sub Inlanes_UnHit()
InlaneSwitches(x).IsDropped=False'Raise the rollover switch.
End Sub
Sub Outlanes_Hit(x) 'Outlane has been hit.
If LSpecial.State=1 Then 'If the special light is on...
PlaySound"Knocker" 'Play the sound.
PlaySound "Replay" 'Play the sound.
AddScore 5000 'Add the score.
OutlaneSwitches(x).IsDropped=True'Drop the rollover switch.
Credits=Credits+1 'Add a credit.
EMReel3.SetValue(Credits) 'Update credit display.
GI1Timer.Enabled=True
'Controller.B2SSetscore 6,Credits
Else 'If the left special light is not on.
Playsound"Smartbomb" 'Play the sound.
AddScore 5000 'Add the score.
OutlaneSwitches(x).IsDropped=True'Drop the rollover switch.
End If
End Sub
Sub Outlanes_UnHit(x)
OutlaneSwitches(x).IsDropped=False'Raise the rollover switch.
End Sub
Navigation
[0] Message Index
[#] Next page
Go to full version