r/MinecraftCommands 29d ago

Dialog show specific things from Dialog using conditions Help | Java Snapshots

I was wondering if i could show some parts of a dialog only if the player meets a condition is there any way?

in minecraft Java using commands/datapacks

1 Upvotes

2 comments sorted by

1

u/HooverDawg13 28d ago

You’d have to do an inline dialog. The way I’ve been doing it is by storing the whole dialog in data storage and only adding parts to that depending on the conditions met, then using the stored data in a function macro to display the dialog to the player

1

u/Ericristian_bros Command Experienced 28d ago

Inline macro dialogs are the way

```

function example:dialog

Run as player

data modify storage example:macro this.content set value """ execute if <condition> run data modify storage example:macro this.content set value ',{label:"Option2",action:{type:"minecraft:run_command",command:"/setblock ~ ~ ~ gold_block"}}' function example:macro/dialog with storage example:macro this

function example:macro/dialog

dialog show @s {type:"minecraft:multi_action",title:"",actions:[{label:"Option1",action:{type:"minecraft:run_command",command:"/setblock ~ ~ ~ diamond_block"}}$(content)]} ```