if then else issue [image attached]

Get help using Construct 2

Post » Mon May 05, 2014 3:30 pm

And another:
RandomScrollingSound0
RandomScrollingSound1
RandomScrollingSound2
RandomScrollingSound3

If foo audio object "Play by name" RandomScrollingSound&int(random(3))
Image ImageImage
B
169
S
50
G
170
Posts: 8,291
Reputation: 108,726

Post » Mon May 05, 2014 3:33 pm

DUTOIT, you just turn my long list of conditions into one.
You
ARE
AWESOME !

I saw your tip newt, but that would require me to rename the files ;p
You do not have the required permissions to view the files attached to this post.
B
12
S
3
Posts: 288
Reputation: 1,694

Post » Mon May 05, 2014 4:23 pm

Toddler wrote:DUTOIT, you just turn my long list of conditions into one.
You
ARE
AWESOME !


Just a minimalist at heart ;) and having experienced similar problem when I tried to shave off 1000 events and checks from entire project.
Glad you found it helpful.

@newt,
N1, even simpler - lol
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Tue May 06, 2014 1:06 am

newt wrote:And another:
RandomScrollingSound0
RandomScrollingSound1
RandomScrollingSound2
RandomScrollingSound3

If foo audio object "Play by name" RandomScrollingSound&int(random(3))


newt, can you please confirm, will the "int" pick the last sound (3), doesn't "int" rounds down the numbers? I thought that we had to use "round" on these cases, because round is picking the upper values when the number is e.g 2.6, it will choose 3.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Tue May 06, 2014 2:16 am

Nah, random, like everything else in C2 is zero based, meaning it starts at zero rather than 1.
Remember 0 is still an integer, it just has no value.
int(random(4)) would have included all 4 sounds.
Image ImageImage
B
169
S
50
G
170
Posts: 8,291
Reputation: 108,726

Post » Tue May 06, 2014 11:07 am

@newt

Ok, thanks!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Previous

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ChesVCF, OBLIVION, shinkan, yiuyiu6666 and 24 guests