Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Sep 12, 2005 1:43 am   

Lyrics Bot
 
I have a favor to ask of a few of the gurus out there I am trying to make a singing alias for a RP mud. I want to store the song in a database, which I haven't even played with using the database before.
Example:
Quote:
The snow's on the mountains, the snow's in the gill;
My sheep they have wander'd all over the hill;
Uprise then, my shepherds, with haste let us go
Where my sheep are all buried deep under the snow.

The dogs in the haggard are barking aloud
At the moon, as she struggles from under the cloud;
Uprise then, my shepherds, with haste let us go
Where my sheep are all buried deep under the snow.

Take staves and take lanterns, put on your *carranes;
We'll hunt in the mountains; we'll hunt in the plains;
Uprise then, my shepherds, with haste let us go
Where my sheep are all buried deep under the snow.

Then up rose those shepherds; with haste they did go
Where my sheep lay all buried deep under the snow;
They sought them with sorrow; they sought them with dread,
And they found them at last, but the sheep were all dead

In the database I would like it to store:
1) Name of the Song
2) Total verses
3) Store each verse with the syntax
4) Total Time song has been played

The alias I would like the following:
ssong <song> <delay tiime between each verse> <number of verses to sing>
The mud I play does have a sing command which just places the words you type into appropriate syntax
sing I am tired.
displays:
You sing in Westron,
"I am tired."

I would like also a way to stop the alias in progress if I want to.
Thanks in advance
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Sep 12, 2005 11:12 pm   
 
Anybody?
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Sep 13, 2005 3:24 am   
 
Choosing to store verses in the database is going to cause more headaches and waste lots of memory. I suggest you keep the lyrics in text-file form and simply point to the file in the database. This will give you what you want without having to use dirty tricks to beat the database module into submission.

First, create the database. You have to do this manually, as ZMud does not allow you to script the creation of one. I suggest including a field for name of song, artist who wrote the song, a field to contain the file name for the lyrics, and the other stats you want to record.

Next, after you have the database set up just like you want it, create the Ssong alias shell. This is going to be your key to the whole system, so you want to make sure it's naturally easy to use. For instance, you might want to first CHOOSE the song and bring it to the front of your mind (ie, load up the variables). Once a song is chosen and ready to go, you might want to do a little yammering at the audience about how you got the song or how it ties into whatever it was you were talking about. Instead of just launching into the song without preamble, maybe you'd like to START the song when ready. Finally, maybe something might happen while you're in the middle of a permformance that requires you to respond. For that you'd want a STOP option. Finally, maybe you as the player want to have some sort of control over the mechanics of your performance, like the delay between each verse or even prompting you the player to continue. This sort of thing is what I favor, so I typically throw in an OPTIONS option or something:

SSONG CHOOSE|START|STOP|OPTIONS

#ALIAS ssong {#if (%numparam() >= 2) {#noop we have enough parameters, time to validate;#if (%ismember(%1,"choose|start|stop|options")) {#noop %1 is valid option, time to validate %2;#case %ismember(%1,"choose|start|stop|options") {#if (@IsSinging = 0) {#query (&Name = "%-2") "" 1} {#noop this option isn't available while performing}} {IsSinging = 1;#NOOP stuff to build verse #1 SING command} {IsSinging = 0} {#NOOP I'll leave this to your imagination}} {#noop more helpful syntax reminders}} {#NOOP helpful syntax reminders, mostly just a bunch of prettily-formed #SAYs}}

This should get you in the general area, but it's not at all complete and as it stands it's not functional yet (so don't go pasting this into ZMud thinking you can just start singing willy-nilly). Also, it assumes you are leaving the song database open all the time; if not, some DB management code will need to be included to make sure it's loaded and closed.
_________________
EDIT: I didn't like my old signature
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Sep 13, 2005 4:50 pm   
 
Matt,
How would you set it up to recognize the end of each line in a verse?

Anybody else want to try this?
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Sep 13, 2005 11:16 pm   
 
To make it extremely easy on myself, I'd set up the file using a tag system:

[chorus]

[verse]

[refrain]

[bridge]
[EOF]

Each tag would specify the type of line (useful for when we go to store it in our datarecord variable). Blank lines would determine verse breaks, and the [EOF] tag is there so we can tell when we reached the end of the songfile.

The code would basically be the standard #FILE/#CLOSE stuff with a variable to catch the %read() output (it goes line-by-line). This variable would then be checked and assigned the next line in a loop, and we can use a #CASE with a couple of #IFs to do all our line-checking.

#NOOP stuff that sets the Song datarecord variable to its zeroed state goes here
#FILE 1 %concat("c:\your path to your songfiles\",&lyrics,".txt") //opens the text file so we can use it
Line = %read(1) //reads in the first line to be evaluated
#while (@line != "[EOF]") {#if (%begins(@line,"[")) {#noop this line is a tag line;#addkey Song %copy("[tag]this is a test",2,%eval(%pos("]","[tag]this is a test") - 1)) %db(@Song,%copy("[tag]this is a test",2,%eval(%pos("]","[tag]this is a test") - 1)))} {#noop this line is blank};Line = %read(1)}
#CLOSE 1 //closes the text file as we don't need it anymore

That should read the file in just fine, but to avoid overwrite problems with duplicate tags (ie, using [VERSE] for both verses 1 and 2) I would simply make sure to use numbers ([VERSE1], [VERSE2], etc) or instead of VERSE I'd use ordinals ([FIRST], [SECOND], etc)
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net