"99 Bottles of Beer" in Halo Script
Posted: Thu Jul 12, 2007 9:35 am
I was really bored this morning and started randomly surfing.
I came across a site with programs that print the lyrics to 99 Bottles of Beer in 1103 different programming languages. After perusing the list, which included everything from Brainf*ck to PHP to MS DOS batch files. One thing it lacked was a Halo Script. Seeing as I was still bored out of my mind, I wrote one up and tested it.
Please note that this will only run in Sapien, as Halo doesn't actually print when you call (print <string>). Another important note is that since there is absolutely no way to convert 'bottles' to a string, and since you can't print or sv_say a value other than a string, we (inspect) it.
Enjoy.
I came across a site with programs that print the lyrics to 99 Bottles of Beer in 1103 different programming languages. After perusing the list, which included everything from Brainf*ck to PHP to MS DOS batch files. One thing it lacked was a Halo Script. Seeing as I was still bored out of my mind, I wrote one up and tested it.
Code: Select all
(global real bottles 99)
(script continuous drinkBeer
(if (> bottles 1)
(begin
(inspect bottles)
(print "bottles of beer on the wall!")
(inspect bottles)
(print "bottles of beer!")
(print "Take one down, pass it around")
(set bottles (- bottles 1))
(inspect bottles)
(print "bottles of beer on the wall!")
(print " ")
)
)
(if (= bottles 1)
(begin
(print "One bottle of beer on the wall")
(print "One last bottle of beer!")
(print "Take it down, pass it around")
(print "No more bottles of beer on the wall!")
(print " ")
(print "No bottles of beer on the wall")
(print "No more bottles of beer!")
(print "Go to the store, buy some more")
(print "99 bottles of beer on the wall!")
(set bottles -1)
(print " ")
)
)
)
Enjoy.