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: Fri Apr 15, 2005 11:07 pm   

Song Script
 
I have been trying to figure out how to make a song script, but I am not just thinking correctly. Here is what I want it to do. I want it to read in a file and put the word sing infront of each line. I also would like to wait a few seconds between each line in the song.

here is the syntax I would like to see.
sing <song name> <delay time between lines>

Also if anyone wants to try this. Maybe a way to sing only a certain verse would be cool. Also need a way to stop the alias once you start singing too.

Example song below
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.
_________________
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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Apr 15, 2005 11:30 pm   
 
Here is a crude version *untested* Should be able to stop it with #ABORT 1

#ALIAS song {
#FILE 1 %1.txt
#PRIO {
#LOOP 1,%filesize(1) {
#IF (!%null(%read(1,%i)) {sing %read(1,%i)}
#WAIT %eval(%2*1000) //wait %2 seconds between loops
}
}
#CLOSE 1
#ECHO Song Finished
}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Apr 18, 2005 3:15 pm   
 
Nexela,
the script does work other than on the blank lines it still shows the word sing. So the NULL isn't working. Any ideas?
_________________
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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Apr 18, 2005 8:01 pm   
 
Hmm try this


#IF (%len(%read(1,%i)>2) {sing %read(1,%i)}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Apr 18, 2005 9:30 pm   
 
That works... I think I will see if I can get a few more things to work, that I want to add. Thanks.

How about a way to sing only a certain verse or verses given.
_________________
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
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Mon Apr 18, 2005 10:34 pm   
 
to do verses you have to have a database txt file or store the selected verses in seperate txt files
%grep can retrive alot of different things , it works just like a trigger.

maybe even using the larger spaces and counting them?
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Apr 19, 2005 2:04 am   
 
Actually I have something that does work. I would like to get to know if I don't put the number of verses it will play all of them.

Example: ssong <file> <delay> <number of verses>
Code:

#alias {
#IF ( %1 ~= "-h" ) {#ECHO ssong ~<file~> ~<delay~> ~<number of verses~>} {
  #FILE 1 %1.txt
  #VAR tverses ""
  #LOOP 1,%filesize( 1) {
;%len( %read( 1, %i))
    #IF (%len( %read( 1, %i))>2) {sing %read( 1, %i)}
;{#ADD tverses 1}
    #WAIT %eval( %2*1000) //wait %2 seconds between loops
    }
  #CLOSE 1
  #ECHO Song Finished
  #SHOW @tverses
  }
}
_________________
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)

Last edited by darmir on Tue May 03, 2005 7:06 pm; edited 1 time in total
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Tue Apr 19, 2005 1:03 pm   
 
Why do you use #unvar that is kind of sloppy especially if you have things organized into folders.

I set them normally with just #var
unless I am using #addi or something then I use #var verse ""
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Apr 19, 2005 2:15 pm   
 
I mainly did it for testing purposes to make sure my variable were clear. Yes. I usually do a #var <variable> "".
_________________
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 Jul 25, 2005 12:35 pm   
 
Really weird. I haven' t used this alias in a LONG time, but decided to use it and now it don't work. What ever values I put in it give me:
ssong <file> <delay> <number of verses>
It should only do that on the -h... Weird
_________________
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
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