#mcfunction seems not to be repeating itself even with /schedule function

1 messages · Page 1 of 1 (latest)

rapid field
#

Please have a look at the attached mcfunction. There are some lines that make an aoe cloud run another function when a button at specified coordinates is pressed. When this function is repeated on a command block with "function drgrid:tenticks", the button gives responses; but it doesnt seem to work on itself, even with the first line "schedule function drgrid:tenticks 10". Is there something wrongwith the /schedule command? I would prefer not to put it in the tick tag, as the other function would spam the chat with /tellraw if it's run on each tick.
Version: 1.20.1 forge

slim marlinBOT
#

<@&1201956957406109788>

Someone will come and help soon!

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

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

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

lament lava
#

It doesn't repeated because you didn't specify the time right

#

10

#

10 what?

#

t/s/d

dusty scarab
#

10 is valid, but I'm not sure what it defaults to

#

Presumably ticks

lament lava
#

really? I thought it gives a syntax error

dusty scarab
#

Nope

#

It is good practice to specify units though

rapid field
#

okie I'll try and get back here after a moment, not sure why there's other two functions that works without the units but this one just doesnt

dusty scarab
#

Presumably the file is located in data/drgrid/functions/tenticks.mcfunction

#

Also are you sure the functions isn't running and it's not some other part of your code that isn't working?

#

Try adding a /say command in there to see when it's running

#

And of course, make sure you run the function in the first place

rapid field
#

tried specifying the unit but no luck, but pressing the button still give responses with a repeating command block "/function drgrid:tenticks" just like before

#

file location checked, it's exactly like the path you gave

#

it's very weird how the mcfunction would run on command blocks, but not in the data pack, not even after manually running it once

dusty scarab
#

oh wait

#

no nevermind

#

Is this in the overworld?

rapid field
#

yes

dusty scarab
#

The only thing I can think would be different between command blocks and functions is the context (e.g. where the command is run)

rapid field
#

same, I specifically used an aoe cloud to run it as these coordinates aren't in the spawn chunks, so it would run as long as somebody's loading the chunks and therefore loading the aoe cloud

dusty scarab
#

ah

#

That could be an issue

#

Which command did you use in the command block then?

rapid field
#

"function drgrid:tenticks"

dusty scarab
#

hmm ok that's fine then

#

It may not work if you were running the function in some context

#

I really don't know tbh

rapid field
#

would there be some sort of workaround? A button that triggers a function without a command block directly visible in the player's sight

dusty scarab
#

There's surely a reason this isn't working, and it (almost) definitely is fixable, I'm jus not sure as to what/how that is

rapid field
#

would you mind testing the full data pack? There's some Chinese in the /tellraw messages but it shouldn't be relevant

dusty scarab
#

Try checking the logs first

sacred tuskBOT
#
:information_source: Default Launcher Logs

The logs are where Minecraft displays errors when something goes wrong and can thus help you gain information about why something isn't working for you!
To open the logs:

  1. Enable logs in the Minecraft Launcher
  2. Start your game (or restart it if you already have an open instance)
  3. Enjoy spotting errors getting much easier!
dusty scarab
#

If there's no errors there I can look into it

rapid field
#

I checked the logs before, but all results that comes from "drgrid:tenticks" came from the command blocks and I couldn't find any obvious errors when it was loaded

#

and just to be sure I reopened the world a few times in stead of using /reload or disabling and re-enabling it

dusty scarab
#

Ok

#

I can't look right this moment but I'll check it out later

rapid field
#

there's some fixed coordinates so it might be better to test it on a superflat

#

understandable, this is a really weird one, thank you for helping me out ❤️

rapid field
#

update, this might be some progress: I tried messing around with /function and actually executing commands inside the function, now I suspect that it's the other function it calls upon that's not working properly

#

execute as @e[type=minecraft:area_effect_cloud,tag=drgridcheckpoint1] run tellraw @a[distance=..3] "congrats"

#

I tried running this in a command block and move around

#

I receive the tellraw message near the command block, but not near the aoe cloud

#

oh no i didn't expect the other function to be the culprit but I really think this is where it is, I ran it like execute as @e[tag=drgridcheckpoint1] if block 2024 69 1060 minecraft:stone_button[powered=true] run execute as @e[tag=drgridcheckpoint1] run function drgrid:checkpoint1

#

so now the problem should be

#

how to run a command as an aoe cloud entity on nearby players?
Am I doing it right by this? execute as @e[type=minecraft:area_effect_cloud] run tellraw @a[distance=..3] "message"

dusty scarab
#

Yes, but you need to add at @s so the command is executed at the area effect cloud rather than world spawn

rapid field
#

ahhhhh ok I'm trying this immediately

#

it works now oh god I didnt expect the error to be over there I'm so sorry

#

thank you very much

dusty scarab
#

That's why I suggested only testing the scheduled function to make sure the bug wasn't somewhere else in the code

slim marlinBOT
# rapid field thank you very much
🎗️ Is your question resolved?

If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D

slim marlinBOT
# slim marlin
Question Closed

Your question, #1246079911379341382 (mcfunction seems not to be repeating itself even with /schedule function), was resolved!

Original Message

#1246079911379341382 message

Duration open

1h13m

rapid field
#

maybe I didn't test it the right way or I misunderstood something, anyways big thanks for helping out!

slim marlinBOT
dusty scarab
#

You're welcome

#

It's a learning experience