Is there a way to have a Command Block ask for Player Input?

Is there a way to have a Command Block ask for Player Input? - Drone view of modern buildings located in rows between roads in suburb of contemporary town on daytime

I want to set a Command Block that is hidden so when the player activates it by a button it'll give them an enchanted item based off their input. (the first part of a greater system)

so far I can use /give @p iron_sword 1 0 {ench:[{id:16,lvl:10}]} to give an Iron Sword with a Level 10 Sharpness Enchantment.

What I want to do is alter the above command so iron_sword, 16 and 10 can be inputted by the player (who will have a guide), so when the player activates the command block from a button they'll be asked to input these values. however when I google search minecraft command block player input i'm either getting "player input" as in the interface of the command block you create the commands or using /testfor

So how can I alter the command above so the player is asked to input the values?

NOTE: this is for 1.7.10



Best Answer

An exemple of trigger use:

scoreboard objectives add question trigger
scoreboard players enable @a question
/tellraw @a ["",{"text":"Do you think it will help you ? ","color":"gold","bold":"true"},{"text":"Yes","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/trigger question set 1"}},{"text":" ","color":"none","bold":"false"},{"text":"No","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/trigger question set 2"}}]
execute @a[score_question=1] ~ ~ ~ tell @p You answered Yes
execute @a[score_question_min=2] ~ ~ ~ tell @p You answered No



Pictures about "Is there a way to have a Command Block ask for Player Input?"

Is there a way to have a Command Block ask for Player Input? - Back view of faceless multiracial friends with backpacks blocking way for Latin American classmate
Is there a way to have a Command Block ask for Player Input? - Walkway of shabby residential building in snowy day
Is there a way to have a Command Block ask for Player Input? - Area of residential district with roofs of buildings



How do you get a command block to sense a player?

Using /say @p , the command block can report the nearest player. If the command block is placed after a finish line, it will say the finishers in order. Players can also do /tellraw @p {"text":"THIS IS A MESSAGE"} and when activated the message "THIS IS A MESSAGE" will come up on the chat system.

How do you make a player say something with a command block?

The center of interest of this post is another feature of Minecraft, and that is the use of commands in the game....How to select targets with Minecraft commands:TargetDescription@pTo target the nearest Player@rTo target a random Player@sTo target the person executing the command (yourself)2 more rows

What is the command to target a player in Minecraft?

You can give a player any item whenever you want using the /give command in Minecraft.



How to detect if a player is at a certain place! Java 1.16.1 COMMANDS IN DESCRIPTION




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Kelly, Keira Burton, Plato Terentev, Kelly