アイテムのnbtから数値を取って書き込んだら<none>になる

set {_material} to nbt compound of player's tool
set {_value} to tag "value" of {_material}
set {_value} to {_value} parsed as number
set {_material} to nbt compound of player's tool
set {_value} to tag "value" of {_material}
set {_value} to {_value} parsed as number
これだと {_value} が <none> になります
8 Replies
tanoKun
tanoKun13mo ago
Valueに値入ってるの?
るび
るびOP13mo ago
入ってます {"value":15} のように 多分よくないんだろうけど、
set {_value} to {_value}+1-1
set {_value} to {_value}+1-1
ってやったらいけました
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
なんだそれ おれも昨日nbtで困ってたんですけど
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
Skript Hub - Documentation
NBT - Tag (Expression) - SkBee
Get/set/delete the value of the specified tag of an NBT compound. Also supports getting nested tags using a semi colon as a delimiter. If the return value is a list, you can use it as a list, as it will automatically split it for ya. NOTE: uuid tag will set an int array tag (This is how MC stores uuids). On return it'll convert back to a uuid...
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
高バージョンだと型指定して取り出せるっぽいので int tag of とかに変えるといいのかもしれません 悲しいことにPRのskBeeは低バージョンすぎて使えない
るび
るびOP13mo ago
なるほど!あとで試してみます。ありがとうございます
set {_tool} to nbt compound of player's tool
set {_value} to int tag "value" of {_tool}
# ここでは 1 。
set tag "value" of {_tool} to {_value}
# ここでデータ入れると "1" になる
set {_tool} to nbt compound of player's tool
set {_value} to int tag "value" of {_tool}
# ここでは 1 。
set tag "value" of {_tool} to {_value}
# ここでデータ入れると "1" になる
って感じです...
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
setのほうもint tagにしましょう たとえば
add 1 to int tag "custom;points" of nbt of player
add 1 to int tag "foodLevel" of nbt of player
remove 10 from short tag "HurtTime" of nbt of target entity
remove 10 from int tag "Age" of nbt of last spawned entity

add "blah" to string list tag "names" of {_nbt}
add 10,12,14 to int list tag "numbers" of {_nbt}
add nbt from "{points:10}" to compound list tag "stuff" of {_nbt}
add 1 to int tag "custom;points" of nbt of player
add 1 to int tag "foodLevel" of nbt of player
remove 10 from short tag "HurtTime" of nbt of target entity
remove 10 from int tag "Age" of nbt of last spawned entity

add "blah" to string list tag "names" of {_nbt}
add 10,12,14 to int list tag "numbers" of {_nbt}
add nbt from "{points:10}" to compound list tag "stuff" of {_nbt}
こんなことが出来る(らしい) skript hubのexampleから拾ってきたので動くのかは知りません けど試す価値があると思います
るび
るびOP13mo ago
了解です、試してみます できました!!ありがとうございます!!
Want results from more Discord servers?
Add your server