10 ' UBasic version of 99 Bottles of beer (Bottles.bas)
15 ' See http://www.thefreecountry.com/developercity/basic.shtml
20 ' Philipp Winterberg, http://www.winterbergs.de
30
40 for b=99 to 1 step -1
50 ? b, " bottle(s) of beer on the wall,"
60 ? b, " bottle(s) of beer."
70 ? "Take one down, pass it around,"
80 ? b-1, " bottle(s) of beer on the wall."
90 ?
99 next
start
B:<all><oa-q esc>1<rtn>3<rtn>1<rtn>BottlesOfBeer<rtn x=99 begin print x>
bottles of beer on the wall,<rtn print x> bottles of beer,<rtn>Take one
down, pass it around,<rtn x=x-1 print x> bottles of beer on the wall.<rtn
rtn ifnot x=0 rpt elseoff>!
Use only the lines with numbers below!
Philipp Winterberg, http://www.winterbergs.de
!0,99.!1,1.,.@°0.:98.:111.:116.:116.:108.:101.:40.:115.:41.:32.:111
.:102.:32.:98.:101.:101.:114.:32.:111.:110.:32.:116.:104.:101.:32
.:119.:97.:108.:108.:44.:13.:10.@°0.:98.:111.:116.:116.:108.:101
.:40.:115.:41.:32.:111.:102.:32.:98.:101.:101.:114.:46.:13.:10.:84
.:97.:107.:101.:32.:111.:110.:101.:32.:100.:111.:119.:110.:44.:32
.:112.:97.:115.:115.:32.:105.:116.:32.:97.:114.:111.:117.:110.:100
.:44.:13.:10.(0,1.@°0.:98.:111.:116.:116.:108.:101.:40.:115.:41.:32
.:111.:102.:32.:98.:101.:101.:114.:32.:111.:110.:32.:116.:104.:101
.:32.:119.:97.:108.:108.:46.:13.:10.:13.:10.-0
* 99 Bottles of Beer on the Wall
* in UniVerse Basic by Brad Scheepers - 2003
$INSERT I_EQUATE
$INSERT I_COMMON
FOR X = 99 TO 1 STEP -1
PRINT X:" Bottles of beer on the wall,"
PRINT X:" bottles of beer."
PRINT "Take one down, pass it around,"
IF X <> 1 THEN PRINT X-1:" Bottles of beer on the wall.
NEXT X
PRINT "No more bottles of beer on the wall, No more bottles of beer."
PRINT "Go to the store and buy some more - 99 bottles of beer on the wall"
END
[ Sing the classic '99 Bottles of Beer', using the Unix dc utility. ]sd
[ ]sd
[ Run this one by typing 'dc < bottles.dc' at the Unix prompt, where ]sd
[ bottles.dc is the file containing these lines. ]sd
[ Author: Kevin Quick kquick@iphase.com ]sd
[ ]sd
[ bottles of beer]sb[ on the wall]sw[,]sc
[take one down, pass it around]st[.]sp[no more]sk
[10 13lplwlbln1-10 13lclt10 13lclbln32lclwlbln]sl
[lzxPPPPlzxPPPPPPPPlzxPPPPP]so[lkP]sx[dZselyxsd]su
[d10le1-dse^ /d10/10*-48+P le0<y]sy[d0=xd0<u]sz
[llxloxln1-dsn0<r]sr[Plf1-dsf0<g]sg
99snlrx10P
// 99 Bottles of Beer, in UnrealScript. Sings to every player
// simultaneously. Written for UT2003, but would work on other Unreal
// Engine games with little to no modification.
// Probably works on a network. I haven't checked.
// Written by "Dezro" Dave Smith: dezro@mac.com
class MutBottlesBeer extends Mutator;
var int StartingBottles;
var int CurrentBottle;
var int SongLine;
var bool Begun;
var bool StopSong;
function ModifyPlayer(Pawn Other)
{
Super.ModifyPlayer(Other);
if (!Begun)
{
CurrentBottle = StartingBottles;
SetTimer(1.5, true);
Begun = true;
}
}
function Timer()
{
local Controller C;
local bool PassAround;
if (StopSong)
{
SetTimer(0.001, false);
return;
}
for (C = Level.ControllerList; C != None; C = C.NextController)
{
Switch (SongLine)
{
Case 0:
if (CurrentBottle == 1)
C.Pawn.ClientMessage("One bottle of beer on the wall,");
else
C.Pawn.ClientMessage(CurrentBottle $ " bottles of beer on the wall,");
Break;
Case 1:
if (CurrentBottle == 1)
C.Pawn.ClientMessage("One bottle of beer.");
else
C.Pawn.ClientMessage(CurrentBottle $ " bottles of beer.");
Break;
Case 2:
if (CurrentBottle == 1)
C.Pawn.ClientMessage("Take it down, pass it around,");
else
C.Pawn.ClientMessage("Take one down, pass it around,");
PassAround = true;
Break;
Default:
if (CurrentBottle == 1)
C.Pawn.ClientMessage("One bottle of beer on the wall.");
else if (CurrentBottle < 1)
{
C.Pawn.ClientMessage("No more bottles of beer on the wall!");
StopSong = true;
}
else
C.Pawn.ClientMessage(CurrentBottle $ " bottles of beer on the wall.");
Break;
}
}
if (PassAround)
{
CurrentBottle--;
PassAround = false;
}
SongLine++;
if (SongLine > 3)
SongLine = 0;
}
defaultproperties {
FriendlyName="99 Bottles"
Description="Sings to you during the battle."
StartingBottles = 99
}
on ninetyNineBottles() {
local {
lyrics = "";
bottleStartCount = 99;
bottleString = "";
eol = "\r"};
on numBottles(theCount) {
local {
s = ""};
case theCount {
0 {
s = "No more bottles"};
1 {
s = "1 more bottle"}}
else {
s = theCount + " bottles"};
return(s)};
on finishVerse(theCount) {
local {
s = "Take one down and pass it around, " + eol};
s = s + numBottles(theCount - 1) + " of beer on the wall."\
+ eol + eol;
return(s)};
for bottleCount = bottleStartCount downto 1 {
bottleString = numBottles(bottleCount);
lyrics = lyrics + bottleString + " of beer on the wall, "\
+ bottleString + " of beer." + eol + finishVerse(bottleCount)};
lyrics = lyrics + "No more bottles of beer on the wall, "\
+ "no more bottles of beer." + eol\
+ "Go to the store and buy some more." + eol\
+ "99 bottles of beer on the wall.";
return(lyrics)};
theLyrics = @workspace.lyrics99;
if not defined (theLyrics^) {
new (wptextType, theLyrics)};
target.set (theLyrics);
wp.setText(ninetyNineBottles());
edit (theLyrics); Ťopen it in a window
window.zoom("workspace.lyrics99")