Can I randomize the title music with SNDINFO?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Can I randomize the title music with SNDINFO?

Postby SiFi270 » Tue Apr 10, 2018 2:08 am

I'm working on a mapinfo patch for the Serenity trilogy that can be loaded with all three wads and their music addons, but each one uses its own track for D_INTRO, D_INTER and D_VICTOR. After copying the relevant music files into the patch and replacing the D at the start of each with the first letter of the wad it's meant for, the intermission and victory music are easily handled with mapinfo, and for the title music I thought I'd use $musicalias and $random to play either Eternity's or Infinity's (since Serenity's is just the same as Doom's) but it doesn't seem to be that simple. Is there a workaround I can use to get the result I want?
User avatar
SiFi270
 
Joined: 10 Feb 2015
Location: Does anyone put a serious answer here?

Re: Can I randomize the title music with SNDINFO?

Postby ZzZombo » Thu Apr 12, 2018 4:23 am

I remember back then trying to do the same only to find out that music can't be randomized. Maybe things have changed, but unlikely.
ZzZombo
 
Joined: 16 Jul 2012

Re: Can I randomize the title music with SNDINFO?

Postby Apeirogon » Thu Apr 12, 2018 9:21 am

I know how do so using acs

Code: Select allExpand view
#include "zcommon.acs"

str songs_name[amount of songs] = { "song name 1", "song name 2", "song name 3", .....};
int pick_what_song_play;
       
script jukebox open
{
pick_what_song_play= random(0, amount of songs - 1);
SetMusic(songs_name[pick_what_song_play]);
}
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Can I randomize the title music with SNDINFO?

Postby Gato303 » Sat Aug 18, 2018 9:11 pm

Apeirogon wrote:I know how do so using acs

Code: Select allExpand view
#include "zcommon.acs"

str songs_name[amount of songs] = { "song name 1", "song name 2", "song name 3", .....};
int pick_what_song_play;
       
script jukebox open
{
pick_what_song_play= random(0, amount of songs - 1);
SetMusic(songs_name[pick_what_song_play]);
}


That's cool, thanks for the script help.
Tho... how do you set the script to be executed when the Title Screen shows up?
User avatar
Gato303
 
Joined: 30 Mar 2016
Location: Colombia

Re: Can I randomize the title music with SNDINFO?

Postby Apeirogon » Sun Aug 19, 2018 8:24 am

Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Can I randomize the title music with SNDINFO?

Postby Gato303 » Tue Jan 08, 2019 11:24 am

Apeirogon wrote:https://zdoom.org/wiki/TITLEMAP


Thanks! Had a bit of tough time creating a simple map on Slade3 cause of my inexperience and creating a WAD file containing the Titlemap inside the PK3. But finally I could figure it out and it's working, thanks :) :D
User avatar
Gato303
 
Joined: 30 Mar 2016
Location: Colombia


Return to Scripting

Who is online

Users browsing this forum: Cherno and 1 guest