setfreq m8
b0 = 1
pause 1000
waiting:
if pin7 = 1 then but1
if pin6 = 1 then but2
if pin2 = 1 then but3
if pin1 = 1 then but4
if pin0 = 1 then but5
goto waiting

but1:
if b0 = 1 then rand1
if b0 = 2 then rand1a
goto waiting

but2:
if b0 = 1 then rand2
if b0 = 2 then rand2a
goto waiting

but3:
if b0 = 1 then rand3
if b0 = 2 then rand3a
goto waiting

but4:
if b0 = 1 then rand4
if b0 = 2 then rand4a
goto waiting

but5:
b0 = b0 + 1
if b0 > 2 then moderst

mode:
for b1 = 1 to b0
serout 4,n9600_8,("vpf 01.mp3",CR)
wait 1
next b1
goto waiting

moderst:
b0 = 1
goto mode

rand1:
random b2
b3 = 9 * b2 / 255 + 1 'sounds 1 to 9 Generic R2 sounds
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf 0",b6,".mp3",CR)
wait 1
goto waiting

rand2:
random b2
b3 = 9 * b2 / 255 + 10 'sounds 10 to 18 R2 Chatter
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting

rand3:
random b2
b3 = 3 * b2 / 255 + 20 'sounds 20 to 22 Sad
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting

rand4:
random b2
b3 = 6 * b2 / 255 + 30 'sounds 30 to 35 Specal R2 sounds
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting

rand1a:
serout 4,n9600_8,("vpf 39.mp3",CR)'long R2 sound file
wait 1
goto waiting

rand2a:
random b2
b3 = 7 * b2 / 255 + 40 'sounds 40 to 46 Star Wars Music
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting

rand3a:
random b2
b3 = 12 * b2 / 255 + 50 'sounds 50 to 61 Star Wars Clips 
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting

rand4a:
random b2
b3 = 30 * b2 / 255 + 70 'sounds 70 to 99 Joke Sounds
bintoascii b3, b4, b5, b6
serout 4,n9600_8,("vpf ",b5,b6,".mp3",CR)
wait 1
goto waiting





