Musical Instrument Code Snippet

Posted by Longbow on Wed 22 Jun 2005 05:47 PM — 11 posts, 49,718 views.

#0
Howdy folks, I was wondering if anyone knows where I could find a snippet for Smaug that allows you to compose songs and play them on instruments ingame? I liked the system T2T MUD used but they don't use a Diku-dirived base so I can't get it from them.

Thanks and Godbless,
Longbow
USA #1
What does it mean to compose songs and play them in-game?
#2
Well, you'd type the compose command and enter the words for the song, then you could play it on an instrument. It'd display the words of the song verse by verse with an occasional interlude so you knew where the verses ended and started.
USA #3
When you say verse by verse, do you mean there'd be a pause in between? Could you provide an example of output?
Canada #4
Sounds to me like it may just be a mud prog on an object with a new trigger, and the mud prog utilizes mpsleep. This would not be to hard to construct, new object type, new prog trigger possibly, and parse through the buffer output replacing empty lines with "mpsleep x".
#5
Yes, there'd be a pause in between so you don't get a massive text field. Greven, could you give me an example of what you're talking about please?

Longbow
Australia #6
Take a look at the jukebox snippet for rom that around the traps, that pretty much does what you want, except that you dont play an instrument, you pay to play the song, very easy to modify to suit what your trying to do tho.
USA #7
Perhaps not so easily modified, since the song is composed by the player, not hardcoded into the script. The prog would have to pick up the lines from the buffer the player entered.
USA #8
MPSleep is a way to temporarily pause a mob program. Incredibley useful so you don't get masses of text. Anywho, this post is quite relevant:

http://gammon.com.au/forum/bbshowpost.php?bbsubject_id=2646

In there you'll find a bug fix and a link to a site that lists a version of mpsleep. Should be everything you need to get started :)
USA #9
Could go in and give each player a file similar to an area file, with a song list and add a small mprog to read the player's songfile, maybe?
USA #10
At this point you're talking more trouble than it's worth. How would you do that with mudprogs?

You'd be better off making it a timer-based command, somewhat like the search command. Would probably be much easier that way, not to mention less hack-prone.