Page 1 of 1

Final Music lua problem (Solved)

Posted: Fri Sep 20, 2024 10:27 am
by Levelmaker_123
Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?

Re: Final Music lua problem

Posted: Fri Sep 20, 2024 10:41 am
by mariobrigade2018
Levekmaker_123 wrote:
Fri Sep 20, 2024 10:27 am
Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?
Correct me if I’m wrong, but could you use an “if else if chain”for that?

Re: Final Music lua problem

Posted: Fri Sep 20, 2024 2:37 pm
by Levelmaker_123
mariobrigade2018 wrote:
Fri Sep 20, 2024 10:41 am
Levekmaker_123 wrote:
Fri Sep 20, 2024 10:27 am
Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?
Correct me if I’m wrong, but could you use an “if else if chain”for that?
I could try that