Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language TSEPro Editor Macro

Date:04/20/05
Author:Sammy Mitchell
URL:n/a
Comments:0
Info:n/a
Score: (4.00 in 2 votes)
/****************************************************************
  A TSE Pro editor macro that implements the beer song.

  Sammy Mitchell, Dec 9, 1998   www.semware.com
 ****************************************************************/

// return "n bottles", "1 bottle", or "no more..." based on num_bottles
string proc bottles(integer num_bottles)
    case num_bottles
        when 0    return ("no more bottles of beer")
        when 1    return ("1 bottle of beer")
    endcase
    return (Str(num_bottles) + " bottles of beer")
end

// display the verses
proc Sing()
    integer num_bottles

    for num_bottles = 99 downto 1
        WriteLine(bottles(num_bottles); "on the wall,")
        WriteLine(bottles(num_bottles), ".")
        WriteLine("You take one down, pass it around,")
        WriteLine(bottles(num_bottles - 1); "on the wall.")
        WriteLine("")
    endfor
end

// display the beer song in a pop-up window
proc main()
    if PopWinOpen(1, 1, 40, Query(ScreenRows),
                1, "Sing along...", Color(Bright Yellow on Blue))
        Set(Attr, Color(Bright Yellow on Blue))
        ClrScr()
        Sing()
        WriteLine("")
        WriteLine("Press a key...")
        GetKey()
        PopWinClose()
    endif
end

Download Source | Write Comment

Alternative Versions

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: