Page 1 of 1

Re: Sound Issues

Posted: Sun Oct 01, 2017 11:32 pm
by Zha Hong Lang
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.

Re: Sound Issues

Posted: Mon Oct 02, 2017 11:35 am
by The0x539
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

Re: Sound Issues

Posted: Mon Oct 02, 2017 3:30 pm
by Zha Hong Lang
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.

Re: Sound Issues

Posted: Sat Oct 07, 2017 2:26 pm
by The0x539
TheKidCodee wrote: What do you mean by Condition?

Code: Select all

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

Re: Sound Issues

Posted: Sat Oct 07, 2017 2:41 pm
by The0x539
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.