Skip to content

Instantly share code, notes, and snippets.

@M4GNV5
Last active August 29, 2015 14:24
Show Gist options
  • Save M4GNV5/b5a040058ace627b4e6c to your computer and use it in GitHub Desktop.
Save M4GNV5/b5a040058ace627b4e6c to your computer and use it in GitHub Desktop.
99bottles CommandblocksJS
var bottles = new Runtime.Integer();
bottles.set(99);
Chat.Tellraw.create("99 bottles of beer on the wall, 99 bottles of beer.").tell(Entities.Selector.AllPlayer);
var repeat = function()
{
Chat.Tellraw.create("Take one down and pass it around, ", bottles.toTellrawExtra(), " bottles of beer on the wall.").tell(Entities.Selector.AllPlayer);
Chat.Tellraw.create(bottles.toTellrawExtra(), " bottles of beer on the wall, ", bottles.toTellrawExtra(), " bottles of beer.").tell(Entities.Selector.AllPlayer);
bottles.remove(1);
bottles.isBetween(1, 99).validate(repeat, end);
};
var end = function()
{
Chat.Tellraw.create("Take one down and pass it around, no more bottles of beer on the wall.\n"+
"No more bottles of beer on the wall, no more bottles of beer. "+
"Go to the store and buy some more, 99 bottles of beer on the wall.").tell(Entities.Selector.AllPlayer);
};
call(repeat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment