
Name of item from variable
Closed this issue ยท 11 comments
Skript/Server Version
1.21.4
2.12.1
Bug Description
add 1 of clicked slot to {var::*}
loop {var::*}:
send name of loop-value
This code worked fine on sk version 2.11.2, but after I updated to 2.12.1, it stopped working. Sending the loop-value's name returns null, even though it used to work correctly.
Expected Behavior
loop {var::*}:
send name of loop-value
should return name of item for example "Excalibur"
Steps to Reproduce
.
Errors or Screenshots
No response
Other
No response
Agreement
- I have read the guidelines above and affirm I am following them with this report.
I have a similar problem, the items are set just fine in the variable (I gave myself them to make sure), but the name is not showing
Your issue is more likely just due to the items not actually having custom names. Vanilla items that haven't been given names will return <none> for name of
.
No they do have custom names, and interestingly, I tested this code and it worked just fine, so its only when the item is in a variable that it is bugging.
Can you please send a minimal reproducible example? eg. a script that creates the item, puts it in a var, and tries to send the name and fails. I'm not able to replicate.
Yes I was working on that just now, I got a simpler version to reproduce using this command:
command /testtttttttt:
permission: op
trigger:
set {_var::*} to 2 of obsidian
set {_cloth} to itemWithItemModel(phantom membrane named "<##CDCDCD>Cloth" with lore "lorrrrrrreeeee", "expb:cloth")
add 15 of {_cloth} to {_var::*}
loop {_var::*}:
send "%loop-value%" to player
send "%name of loop-value%" to player
###
function itemWithItemModel(i: item, name: string) :: item:
set item model of {_i} to {_name}
return {_i}
###
It might actually be the item model? I noticed it wasnt reproducing without it, but thats just a guess.

The issue is from a weird behavior with simplifying a ConvertedExpression that's converting an ExprLoopValue, I'm working on a fix.
@Ninjamrcool Can you test this build and see if it fixes your issue? (and doesn't cause any others)