mojira.dev
MC-264626

Execute unless function ignores non-zero return value in function

When running a command like

execute unless function skills:chances/1in3 run scoreboard players add @s skill_carpentry 1
execute unless function skills:chances/1in3 run scoreboard players add @s skill_carpentry 1

from inside a function the return value of the tested function is not checked. The command will be executed whether it is 0 or not. Only success is used.

The called function (skills:chances/1in3) is:

return run random roll 0..2
return run random roll 0..2

When this command is run in chat, it works as expected and the command is only run if the returned value is 0.

Attachments

Comments 1

It's not super clear what the issue is here. return fail is the intended way to make a function fail for purposes of if function

David Schulte

(Unassigned)

Unconfirmed

(Unassigned)

23w31a

Retrieved