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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Delvarin
Newbie


Joined: 25 Mar 2003
Posts: 6
Location: USA

PostPosted: Sat Apr 19, 2003 4:58 am   

Lyric Bot
 
Hi, just wanted to share my nice Lyric Bot with everyone else.

The bot works off of a database with the following fields(example song specs are listed in parenthesis):

SongName - Long Name of the Song(If I Can't)
SongKey - Key people use to access the song(ificant). Should be lowercase, without spaces.
Artist - The Artist(50 Cents)
Lyrics - This is the toughie. Since both newlines and the standard ; for list are unadvisable to be stored in a database, I use ~ to separate the lines. So, for example, if the lyrics were

Hello!
My name is Joe!
And I work, in, a button factory!

The lyrics variable would be

Hello!~My name is Joe!~And I work, in, a button factory!

By editing the script, it's very simple to change this character from ~ to something else.

Speed - # of seconds between each lyric. I typically use from 5-7 so people don't get spammed out.

Genre - This one is up to you. This is for informational purposes, and in the future sorting by genre. I use an exclusive option list with things such as Hard Rock, Rap, Pop, Country, the likes.

PlayCount - Again, informational, this should be set at 0 for new songs by default. It is incremented each time the song is played, and used to keep track of total plays, and the song with most plays, as well as information on a single song.

Future versions may have more than that, but that's all for now.

Once you've put a few songs in the database, you'll probably need to edit the triggers and the musicout command for your own mud. It is currently based on the Godwars mud I admin on.

Anyways, next version should include a !search command to search by genre, song name, and what ever else I think is nice.

One last note, don't use this on RP muds(without some serious changes), or one's that you don't have the admin's permission to use it on. It can generate a lot of spam :-P. I'd make sure you have an option to turn the channel off.

To use this, just put it in a .txt file and go to Edit->Import->Script. Make sure to edit it for your mud before you turn the folder on.


#CLASS {MusicDB}
#ALIAS music_nextline {#IF (@music__songdone == 1) {music_endsong} {#MATH music__line {@music__line + 1};#IF (@music__line > %numitems( @music__lyrics)) {music_endsong} {#VAR _music__nextline {%item( @music__lyrics, @music__line)};musicout @_music__nextline;#ALARM +@music__speed {music_nextline};#UNVAR _music__nextline}}}
#ALIAS music_announce {#VAR _music__stringout {I'm on! Commands~: !listsongs, !playsong songname, !stopsong, !info, !info songname, !commands. Use music to enter commands. If you don't want to hear me, type CHAN -MUSIC.};#IF (@music__currentlyplaying == 1) {#VAR _music__stringout {@_music__stringout Currently playing @music__currentsong~.}} { #IF (@music__warmtimer > 0) {#VAR _music__stringout {@_music__stringout Time to warm up~: @music__warmtimer}} {#VAR _music__stringout {@_music__stringout I'm ready to play, let's kick up the beat!}}};musicout @_music__stringout;#UNVAR _music__stringout}
#ALIAS music_warmed {musicout I'm warmed up again! Use !playsong to play the song of your choice!;#VAR music__warmtimer {0}}
#ALIAS music_endsong {musicout Thanks for listening!;#VAR music__warmtimer {120};#VAR music__currentlyplaying {0}}
#ALIAS musicout {music ~#PMusicBot~:~#R %-1}
#VAR music__db {music} {music}
#VAR music__currentlyplaying {0} {0}
#VAR music__warmtimer {0} {0}
#VAR music__lyrics {} {}
#VAR music__currentsong {} {}
#VAR music__line {1} {0}
#VAR music__speed {6} {0}
#VAR music__songdone {1} {1}
#VAR music__lastsong {}
#VAR music__lastartist {}
#VAR music__lastplayer {}
#TRIGGER {(*) sings '!playsong (%w)'.} {#DBLOAD @music__db;#IF (@music__currentlyplaying == 1) { musicout Sorry, song's already playing! Use !stopsong to stop it.} { #IF (@music__warmtimer > 0) { musicout Please wait @music__warmtimer seconds to play another song. Give the jukebox a rest!} {#VAR _music__dbsearch {%query( &SongKey=%lower( %2), @music__db)};#IF (%numitems( @_music__dbsearch) == 0) { musicout Sorry! Can't find that song!} {#DBGET %item( @_music__dbsearch, 1);#MATH _music__countinc {%rec.PlayCount + 1};#VAR music__currentlyplaying {1};#VAR music__lyrics {%replace( %rec.Lyrics, ~~, |)};#VAR music__currentsong {%rec.SongName};musicout Playing Song - ~"%rec.SongName by %rec.Artist~";#VAR music__line {0};#VAR music__speed {%rec.Speed};#VAR music__songdone {0};#ALARM +@music__speed {music_nextline};#VAR music__lastsong {%rec.SongName};#VAR music__lastartist {%rec.Artist};#VAR music__lastplayer {%1};#DBPUT %rec.num PlayCount @_music__countinc;#DBSAVE;#UNVAR _music__countinc};#UNVAR _music__dbsearch}}}
#TRIGGER {(*) sings '!info (*)'.} {#DBLOAD music;#VIEW music;#VAR _music__dbsearch {%query( &SongKey=%lower( %2), @music__db)};#IF (%numitems( @_music__dbsearch) == 0) { musicout Sorry! Can't find information for that song.} {#DBGET %item( @_music__dbsearch, 1);musicout ~"%rec.SongName by %rec.Artist~". Key~: %rec.songkey. Speed~: 1 lyric per %rec.Speed seconds. Genre~: %rec.Genre. Played~: %rec.PlayCount times.};#UNVAR _music__dbsearch}
#TRIGGER {(*) sings '!stopsong'.} {#IF (@music__currentlyplaying == 1) {#IF (%1 == @music__lastplayer) {#VAR music__songdone {1};#VAR music__currentlyplaying {0};musicout %1 bashed the jukebox! Stopping Song!} { musicout You can't stop other peoples songs. Try CHAN -MUSIC until the song is over.}} { musicout There's no song currently playing. Dummy :-P.}}
#TRIGGER {(*) sings '!listsongs'.} {#DBLOAD @music__db;#VIEW @music__db;#VAR _music__stringout {Song List ~-};#VAR _music__iter {0};#VAR _music__recordcount {%numrec( )};#IF (@_music__recordcount == "") { musicout There are currently no songs in the jukebox.} { #WHILE (@_music__iter < @_music__recordcount) {#DBGET @_music__iter;#VAR _music__stringout {@_music__stringout %rec.SongName by %rec.Artist~(%rec.SongKey~)};#MATH _music__iter {@_music__iter + 1};#IF (%mod( @_music__iter, 5) == 0) {musicout @_music__stringout;#VAR _music__stringout {}}}};#IF (@_music__stringout != "") {musicout @_music__stringout;#VAR _music__stringout {}};#UNVAR _music__stringout;#UNVAR _music__iter;#UNVAR _music__recordcount}
#TRIGGER {(*) sings '!commands'.} {music_announce}
#ALARM {1} {#IF (@music__warmtimer == 1) {music_warmed};#MATH music__warmtimer {%max( @music__warmtimer - 1, 0)}}
#ALARM {600} {music_announce}
#TRIGGER {(*) sings '!info'.} {#DBLOAD music;#VIEW music;#VAR _music__playtotal {0};#VAR _music__iter {0};#VAR _music__numrec {%numrec( )};#VAR _music__maxname {0};#VAR _music__maxcount {-1};#VAR _music__nummaxes {0};#WHILE (@_music__iter < @_music__numrec) {#DBGET @_music__iter;#MATH _music__playtotal {@_music__playtotal + %rec.PlayCount};#IF (%rec.PlayCount == @_music__maxcount) { #MATH _music__nummaxes {@_music__nummaxes + 1}} { #IF (%rec.PlayCount > @_music__maxcount) {#VAR _music__maxcount {%rec.PlayCount};#VAR _music__maxname {%rec.SongName};#VAR _music__nummaxes {1}}};#MATH _music__iter {@_music__iter + 1}};#VAR _music__stringout {Last Song~: @music__lastsong by @music__lastartist ~- played by @music__lastplayer~. Total Plays~: @_music__playtotal~.};#IF (@_music__nummaxes == 1) { #VAR _music__stringout {@_music__stringout Max Plays~: @_music__maxname has been played @_music__maxcount times.}} { #IF (@_music__nummaxes > 1) { #VAR _music__stringout {@_music__stringout Max Plays~: @_music__nummaxes songs tied with @_music__maxcount plays each.}}};#VAR _music__stringout {@_music__stringout Songs In Jukebox~: @_music__numrec~.};#IF (@music__currentlyplaying == 1) {#VAR _music__stringout {@_music__stringout Currently playing @music__currentsong~.}} { #IF (@music__warmtimer > 0) {#VAR _music__stringout {@_music__stringout Time to warm up~: @music__warmtimer}} {#VAR _music__stringout {@_music__stringout I'm ready to play, let's kick up the beat!}}};musicout @_music__stringout;#UNVAR _music__playtotal;#UNVAR _music__iter;#UNVAR _music__numrec;#UNVAR _music__maxname;#UNVAR _music__maxcount;#UNVAR _music__nummaxes;#UNVAR _music__stringout}
#CLASS 0
Reply with quote
Delvarin
Newbie


Joined: 25 Mar 2003
Posts: 6
Location: USA

PostPosted: Sat Apr 19, 2003 5:01 am   
 
Sorry about that, as you can see some of my mud specific variables were in that one. I forgot to clear those out. If there's anything offensive in there that should probably be edited out(though I do censor the songs).
Reply with quote
Delvarin
Newbie


Joined: 25 Mar 2003
Posts: 6
Location: USA

PostPosted: Sat Apr 19, 2003 5:25 am   
 
Just realized there's an option to modify the post. Most of the variables should be cleared out.
Reply with quote
Ziah
Novice


Joined: 11 Mar 2005
Posts: 40

PostPosted: Fri Mar 11, 2005 11:00 pm   
 
lol

nice script
Reply with quote
dvgalius2002@yahoo.com
Beginner


Joined: 01 Aug 2006
Posts: 21

PostPosted: Wed Aug 02, 2006 8:03 am   
 
Has anyone gotten this to work? I've tried using it on the newest version of Zmud and can't seem to get it to function properly. I think its due to not knowing how to making the Database properly. Any help would be appreciated.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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