99 bottles of beer on the wall

David Vaughan drvaughan55 at mac.com
Sat Jul 27 02:44:01 EDT 2002


I thought I should make it notionally independent of a field on a card 
and changed it to this, which also deals more economically with the 
default case (99-->2):
==========================================
constant singAlong=1
local bottles=99

on openStack
   put bottles && "bottles of beer on the wall." & return
   put "Take one down and pass it around." after msg
   DrinkThem
end openStack

on DrinkThem
   switch bottles
   case 0
     put "There were no more bottles of beer on the wall"
     wait (singAlong * 2) seconds
     quit
     break
   case 1
     put "One last bottle of beer on the wall." & return
     put "Take it down and pass it around." after msg
     wait singAlong seconds
     break
   default
    put bottles into word 1 of msg
   end switch
   subtract 1 from bottles
   send DrinkThem to me in singAlong seconds
end DrinkThem
==========================================

cheers
David

On Saturday, July 27, 2002, at 05:15 , David Vaughan wrote:

> constant singAlong=1
> local bottles=99
>
> on openCard
>   DrinkThem
> end openCard
>
> on DrinkThem
>   switch bottles
>   case 0
>     put "There were no more bottles of beer on the wall" into field 
> "song"
>     wait (singAlong * 2) seconds
>     quit
>     break
>   case 1
>     put "One last bottle of beer on the wall." & return into field 
> "song"
>     put "Take it down and pass it around." after field "song"
>     wait singAlong seconds
>     break
>   default
>     put bottles && "bottles of beer on the wall." & return into field 
> "song"
>     put "Take one down and pass it around." after field "song"
>   end switch
>   subtract 1 from bottles
>   send DrinkThem to me in singAlong seconds
> end DrinkThem




More information about the Use-livecode mailing list