Make a button send a signal on a random channel

Hi! I hope everyone is doing well! I have a question, and I’m not really sure if this is possible or not, but if it is, could you show me how to do it? I have a button, and when pressed, I want it to randomly choose a channel to send a signal on. There would be 8 possible channels to choose from. Would this be possible? My first thought was that I could wire the button to a trigger and use blocks or something, but I’m not sure if that would work. I’ve never worked with a randomizer before, and I’m not really sure what I’m doing. Any help would be very appreciated! And I hope everyone is having a nice day!!

This is literally just a randomizer -_-
There is a guide on this too.
How to make a quick easy randomizer(updated version)
Use the search bar @KittensAreCute13 .

Use the blocks! I can’t get a detailed explanation right now though.

Yeah. I’ve never used a randomizer before and I have no idea what the blocks would say

Wire/use channels for a button to a trigger [button pressed → trigger trigger].
Create a block for the trigger:
Set variable Random to random integer 1 to 8.
Broadcast message on channel, create text with, “RandomChannel”, Random.


Then the channels that could be broadcast would be RandomChannel1, RandomChannel2, RandomChannel3, RandomChannel4, RandomChannel5, RandomChannel6, RandomChannel7, RandomChannel8.

2 Likes

OK, the button sends on a channel to a trigger.
In the trigger’s code, set a variable to a generated random number.
Now grab a if block, and get a bunch of else ifs on the if block.
The condition should be, if variable is 1, send on channel.
The next condition should be variable is 2, send on channel.
etc.

Well this is if you want other channel names.

2 Likes

Don’t ever forget concatenation for simplification!

1 Like

I already named my channels and it would be too much work to change the names of them. The channel names don’t have numbers in them. I probably should’ve thought of this sooner.

u can make it without channels as numbers u can just use ur’s channels to make things no need of making channels with numbers

Please use better grammar, using “u” and “ur” is confusing.

1 Like

Would you rather have the system or not have it? Your dedication to a GKC Project is a you thing…

Sorry for asking this, but how do I set a variable to a random number?

Variables section, get a variable, use the set variable to block.

For the random, there should be a block for it, I think it’s in essentials.
It’s generate random number from (number) to (number)

go to variable section than press add variable and then name variable random or whatever u want

1 Like

BRUH. ARE YOU KIDDING ME? I literally explained it.
bye

1 Like

I hear what you’re saying, but here’s the thing, I have over 250 triggers already using the channel names I already have…

1 Like

I’m sorry, I’m really trying, I’ve never used a variable before. I’m not very smart

1 Like

create a list of all your channels and than like
set random to random integers from 1 to 10
if random=1, broadcast a message on one of your’s channel
else if random=2, broadcast message on one of your’s channel

1 Like

It’s ok your doing great! (I’m making checkers and even I don’t know what their saying) You will figure it out!

1 Like

Thank you! I’m sorry for asking bad questions, I’m just so confused right now

1 Like