New coblock sugjestion

i have a suggestion for a new coblock called pick random the coblock will have 2 parts but theres a option to add more you put coblocks in each part the coblock does as the title suggests and picks a random peace of code to run and you could add the chances of each option

Hi @Matthew_Leach, the difficulty with this is that any values which go into the random block would be oblong values, not action blocks (like move/position). The random piece of code could be multiple lines.

This is possible with Typescript, but not CoBlocks; however you can use the random integer to select random values from a list and apply them, for example:

You can see this in action here:

If you really want to run random code, use a random integer to generate a number in a variable, then use if/elseif blocks to check the number and run code accordingly.

Hope that helps!

Geoff @ TechLeap

not like that like this

Are you saying that it’s weighted, rather than random? ie, you want to pick a particular option 75% of the time? If that’s not it, please explain what you want to happen.

that is what i meant

Okay, so in that case, select a random integer from 1-4. If it’s 1, do option 1, else do option 2.

if random integer between 1 and 4 = 1 then do this else do that