-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Issue with parsing string as single type. #5262
Comments
This has always been intended behavior. Skript cannot grab the string value at parse time, only at runtime. This means Skript can't tell if you used single or multiple expression types in your string. So in order to be able to support multiple expression types in the string A solution could be making the parsed as custom text a literal String which we've been experimenting with in other things but this will remove the usage of variables and expressions etc in the text, or set it to a variable and use the soon to be implemented type hints of variables, but that's not something for awhile. Or maybe even seeing if it'll parse in the init method as I think it may work. From documentation:You have to save the expression's value in a list variable, e.g. set {parsed::*} to message parsed as "...". The list variable will contain the parsed values from all %types% in the pattern in order. If a type was plural, e.g. %items%, the variable's value at the respective index will be a list variable, e.g. the values will be stored in {parsed::1::*}, not {parsed::1}. |
If that's the case, just want to comment that running |
I cannot reproduce with a diamond sword named "testExample" |
The pattern of ExprParse is already a literal, so analyzing the pattern to determine whether it will always be single during init is possible and won't break anything. It could also be analyzed to better specify the return type of ExprParse. The ArrayStoreException will be fixed in #5274. |
Skript/Server Version
Bug Description
Setting a variable to
string parsed as "test%string%"
results in the errorvariable can only be set to one object, not more
, while only a singular object is returned.Expected Behavior
No error and the variable being set
Steps to Reproduce
All in the bug description. One way around this is to, instead of setting it to
string parsed as "test%string%"
setting it tosecond element of (string parsed as "%string%est%string%")
but that shouldn't be necessaryYou are also unable to set the variable to
first element of string parsed as "test%string%"
Errors or Screenshots
No response
Other
No response
Agreement
The text was updated successfully, but these errors were encountered: