[Solved]How to set custom sequence of numbers to pick

Get help using Construct 2

Post » Tue May 09, 2017 9:55 am

How can i set custom sequence of numbers
for example when we use choose(1,2,3,4,5,6,7,8,9..,15) then choose function pick randomly
but I want to choose numbers by sequence (15,8,2,6,6,8,7,9,15,14,12)
first pick 15, second pick 8, third 2, then 6, 6,8,7 and so on
How it could be possible ???
==========================
Is this possible to play set of sound effects with the help of "global variable" instead of "Name"
for example
i have sound effects named "1","2", "3", "4", "5" i want to play these with the help of variable
Last edited by luckyrawatlucky on Wed May 10, 2017 6:26 am, edited 1 time in total.
Image
B
72
S
41
G
48
Posts: 687
Reputation: 34,290

Post » Tue May 09, 2017 10:35 am

There is an awesome plugin for that.
plugin-smart-random_t163624

But. Without a plugin, it can be done easly with an array.
https://www.dropbox.com/s/xtr3zklmee37w ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 09, 2017 11:14 am

99Instances2Go wrote:There is an awesome plugin for that.
plugin-smart-random_t163624

But. Without a plugin, it can be done easly with an array.
https://www.dropbox.com/s/xtr3zklmee37w ... .capx?dl=0


But numbers should be set by me not by itself
if i set numbers sequence 15,8,2,6,6,8,7,9,15,14,12
then these numbers should come when reach to 12 then restart sequence

and Is this possible to play set of sound effects with the help of "global variable" instead of "Name"
Image
B
72
S
41
G
48
Posts: 687
Reputation: 34,290

Post » Tue May 09, 2017 11:27 am

Oh i misunderstood. Not randomly.

https://www.dropbox.com/s/1d36j6hin531h ... .capx?dl=0

To play use ... Audio > action > Play (by name) .....
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 09, 2017 12:06 pm

Thanks sequence is good that i want
But in Audio
i do not want to play (by name)
I have set audios name 1,2,3,4,5,6
now i want to play
No 1 audio when variable is 1
No 2 audio when variable is 2
No 3 audio when variable is 3 and so on
Image
B
72
S
41
G
48
Posts: 687
Reputation: 34,290

Post » Tue May 09, 2017 1:21 pm

Rename the audiofiles to "No1" ... "No2" ... etc
Play by name is then .... name = "No"&str(variable)
Use the tags .. set it to str(variable) or so

If you dont want to use Play (by name)
Then you need as many 'play' events as there are values in the sequence.

If variable = n
______ play the file "xx"
If variable = m
______ play the file "zz"

.......

If variable = z
______ play the file "aa"

That is not dynamical. And a lot of work. Dont understand why you dont want to use Play (by name)
What i miss (this time) ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 09, 2017 5:45 pm

here i was wrong
i said i never want to use Play (by name)
but i should say that
i want to use variable as "name"
i will try it later
Image
B
72
S
41
G
48
Posts: 687
Reputation: 34,290

Post » Tue May 09, 2017 6:45 pm

Variable as name is no problem.
Use Play (by name) ... name is any basestring & variable converted to a string

Rename the file to a basestring and a number.

You can also use a lookup table. If you dont wanna rename the files.
That is an array with on the x index (index = variable) the name of the file stored (as a string).

Use Play (by name) ... name is = Array.at(variable)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed May 10, 2017 6:26 am

Thank you
this is what i want
now everything is working fine
Image
B
72
S
41
G
48
Posts: 687
Reputation: 34,290


Return to How do I....?

Who is online

Users browsing this forum: LunaticCat and 3 guests