Makecode Passing variables to "on chat command" block
I see there's a "+" symbol in the "on chat command" block that allows to pass a variable when calling the command from the chat window.
However, it seems that you can only pass a numeric variable. Is there any way to pass a string?
-
Good question. I tried to declare a string variable and use it to accept a string input to a chat command but was unsuccessful.
As an alternative, you could declare a function, perhaps:
0 -
Not allowing to pass string variables in chat commands seems a big limitation since the player can't invoke a function in the game, can he?
0 -
Can you help me understand the implementation you are going for here? What do you need to do with the string? Maybe we can find a work-around. =D
0 -
Could be something so simple as a chat command to greet another player in a multiplayer setting. The chat command would receive a string (a player's name) as a parameter and via a player.say block prints a greeting message personalized with the name received as a parameter
0 -
That's odd ... from the chat line you can only pass a numeric argument to a chat command. But when the player itself runs the chat command from inside the program, he can pass an argument ( player.runChatCommandWithArguments) ... but the argument has to be a string this time?
This is from the minecraft codebuilder help:
0
Please sign in to leave a comment.
Comments
5 comments