Hello again everyone!
I’ve made a block that runs an input with a set chance, and runs a different input if the chance “fails”
Here’s the block!
Any ideas to improve this?
P.S. if you can’t drag and drop. Here’s a script pic:
Hello again everyone!
I’ve made a block that runs an input with a set chance, and runs a different input if the chance “fails”
Here’s the block!
Any ideas to improve this?
P.S. if you can’t drag and drop. Here’s a script pic:
In my opinion, the error [{}] ::control for an invalid percentage isn’t worth the extra time the block takes to detect errors. Personally, I think the “%” does enough to imply the correct usage.
For the more objective feedback:
Generally avoid using the % or other special characters like “_” in blocks/variables. sometimes it messes with things internally, although this may have been fixed.
Your code seems to work very well, but it could be made easier to understand/optimized:
Even a primitive already does that...? It will not break until you append something to the percent sign, without a space.
set size to () %
Wow! You made my script look like a long waste of time (that’s a compliment)
Thanks for the feedback!
yes, I believe there was some exception if the % was at the end of the block. again, I could be wrong.
Thanks! it’s what the forums are for :D
No, the exception is if it is only % without a trailing character. That’s how it’s coded!
makes sense.
I think it’s best to still make sure the value is a number and between the allowed range. In this instance, it doesn’t make sense to allow people to do 200%, which in other instances makes sense.
Two things, besides the point already made that there’s no need to make a list of the values.
Thanks for the feedback! I’ll get to that.
seems like you forgot to click “apply” so the script pic doesn’t have the metadata.
Blocks seems to work, except if the chance is 100 there is a chance for the block not to work.
To fix this, switch the < to <=.
replied to the wrong post?
Indeed I have. Didn’t have my glasses on!
No, there isn’t a chance. Generally pick random from 0 to 1.0 is treated as having a range from (0,1) exclusive