-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Scarpet run('command')
function does not return any values
#2023
Comments
Ok, I did some digging and figured out the problem The command execution changed so that when you run a command while you are handling a command, the requested command gets put on the pile allowing the current command to finish. This impacts situations like It has nothing to do with threading. The issue can be mitigated by not running commands from commands, for instance this works:
as well as calling |
Hey there, my deepest apologies for the delayed response; I had missed the fact that this bug would only occur if it was called from another command, so this problem scope is more limited than I first thought, thank you for the added explanation and details; I believe keeping (edited, had not seen the new commits, thank you for fixing the return code issue and updating the documentation) |
I've reopened the pull request (#2036) with |
Description
The
run('command')
function never (except in a syntax exception error) returns the command's values, and always returns[0, [], null]
Evidence/steps to reproduce:
Test 1:
/script run run('execute if entity @s')
Expected output:

[1, [Test passed, count: 1], null]
(Ran with minecraft 1.20.1, fabric 0.16.9, carpet v1.4.112+v230608)
Observed output:

[0. [], null]
(Ran with minecraft 1.21.4, fabric 0.16.9, carpet v1.4.161+v241203)
Test 2:
/script run run('execute unless entity @s')
Expected output:

[0, [], Test failed, count: 1]
(Ran with minecraft 1.20.1, fabric 0.16.9, carpet v1.4.112+v230608)
Observed output:

[0. [], null]
(Ran with minecraft 1.21.4, fabric 0.16.9, carpet v1.4.161+v241203)
Guessed Source
Thank you to @dmunozv04 for finding the source here;
We believe that due to the new way commands are handled, the current implementation of the

run('command')
function returns too early before the command is ever executed, provided it isn't a syntax error, which does give the correct output (see below)/script run run ('exec')
Attached is an image of the implementation with an additional oversight highlighted, where the command success value is always set to 0, regardless of the actual command execution

The text was updated successfully, but these errors were encountered: