#Run a command when a specific message is entered in chat?

1 messages · Page 1 of 1 (latest)

alpine stump
#

I'm trying to make a survival, commands-off-friendly way to trigger the load function whenever.
If I could just figure out how to make it trigger whenever I need, I would be set to go.
Right now, the only way I can do that is to do [Esc], Open to LAN, Commands On, datapack disable, datapack enable, relog.

And I don't really want to do that every time, because I'm planning on resetting it a lot.

neat falconBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1738959271:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1337157395679543446

foggy gale
#

you can use a trigger scoreboard for that

#
Minecraft Wiki

Changes the executor player's score in a scoreboard objective with a "trigger" criterion, and un-enables the objective for this player. Allows non-operator players to modify their own scoreboard objectives under tightly controlled conditions. Often used to let players activate systems controlled by data packs or command blocks.

#

then the users can use /trigger <your_score> to add 1 to that score or /trigger <your_score> set <value> to set it to a certain value

alpine stump
#

This is for personal use in a singleplayer world. I feel like that's important.

#

I will try it.

#

...

#

I am not sure what I'm doing.

foggy gale
foggy gale
# alpine stump I am not sure what I'm doing.

ok so here is what you should do:

  1. create a scoreboard using scoreboard objectives add <your_objective> trigger
  2. enable that score for all players using scoreboard players enable @a <your_objective>
  3. run a function as all players who have that score larger than 0
  4. in that function reset the score using scoreboard players reset @s <your_objective>
  5. after the reset you put all the code you want to happen when the player uses the trigger
#

the users wil be able to trigger that score using /trigger <your_objective>

alpine stump
#

I think I'm at step 3 so far...

#

Assuming, I'm doing it right so far, what do I put in the curly brackets?

foggy gale
#

no, you should do execute as @a[scores={<your_objective>=1..}] run function oaaattimer:load

alpine stump
#

Okay

#

I'll be honest. I still have no clue what I'm doing.

#

So far, these are my tick and load functions (respectively)...

#

There are more tick functions than those two, but they're just title and playsound commands.

#

Dunno why I have the anchored bit of that one tick command.

#

It doesn't require it.

#

I feel like I'm so close yet so far still.

#

I added that to my tick functions

#

Okay, so it worked once...

#

And now it's just showing "You cannot trigger this objective yet".

#

I AM SO CLOSE, I CAN FEEL IT.

But I also feel like Ungus Bungus trying to work this out.

#

Wait

#

I GOT IT!

neat falconBOT
#
Question Closed

Your question, #1337509315086647426 (Run a command when a specific message is entered in chat?), was resolved!

Original Message

#1337509315086647426 message

Duration open

40m