[Mod] Random Play [0.001] [rand_play]

Post Reply
theshadow900
Member
Posts: 19
Joined: Tue Jun 23, 2015 04:52
In-game: theshadow

[Mod] Random Play [0.001] [rand_play]

by theshadow900 » Post

Random background music player

Add music to the sounds directory. Minetest only accepts ogg format at this time.
Do not use extra dots/periods in files names. It will not read them correctly.
Add music file names to list.lua according to the format in the examples list.

It will only randomly select those files accordingly. See sample files for example naming.

options in config.lua are commented to explain the use.
Definitely set them up first before using.

The batch and shell scripts included can be used to automatically create the list from the files in the sounds folder.
Or you can add and remove manually. Will only play those on the list.

NOTE: Be careful how much you put into the sounds folder, minetest will load them all. A large set of sounds will cause
very long loading times for the client.

Code: LGPLv2.1+, textures: CC BY-SA 3.0 Unported

Mod dependencies: default

it's a sound mod so no screenshots here. :)

I'm in the process of learning to mod with lua and this was one of my first builds. Hopefully it will be useful to someone.
Fully operational at this time but may add a couple things so leaving in WIP at the moment.

Download: https://github.com/theshadow-minetest/m ... d_play-mod
Last edited by theshadow900 on Sat Nov 07, 2015 09:25, edited 1 time in total.

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Excellent

by duane » Post

Brilliantly simple, though I'd suggest leaving the dash characters out of minetest mod names in future (and maybe the minetest and mod). You could also make chat commands to control the music.

Now I can set up that endless loop of "The Wreck of the Edmund Fitzgerald" on my server. Survive THAT, beeches!


Edit: You might also add a timer to change the prefix, selecting from a list, since (I'm assuming from lua_api) there are only eleven possible songs on any prefix. Or choose the prefix randomly from a list, or pick one based on the time of day. Endless possibilities.
Believe in people and you don't need to believe anything else.

theshadow900
Member
Posts: 19
Joined: Tue Jun 23, 2015 04:52
In-game: theshadow

Re: [Mod] Random Play [0.001] [rand_play]

by theshadow900 » Post

Ahhhh yes forgot to add the rename to instruction in the readme. Thanks for the reminder. The actual name when installed would just be rand_play. The name you see there is what the GitHub title is. I'll add that to the read me as soon as possible. And yes, I have thought of adding some of those type of options. Still learning lua as I go. That is why I am not asking for the release move. Also thought about learning to create a GUI that would allow the admin to set parameters from within. Thanks also for info that I was still wondering about. I had a feeling there was a max on number of files but didn't know for sure what it might be. 11 you say? Maybe I need to get a bit more complicated and write my own routine to extend that limit. Yea, more stuff to learn. Love it.

Will be considering your suggestions strongly and try to expand accordingly. Will be a great help in the learning process.
Last edited by theshadow900 on Sat Nov 07, 2015 09:26, edited 1 time in total.

theshadow900
Member
Posts: 19
Joined: Tue Jun 23, 2015 04:52
In-game: theshadow

Re: Excellent

by theshadow900 » Post

duane wrote:You might also add a timer to change the prefix, selecting from a list, since (I'm assuming from lua_api) there are only eleven possible songs on any prefix. Or choose the prefix randomly from a list, or pick one based on the time of day. Endless possibilities.
API limit removed. No longer uses the numbered list. Randomizing done within the mod itself. Whatever is in the list is what it chooses from. No prefix, no numbers, just a list of ogg files. :)

Also added a batch and bash script to assist in creating the list.

time of day and or areas may come later if time allows.

User avatar
benrob0329
Member
Posts: 1341
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
IRC: benrob0329
In-game: benrob03
Location: Michigan
Contact:

Re: [Mod] Random Play [0.001] [rand_play]

by benrob0329 » Post

Nice! I like that its simple. Anyone know of some good game music similar to that in the ambiance mod?

theshadow900
Member
Posts: 19
Joined: Tue Jun 23, 2015 04:52
In-game: theshadow

Re: [Mod] Random Play [0.001] [rand_play]

by theshadow900 » Post

Do a search for creative commons music. I found some pretty useful ones that way. Is how I got the example music that is bundled in this mod.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 17 guests