Sound Issues

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Zha Hong Lang
Nipper
Nipper
Posts: 445
Joined: Thu Jun 22, 2017 10:14 am

Re: Sound Issues

Postby Zha Hong Lang » Sun Oct 01, 2017 11:32 pm

You're redefining the function for each if statement. It's the same as if you made a robot to do your daily chores and gave it instructions, but then you replaced it three times, giving it new instructions each time.

You can fix this problem by creating a single onInputUpdate() function and making an if/elseif/else chain inside it for each value of drownCounter.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Sound Issues

Postby The0x539 » Mon Oct 02, 2017 11:35 am

TheKidCodee wrote: What do you mean by "chain"?

Code: Select all

function onWhateverCallback()
	if conditionA or conditionB or conditionC then
		actionA()
	elseif conditionD and conditionE then
		actionB()
	elseif conditionF then
		actionC()
	else
		actionD()
	end
end
Last edited by The0x539 on Mon Oct 02, 2017 5:09 pm, edited 1 time in total.

Zha Hong Lang
Nipper
Nipper
Posts: 445
Joined: Thu Jun 22, 2017 10:14 am

Re: Sound Issues

Postby Zha Hong Lang » Mon Oct 02, 2017 3:30 pm

TheKidCodee wrote:What do you mean by "chain"?
also sorry if i sound a little dum im new to lua
Keep in mind that 1 script plays a different sound.
0x showed you what a chain of if/elseif/else statements looks like. It allows you to do different things depending on different conditions. So, you can set it up so that for each condition it'll play a different sound.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Sound Issues

Postby The0x539 » Sat Oct 07, 2017 2:26 pm

TheKidCodee wrote: What do you mean by Condition?

Code: Select all

drownCounter ==
?
Your question would make sense if it were

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Sound Issues

Postby The0x539 » Sat Oct 07, 2017 2:41 pm

TheKidCodee wrote:
The0x539 wrote:
TheKidCodee wrote: What do you mean by Condition?

Code: Select all

drownCounter ==
?
Your question would make sense if it were
Does It mean drownCounter == (number)?
A condition is any expression meant to evaluate sometimes to true and sometimes to false.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 7 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari