mojira.dev
MC-132851

function loops continue after exit

Been trouble shooting this for a while.

Create a function loop with breaking criteria

execute unless entity @s[tag=break] if entity @s[scores={Count=..499}] positioned ^ ^ ^0.1 run function methods:test/loop

 

In the same file, create a command to run if loop breaks.

execute if entity @s[tag=break] positioned ^ ^ ^ run function methods:test/saysomething

Expected result, Breaking the loop causes saysomething to execute once providing a single message.

Actual result, Breaking the loop results in saysomething spamming the screen.

I do not believe the positioned tag has anything to do with it but I left it in to show how im using it.

( *** Edit *** ) It just occurred to me that this is not necessarily a bad thing as some functions may benefit from this sort of behavior. I would like to suggest actually making it official but activated by some sort of parameter at call time.

Comments 4

Have been fiddling and found a workaround. (*** I was wrong, its not a work around ***)

execute if entity @s[tag=break] unless entity @s[tag=stop] positioned ^ ^ ^ run function methods:test/saysomething 

if entity @s[tag=break] run tag @s add stop

Well, I thought it was a work around however the function continues to advance the coordinates meaning even though i detected a non air block at ~ ~ ~ its now advanced past that so any testing at those coordinates is now useless.

Are the commands you have written in the description a part of methods:test/loop or a different function?

I think you might be able to get the behavior you want by simply switching the order of the two commands.

Regardless this is intended. Running a function queues all of its commands.

Michael Hurt

(Unassigned)

Unconfirmed

(Unassigned)

Minecraft 1.13-pre6

Retrieved