Singing Fool

A song singing object that can learn new songs.

Author: Sigc@M*U*S*H
Category: Other
Features: #lambda.
Compatibility: PennMUSH.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Singing Fool

@create Singing Fool
@lock Singing Fool==me
@set Singing Fool = !NO_COMMAND
@set Singing Fool = MONITOR
&CMD.FORGETSONG Singing Fool=$forget *:@assert or(strmatch(%#,v(owner)),not(t(v(owner))))=@pemit %#=u(msg`notmyboss);@assert hasattr(me/songs`%0)=@pemit %#=u(msg`songnotavailable);@wipe me/songs`%0;@pemit %#=u(msg`forgotsong)
&CMD.LISTSONGS Singing Fool=$songlist:@pemit %#=[u(msg`listsongs)];@pemit %#=The list reads:%r[align(15 50,Alias,Song)] %r[map(#lambda/align(15 50,last(\%0,`),strcat(last(v(\%0),|),\%bby\%b,first(v(\%0),|))), lattrp(me/songs`*),%b,%r)]
&CMD.QUEUESONG Singing Fool=$request *:@assert hasattrp(me/songs`%0)=@pemit %#=[u(msg`songnotavailable)];@wait 1=@include me/inc.queuesong=%0;@pemit %#=u(msg`awkrequest)
&CMD.STOPSINGING Singing Fool=$stop:@assert v(semaphore)=@pemit %#=[u(msg`notsinging)];@drain me;@set me=squeue;@emit u(msg`stopsinging)
&CMD.TEACHNEW Singing Fool=$teachnew *=*/*:@break isdbref(lock(me/listen))=@pemit %#=u(msg`oneatatime);@assert not(hasattr(me/songs`%0))=@pemit %#=u(msg`songexsists);@pemit %#=u(msg`newsong);@remit %#=u(msg`announcelearning);@lock/listen me=%#;@set me=learning:[edit(%0,%b,_)];@set me=songs`[edit(%0,%b,_)]:%2|%1
&DELAY Singing Fool=5
&DESC Singing Fool=u(msg`description)%r%r[ansi(hw,You suppose you could)]%r%r[ansi(hw,songlist)] - [ansi(y,Lists songs available)]%r[ansi(hw,request <song>)] - [ansi(y, Requests a song by its alias)]%r[ansi(hw,teachnew <alias>=<title>/<artist>)] - [ansi(y,Teach me new song)]%r[ansi(hw,stop)] - [ansi(y,Request that I stop singing)]%r[ansi(hw,forget <song>)] - [ansi(y,Forget a song. Only for owners and free-range singers)]
&DESCRIBE Singing Fool=u(msg`description)%r%r[ansi(hw,You suppose you could)]%r%r[ansi(hw,songlist)] - [ansi(y,Lists songs available)]%r[ansi(hw,request <song>)] - [ansi(y, Requests a song by its alias)]%r[ansi(hw,teachnew <alias>=<title>/<artist>)] - [ansi(y,Teach me new song)]%r[ansi(hw,stop)] - [ansi(y,Request that I stop singing)]%r[ansi(hw,forget <song>)] - [ansi(y,Forget a song. Only for owners and free-range singers)]
@set Singing Fool/DESCRIBE=no_command visual prefixmatch public nearby
&INC.QUEUESONG Singing Fool=@assert t(%0);@set me=squeue:[insert(v(squeue),-1,%0)];@break v(semaphore);@inc me/inc.singsong
&INC.SINGSONG Singing Fool=@assert words(v(squeue));@emit u(msg`announcesong,[last(v(songs`[setr(1,first(v(squeue),%b))]),|)],[first(v(songs`%q1),|)]);@dol/inline sort(lattrp(me/songs`%q1`*))={@wait me/[setr(0,mul(v(delay),#@))]=@emit u(msg`singing,v(##))};@set me=squeue:[rest(v(squeue))];@wait me/[add(v(delay),mul(nattrp(me/songs`%q1`*),mul(1,v(delay))))]={@emit u(msg`finishsong)};@wait me/[add(v(delay),mul(nattrp(me/songs`%q1`*),mul(2,v(delay))))]=@inc me/inc.singsong
&LISTEN.TEACHING Singing Fool=^* says, "*":@assert strmatch(lock(me/listen),%#);@break strmatch(%1,finish)={@wipe me/learning;@lock/listen me;@pemit %#=u(msg`donelearning);@remit %#=u(msg`annoucedonelearning)}; @set me=songs`[v(learning)]`[firstof(add(1,nattr(me/songs`[v(learning)]`*)),1)]:%1
&MSG Singing Fool=
&MSG`ANNOUNCELEARNING Singing Fool=name(me) guestures to %n, "%n here thinks he can teach me a song. Lets see him try!"
&MSG`ANNOUNCESONG Singing Fool=[@@(%0:Song Title %1: Song Artist)]name(me) coughs to grab the attention of the audience, "The next song up is '%0' which is a nea' lit'le tu'ne by '%1'. I hope ye' enjoy it!"
&MSG`AWKREQUEST Singing Fool=name(me) tips his hat to you, "Good choice laddy! I'll get that right up to ya!"
&MSG`DESCRIPTION Singing Fool=A ragged man with a thick beard and a jug of something toxic smelling at his side.
&MSG`DONELEARNING Singing Fool=name(me) cocks his head to the side, "Thats a nice one laddy. I'll remember it!"
&MSG`FINISHSONG Singing Fool=name(me) does a little hop and skip, "Eh? How'd ya folk' like that one?"
&MSG`FORGOTSONG Singing Fool=name(me) nods his head, "Fo' th' best. That song was feckin' boggin!"
&MSG`HOMEDONELEARNING Singing Fool=name(me) claps his hands, "Good job %n. Good job!"
&MSG`LISTSONGS Singing Fool=[name(me)] says, "Sure thing lad. All of my songs are listed on the board here...."
&MSG`NEWSONG Singing Fool=name(me) eyes you, "So you want to teach me a new song eh? Well sing it to me. When your done let me know by saying finish. Lets see what ya got!"
&MSG`NOTMYBOSS Singing Fool=name(me) gives you a funny look, "You ain't my boss."
&MSG`NOTSINGING Singing Fool=[name(me)] glares at you, "Are ya stupid lad!? I'm not even singing!"
&MSG`ONEATATIME Singing Fool=name(me) shakes his head, "I can only learn one song a time. Try again later"
&MSG`SINGING Singing Fool=name(me) belts out, "%0"
&MSG`SONGEXSISTS Singing Fool=name(me) cocks his head, "I thin' I alread'y know that one, lad."
&MSG`SONGNOTAVAILABLE Singing Fool=name(me) shakes his head, "Sorry lad I dun' know that tune"
&MSG`STARTUP Singing Fool=name(me) scratches his head, "Well gee, seem t' have forgot'n what I was singin'...."
&MSG`STOPSINGING Singing Fool=name(me) shrugs and guestures to %n, "Well..it seems %n doesn' wan' me t' sing no more. [randword(What'a caffler\, eh!?|Must be crabbit as a cat\, eh?,|)]"
&OWNER Singing Fool=#11143
&SONGS Singing Fool=
&SONGS`2BEWITHYOU Singing Fool=Mr. Big|To Be With You
&SONGS`2BEWITHYOU`1 Singing Fool=Hold on, little girl
&SONGS`2BEWITHYOU`10 Singing Fool=Deep inside I hope you'll feel it too
&SONGS`2BEWITHYOU`11 Singing Fool=Waited on a line of greens and blues
&SONGS`2BEWITHYOU`12 Singing Fool=Just to be the next to be with you
&SONGS`2BEWITHYOU`13 Singing Fool=Build up your confidence
&SONGS`2BEWITHYOU`14 Singing Fool=So you can be on top for once
&SONGS`2BEWITHYOU`15 Singing Fool=Wake up. Who cares about little boys
&SONGS`2BEWITHYOU`16 Singing Fool=That talk too much?
&SONGS`2BEWITHYOU`17 Singing Fool=I've seen it all go down
&SONGS`2BEWITHYOU`18 Singing Fool=The game of love was all rained out
&SONGS`2BEWITHYOU`19 Singing Fool=Let me be the one to hold you
&SONGS`2BEWITHYOU`2 Singing Fool=Show me what he's done to you
&SONGS`2BEWITHYOU`20 Singing Fool=I'm the one who wants to be with you
&SONGS`2BEWITHYOU`21 Singing Fool=Deep inside I hope you'll feel it too
&SONGS`2BEWITHYOU`22 Singing Fool=Waited on a line of greens and blues
&SONGS`2BEWITHYOU`23 Singing Fool=Just to be the next to be with you
&SONGS`2BEWITHYOU`24 Singing Fool=Why be alone when we can be together, baby?
&SONGS`2BEWITHYOU`25 Singing Fool=You can make my life worth while
&SONGS`2BEWITHYOU`26 Singing Fool=I can make you start to smile
&SONGS`2BEWITHYOU`27 Singing Fool=When it's through, it's through
&SONGS`2BEWITHYOU`28 Singing Fool=And fate will twist the both of you
&SONGS`2BEWITHYOU`29 Singing Fool=Let me be the one to show you
&SONGS`2BEWITHYOU`3 Singing Fool=Stand up, little girl
&SONGS`2BEWITHYOU`30 Singing Fool=I'm the one who wants to be with you
&SONGS`2BEWITHYOU`31 Singing Fool=Deep inside I hope you'll feel it too
&SONGS`2BEWITHYOU`32 Singing Fool=Waited on a line of greens and blues
&SONGS`2BEWITHYOU`33 Singing Fool=Just to be the next to be with you
&SONGS`2BEWITHYOU`34 Singing Fool=I'm the one who wants to be with you
&SONGS`2BEWITHYOU`35 Singing Fool=Let me be the one to show you
&SONGS`2BEWITHYOU`36 Singing Fool=I'm the one who wants to be with you
&SONGS`2BEWITHYOU`37 Singing Fool=Deep inside I hope you'll feel it too
&SONGS`2BEWITHYOU`38 Singing Fool=Waited on a line of greens and blues
&SONGS`2BEWITHYOU`39 Singing Fool=Just to be the next to be with you
&SONGS`2BEWITHYOU`4 Singing Fool=A broken heart can't be that bad
&SONGS`2BEWITHYOU`40 Singing Fool=I'm the one who wants to be with you
&SONGS`2BEWITHYOU`41 Singing Fool=Let me be the one to show you
&SONGS`2BEWITHYOU`5 Singing Fool=When it's through, it's through
&SONGS`2BEWITHYOU`6 Singing Fool=Fate will twist the both of you
&SONGS`2BEWITHYOU`7 Singing Fool=So come on, baby, come on over
&SONGS`2BEWITHYOU`8 Singing Fool=Let me be the one to show you
&SONGS`2BEWITHYOU`9 Singing Fool=I'm the one who wants to be with you
&SONGS`CLOCK Singing Fool=Henry Clay Work|The Grandfather Clock
&SONGS`CLOCK`1 Singing Fool=My Grandfather's clock was too tall for the shelf
&SONGS`CLOCK`10 Singing Fool=tick tock tick tock
&SONGS`CLOCK`11 Singing Fool=- its life seconds numbering
&SONGS`CLOCK`12 Singing Fool=tick tock tick tock
&SONGS`CLOCK`13 Singing Fool=But it stopped short never to go again
&SONGS`CLOCK`14 Singing Fool=when the old man died
&SONGS`CLOCK`2 Singing Fool=so it stood ninety years on the floor
&SONGS`CLOCK`3 Singing Fool=It was taller by half than the old man himself,
&SONGS`CLOCK`4 Singing Fool=but it weighed not a penny weight more
&SONGS`CLOCK`5 Singing Fool=It was bought on the morn of the day he was born
&SONGS`CLOCK`6 Singing Fool=and was always his pleasure and pride
&SONGS`CLOCK`7 Singing Fool=But it stopped short never to go again
&SONGS`CLOCK`8 Singing Fool=when the old man died
&SONGS`CLOCK`9 Singing Fool=Ninety years without slumbering
&SONGS`GREENTINTEDEYES Singing Fool=Mr. Big|Green Tinted Sixties Eyes
&SONGS`GREENTINTEDEYES`1 Singing Fool=She just woke up, but she's still tired
&SONGS`GREENTINTEDEYES`10 Singing Fool=Little legend baby
&SONGS`GREENTINTEDEYES`11 Singing Fool=Try your very best to hide
&SONGS`GREENTINTEDEYES`12 Singing Fool=A green-tinted sixties mind
&SONGS`GREENTINTEDEYES`13 Singing Fool=She keeps some memories locked away
&SONGS`GREENTINTEDEYES`14 Singing Fool=But they are always escaping
&SONGS`GREENTINTEDEYES`15 Singing Fool=neclgect won't make them fade away
&SONGS`GREENTINTEDEYES`16 Singing Fool=They're reaching into her dreams
&SONGS`GREENTINTEDEYES`17 Singing Fool=Down in her heart
&SONGS`GREENTINTEDEYES`18 Singing Fool=Don't need fingers to be tearing it apart
&SONGS`GREENTINTEDEYES`19 Singing Fool=Gotta face the day
&SONGS`GREENTINTEDEYES`2 Singing Fool=Is that the telephone ringing?
&SONGS`GREENTINTEDEYES`20 Singing Fool=There is no other way
&SONGS`GREENTINTEDEYES`21 Singing Fool=To clear the fog inside your mind
&SONGS`GREENTINTEDEYES`22 Singing Fool=Fill it up with dreams
&SONGS`GREENTINTEDEYES`23 Singing Fool=But all that you can seem to find
&SONGS`GREENTINTEDEYES`24 Singing Fool=A green-tinted sixties mind
&SONGS`GREENTINTEDEYES`25 Singing Fool=Hangin' out with Janis
&SONGS`GREENTINTEDEYES`26 Singing Fool=Movin' to Atlantis
&SONGS`GREENTINTEDEYES`27 Singing Fool=Could've made it if you tried
&SONGS`GREENTINTEDEYES`28 Singing Fool=What's the point of force
&SONGS`GREENTINTEDEYES`29 Singing Fool=It's easy as a horse to ride
&SONGS`GREENTINTEDEYES`3 Singing Fool=The curtains can't hold back the light
&SONGS`GREENTINTEDEYES`30 Singing Fool=A green-tinted sixties mind
&SONGS`GREENTINTEDEYES`31 Singing Fool=You be looking groovy
&SONGS`GREENTINTEDEYES`32 Singing Fool=In a sixties movie
&SONGS`GREENTINTEDEYES`33 Singing Fool=Maybe tell the press you died
&SONGS`GREENTINTEDEYES`34 Singing Fool=Little legend baby
&SONGS`GREENTINTEDEYES`35 Singing Fool=Try your very best to hide
&SONGS`GREENTINTEDEYES`36 Singing Fool=A green-tinted sixties mind
&SONGS`GREENTINTEDEYES`37 Singing Fool=-U can't hide-
&SONGS`GREENTINTEDEYES`4 Singing Fool=That's reaching into her dreams
&SONGS`GREENTINTEDEYES`5 Singing Fool=Down in her heart
&SONGS`GREENTINTEDEYES`6 Singing Fool=If it had fingers, it'd be tearing it apart
&SONGS`GREENTINTEDEYES`7 Singing Fool=You be lookin' groovy
&SONGS`GREENTINTEDEYES`8 Singing Fool=In a sixties movie
&SONGS`GREENTINTEDEYES`9 Singing Fool=Maybe tell the press you died
&SONGS`TWINKLE Singing Fool=Jane Taylor|Twinkle Twinkle Little Star
&SONGS`TWINKLE`1 Singing Fool=Twinkle, twinkle, little star
&SONGS`TWINKLE`10 Singing Fool=Twinkle, twinkle, all the night
&SONGS`TWINKLE`11 Singing Fool=Twinkle, twinkle, little star
&SONGS`TWINKLE`12 Singing Fool=How I wonder what you are
&SONGS`TWINKLE`2 Singing Fool=How I wonder what you are
&SONGS`TWINKLE`3 Singing Fool=Up above the world so high
&SONGS`TWINKLE`4 Singing Fool=Like a diamond in the sky
&SONGS`TWINKLE`5 Singing Fool=Twinkle, twinkle little star
&SONGS`TWINKLE`6 Singing Fool=How I wonder what you are
&SONGS`TWINKLE`7 Singing Fool=When the blazing sun is gone
&SONGS`TWINKLE`8 Singing Fool=When the nothing shines upon
&SONGS`TWINKLE`9 Singing Fool=Then you show your little light
&SONGS`WHISKYINJAR Singing Fool=Thin Lizzy|Whiskey In The Jar
&SONGS`WHISKYINJAR`1 Singing Fool=As I was going over the Cork and Kerry Mountains,
&SONGS`WHISKYINJAR`10 Singing Fool=I put it in my pocket and I took it home to Jenny,
&SONGS`WHISKYINJAR`11 Singing Fool=She sighed and she swore that she ne'er would betray me,
&SONGS`WHISKYINJAR`12 Singing Fool=But the devil take the women for you know she tricked me easy.
&SONGS`WHISKYINJAR`13 Singing Fool=I went into my chamber all for to take a slumber,
&SONGS`WHISKYINJAR`14 Singing Fool=I dreamt of gold and jewels and for sure it was no wonder,
&SONGS`WHISKYINJAR`15 Singing Fool=But Jenny drew my charges and she filled them up with water,
&SONGS`WHISKYINJAR`16 Singing Fool=She sent for Captain Farrell, to be ready for the slaughter.
&SONGS`WHISKYINJAR`17 Singing Fool='Twas early in the morning, before I rose to travel,
&SONGS`WHISKYINJAR`18 Singing Fool=Up comes a band of soldiers and likewise Captain Farrell,
&SONGS`WHISKYINJAR`19 Singing Fool=When I drew my pistol, for she had stole away my sabre,
&SONGS`WHISKYINJAR`2 Singing Fool=I met with Captain Farrell, and his money he was counting,
&SONGS`WHISKYINJAR`20 Singing Fool=I couldn't shoot with water, so a prisoner I was taken.
&SONGS`WHISKYINJAR`21 Singing Fool=If anyone can aid me, it's my brother in the army,
&SONGS`WHISKYINJAR`22 Singing Fool=If I but knew his station in Cork or in Killarney,
&SONGS`WHISKYINJAR`3 Singing Fool=I first produced my pistol and then produced my rapier,
&SONGS`WHISKYINJAR`4 Singing Fool=Saying Stand and Deliver for I am a bold deceiver.
&SONGS`WHISKYINJAR`5 Singing Fool=Musha-re-ta-ta-do-ta-ta-da,
&SONGS`WHISKYINJAR`6 Singing Fool=Whack for my Daddio,
&SONGS`WHISKYINJAR`7 Singing Fool=Whack for my Daddio,
&SONGS`WHISKYINJAR`8 Singing Fool=There's whiskey in the jar.
&SONGS`WHISKYINJAR`9 Singing Fool=I counted up the money and it made a pretty penny,
&SONGS`WRONGCOMPANY Singing Fool=Flogging Molly|Wrong Company
&SONGS`WRONGCOMPANY`1 Singing Fool=Well I fell into prison about a quarter till three
&SONGS`WRONGCOMPANY`2 Singing Fool=Where I found in my cell a glass waiting for me
&SONGS`WRONGCOMPANY`3 Singing Fool=So I filled what was empty and I pulled up a stool
&SONGS`WRONGCOMPANY`4 Singing Fool=But he stood in the corner, the old devil wouldn't move
&SONGS`WRONGCOMPANY`5 Singing Fool=He said, "You drink when you're lonely." No I drink when I want!
&SONGS`WRONGCOMPANY`6 Singing Fool=He said, "You'll never be sober." Sure. Why would I want that?
&SONGS`WRONGCOMPANY`7 Singing Fool=I only drink to be merry but unfortunately
&SONGS`WRONGCOMPANY`8 Singing Fool=I'm in the wrong prison cell and the wrong company
&SQUEUE Singing Fool=
&STARTUP Singing Fool=@drain me;@set me=squeue;@emit [u(msg`startup)]
@set Singing Fool/STARTUP=no_command prefixmatch