How do I stop 2 same numbers appearing twice in a row

Get help using Construct 2

Post » Sun Aug 28, 2016 3:09 pm

I have created an array sheet existing of numbers: 1 to 10. I also have a button in game that calls a value from the array when clicked. I wanted to make it so that it will always call (a random number). So basically when the button is clicked, it can show anything between 1 to 10. ex. 1,5,9,6,2... and so on.

My problem is, that when I click the button to call a random number, it sometimes can come out the same. ex. 1,5,2,2,8,10,8,8,8... and so on.
I do not want the possibility of the same number appearing twice or more in a row.

Can someone please explain to me how I may approach this problem with a better solution than I have already tried. I tried the (variable) If equal to (array) statement, and toyed with it for a good while, but couldn't produce anything that would work.

Now I do not believe you need to know any specifics more than this, but if you still do, I am more than happy to provide more detail.
B
2
Posts: 5
Reputation: 160

Post » Sun Aug 28, 2016 3:18 pm

The best way I can think of is to simply erase the value you've just called from the array.
B
7
S
3
G
3
Posts: 56
Reputation: 2,240

Post » Sun Aug 28, 2016 3:28 pm

ImageImageImage
B
71
S
22
G
248
Posts: 3,756
Reputation: 138,063

Post » Sun Aug 28, 2016 3:28 pm

Estecka wrote:The best way I can think of is to simply erase the value you've just called from the array.


I do not want to erase the value. The system has to repeat these numbers forever as long as the button is clicked.
B
2
Posts: 5
Reputation: 160

Post » Sun Aug 28, 2016 3:40 pm

blackhornet wrote:https://www.scirra.com/forum/plugin-smart-random_t163624?&hilit=BHT+Smart+Random


I am sorry, but I am unable to understand how to use your plugin. I fail to understand what is Construct 2 GUI where it asks me to drop the file, and also how to access the feature inside construct 2 afterwards.
B
2
Posts: 5
Reputation: 160

Post » Sun Aug 28, 2016 3:41 pm

Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sun Aug 28, 2016 3:46 pm

ImageImageImage
B
71
S
22
G
248
Posts: 3,756
Reputation: 138,063

Post » Sun Aug 28, 2016 3:59 pm

blackhornet wrote:http://blackhornettechnologies.com/Construct2/plugins/BHTSmartRandom.aspx


yeah I read that, did not make sense to me.
B
2
Posts: 5
Reputation: 160

Post » Sun Aug 28, 2016 4:00 pm

korbaach wrote:Image


I feel like this one will do the trick, but I am puzzled by the fact that it lacks the actual array containing all the information that is then being called by your code.
Also to point out, when I click the button, nothing happens. It does not display my numbers or anything after copying your code
B
2
Posts: 5
Reputation: 160

Post » Sun Aug 28, 2016 7:50 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 46 guests