I’ve been looking for a way to make a randomizer for one of my games. I want it to do a random emoji whenever you click a box, like a fortune cookie. I saw a post saying you need to use a set value block but I don’t have those. I’m posting this here because it won’t let me in Deprecated. Thanks.
Do you mean like the box turns in to the emoji or the emoji is a different object?
All you have to do is put in the box code:
When SELF is tapped
Set variable (variable) to random 1 to (the number of different types of emojis you want)
Then put in the emoji object’s code
When (variable)=1
Set text to (the emoji you want)
Do that with every possible number that (variable) can be.
@Fundardo posted the answer that you need! You basically just need to make a new variable, then make it to a random number and use “when (variable) equals ___” togheter with “Set text” blocks and you are done.
Yeah, everyone’s basically answered your question – the reason why you don’t have a “set value” block is because variables were originally called “values” so the block names have changed a bit.
Easy-
When self is tapped
Set variable(name) to random 1 to (whatever you want)
Then get a text.
In its code,-
When (variable name)=1,
Set text to(emoji)
When(variable name)=2
Set text to(emoji)
When(variable name)=3
Set text to (emoji)
And so one…
I’m really confused. I made the variable, but I don’t get the rest. Sorry, I’m bad at coding.
Alright, I figured out how to make it random, but how do I get the object codes?
What do you mean by objects?do you mean the emoji that comes up?
It makes me sad why Hopscotch can’t add arrays and strings ugh this is why I code on JavaScript
Hahahah = Jeffery
Woah!how did you do that!I want to use the strings feature
It doesn’t actually work.
Why not? It works fine for me. You must have made a mistake
Well you can’t actually do what strings normally can do. Like you can’t do Set String to Hello and do Set Text String and have it display the string.
What does that mean now
You edited the json file right