プレイヤーのインベ内のアイテムの量が出ない

command /shop1-register [<integer>] [<integer>]:
aliases: /sr
permission: admin
trigger:
if arg-1 is not set:
send "&c/sr <id> <price>"
else:
if arg-2 is not set:
send "&c/sr <id> <price>"
else:
set {shop1::item::%arg-1%} to type of player's tool
set {shop1::price::%arg-1%} to arg-2
send "%{shop1::item::%arg-1%}% %{shop1::price::%arg-1%}%円"

command /shop [<text>]:
trigger:
if arg-1 is "1":
open chest inventory with 6 row named "資源販売" to player
set {_a} to 10
set {_i} to 0
loop 54 times:
set slot loop-number -1 of player's current inventory to black stained glass pane named ""
loop 4 times:
loop 7 times:
add 1 to {_i}
set slot {_a} of player's current inventory to {shop1::item::%{_i}%} with lore "&7<<< クリック >>>", "&e左: 1個売る" and "&6右: 全て売る"
if {shop1::item::%{_i}%} is not set:
set slot {_a} of player's current inventory to air
add 1 to {_a}
add 2 to {_a}


on inventory click:
cancel event
if name of clicked inventory is "資源販売":
clicked item is not black stained glass pane
set {_i} to clicked slot -9
send "%{shop1::item::%{_i}%}% %{shop1::price::%{_i}%}%円 ID%{_i}% %amount of type of clicked item in player's inventory%個持っている"
command /shop1-register [<integer>] [<integer>]:
aliases: /sr
permission: admin
trigger:
if arg-1 is not set:
send "&c/sr <id> <price>"
else:
if arg-2 is not set:
send "&c/sr <id> <price>"
else:
set {shop1::item::%arg-1%} to type of player's tool
set {shop1::price::%arg-1%} to arg-2
send "%{shop1::item::%arg-1%}% %{shop1::price::%arg-1%}%円"

command /shop [<text>]:
trigger:
if arg-1 is "1":
open chest inventory with 6 row named "資源販売" to player
set {_a} to 10
set {_i} to 0
loop 54 times:
set slot loop-number -1 of player's current inventory to black stained glass pane named ""
loop 4 times:
loop 7 times:
add 1 to {_i}
set slot {_a} of player's current inventory to {shop1::item::%{_i}%} with lore "&7<<< クリック >>>", "&e左: 1個売る" and "&6右: 全て売る"
if {shop1::item::%{_i}%} is not set:
set slot {_a} of player's current inventory to air
add 1 to {_a}
add 2 to {_a}


on inventory click:
cancel event
if name of clicked inventory is "資源販売":
clicked item is not black stained glass pane
set {_i} to clicked slot -9
send "%{shop1::item::%{_i}%}% %{shop1::price::%{_i}%}%円 ID%{_i}% %amount of type of clicked item in player's inventory%個持っている"
/shop1-register でアイテムのtypeと値段を決め、それをGUIに変数を使って表示しました。 いわゆるGUI SHOPを作っています。 on inventory click: の時に、GUIでクリックしたアイテムを、プレイヤーが何個持っているかを調べようとして、 send "... %amount of type of clicked item in player's inventory" と clicked itemの代わりに %amount of {shop1::item::%{_i}%} in player's inventory% も試したのですが、 どちらも0個とかえってきました。原因が全く見当つかないので質問しました。
11 Replies
tanoKun
tanoKun2y ago
{shop1::item::%{_i}%} が ItemStackじゃなくて Material だからだと思います
soramame_256
soramame_2562y ago
type ofでとっちゃってるから型が変わってる感じ?
gladiolus8789
gladiolus87892y ago
set {_item} to ... parsed as item type みたいにすればいいってこと ? そこらの知識があんまない
tanoKun
tanoKun2y ago
普通に名前ついてないなら元々type ofしなくていいと思うけど
gladiolus8789
gladiolus87892y ago
言われてみればそうだわ あとで試す
tanoKun
tanoKun2y ago
もしくは while name なんたらみたいなの なかったっけ
gladiolus8789
gladiolus87892y ago
/shop1-register のset {shop1::item::%arg-1%} to type of player's toolやめて player's tool にしても 変わらなかった %amount of diamond in player's inventory% みたいにしたらちゃんと動くから {shop1::item::%{_i}%} が その diamond と同じ様な型?になってないのが原因なんだろうけど 同じ型にする方法がわからん diamondが何の型かもよく分からんち~
tanoKun
tanoKun2y ago
diamond ha item がたに変換されてるかrあ
gladiolus8789
gladiolus87892y ago
無理矢理 split使って文字から数字抜きだしてっていうのをやって解決しました。
tanoKun
tanoKun2y ago
それするんだったら 普通に loop inventory で amount of すればいいと思うが
gladiolus8789
gladiolus87892y ago
さすがに今更それ言われても変えるのめんどくさいので...😅 しかも確かそれ試して出来てなかったはずだしね 動けばなんでもよし!笑
Want results from more Discord servers?
Add your server
More Posts
set rndom element ofがうまく動かないentryリストの中からひとつ取り出してboss変数に入れたいのですが、 ``` set random element of {entry::*} to {_boss} send "ボスは%{_bos追加/削除を交互化するエントリーするプラグインとして、これを書きました ``` command /entry: trigger: add "A" to {entry::*} loop変数内のテキストを編集したいテキストの編集について質問です。 変数に以下のように複数行のテキストが入っているとき、 `set {var} to "A" and "B"` または `set {var} to "A%nl%B"` r盾でガードに成功したことを検知したいMinecraft Java -ver 1.19.3 skript -ver 2.6.4 [やりたいこと] 盾でガードに成功したことを検知する方法を知りたい。 final damageを0にして検知アイテムにコマンドを付けるskアイテムにコマンドを付けるsk(https://pastebin.com/XLuBahgX )を作っているのですが、これだとこういうことが起きます ・wait {wait} secondsが動かない TCTプラグインでゲーム開始前に弓を撃てるようにしたいhttps://gyazo.com/ea0e7e6fe12f566bc68c46d0a7ffea0f ⇧GIF PRでTCTプラグインを使っています。 ゲーム開始待機中、プラグインの仕様で弓や雪玉がリスト変数の中に~が含まれているかを調べたい良さそうな方法ありますか...?リードの結び目をクリックしたときのイベント名が知りたい・リードを繋いだ結び目を保護(リードを破壊するイベントをキャンセル)するスクリプトを書きたいです ・フェンスに結び付けられたリードの結び目をクリックして壊そうとしたときのイベント名または判定式が知りたモブをスクリプトで実装Skriptでモブを作ろうと思います。 が、モブの攻撃対象を 固定/切り替え することは出来ますか? Mm性のモブだと誰を狙うかが半ばランダム状態になっていて、ゲームにおける戦略性が絶望的です。if player has ~ of ~を含めた時だけリロードが終わらないon rightclick on sign: if player has 96 of coal: remove 96 coal from player give