Skript

Skript

788k Downloads

Option to disable the "is already a text" warning

Closed this issue · 6 comments

commented

Suggestion

Using functions returning a string in command attributes results in an "is already a text, so you should not put it in one" warning. This can be annoying, and an option to disable these warnings is missing from config.sk.

Example:
command cmd:
  permission: command.cmd
  permission message: %lang("permission", sender)%
  trigger:
     send "Hello!"

Why?

Especially when implementing things such as multi-language support, using functions within the usage or permission message of a command can become essential. Both removing the warning in cases like this and adding an option to disable them via the configuration would go a long way. Thank you!

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

I'm assuming

permission message: lang("permission", sender)

is interpreted literally then (i.e. it doesn't execute the function)? I don't think the issue here is that we need an option to suppress this warning, but rather that we need to fix it from being erroneously reported in cases like this.

commented

Thank you for the quick reply! I agree, removing the warning here would definitely be the way to go. However, having an option to disable them completely also would be useful in some cases.

The function is being executed properly. The issue is that the entry is already being parsed as a string. lang() returns a string, so all you have is a string inside another string, which Skript does not like. If you add more characters outside of the expression, the warning goes away.

commented

Right, what I mean is that there shouldn't be any cases where you can't just simplify it as the error message states. Just to confirm, does permission message: lang("permission", sender) work for you (i.e. does it execute the function when percent signs are absent?). Thanks!

commented

duplicate of #6934

commented

Right, what I mean is that there shouldn't be any cases where you can't just simplify it as the error message states. Just to confirm, does permission message: lang("permission", sender) work for you (i.e. does it execute the function when percent signs are absent?). Thanks!

Oh, I see. No, permission message: lang("permission", sender) does not call the function.

commented

I'm going to close this just since all the info here is duplicated in 6934 already