set name of player's tool to {_name}が動かない

on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n%{_cartridge}%§r§f"
replace all "&" in {_newName} with "§"
name of player's tool is not {_newName}
send "setAmmoName:%{_newName}%"
set name of player's tool to "%{_newName}%"
on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n%{_cartridge}%§r§f"
replace all "&" in {_newName} with "§"
name of player's tool is not {_newName}
send "setAmmoName:%{_newName}%"
set name of player's tool to "%{_newName}%"
特定のアイテムを持ち換えたときに、 名前にカラコを追加してくれるコードなんですけど なぜかset name of player's tool to {_newName}が動きません 実際に動かすと画像のように{_newName}は生成されています set name of player's tool to "%{_newName}%" のように文字列にしてもダメでした 一方で、文字列+変数の形にしたり 無関係な文字列なら問題なくうごいていました set name of player's tool to "test %{_newName}%" set name of player's tool to "-" 訳が分からないので、どなたか知恵を貸してください
No description
No description
No description
20 Replies
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
name of player's toolがsetできないとか ああ無関係な文字列なら動くのか
月猫ch
月猫chOP13mo ago
name of player's tool is not {_newName}
set {_tool} to player's tool
send "%{_tool}%"
set name of {_tool} to {_newName}
set player's tool to {_tool}
name of player's tool is not {_newName}
set {_tool} to player's tool
send "%{_tool}%"
set name of {_tool} to {_newName}
set player's tool to {_tool}
これもだめでした
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
set name of player's tool to {_newname}だとどうなるの? 色の情報が落ちてるだけな気がして あるいはcolored "%{_newname}%"? でもこれで同じようなことやってんのか
月猫ch
月猫chOP13mo ago
こっちむりした だめでした…
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
set name of player's tool to "a" set name of player's tool to {_newname} だとどうなる?
月猫ch
月猫chOP13mo ago
だめでした… カラコがない状態の文字列が一致したらだめなのかな と思って試したんすけど
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
なんだろ だめっていうのは、アイテム名がaになるだけってこと?
月猫ch
月猫chOP13mo ago
カラコがない{_newName}になりました ※変数の中身になりました
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
set name of player's tool to colored {_newname} は
月猫ch
月猫chOP13mo ago
on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n%{_cartridge}%§r§f"
replace all "&" in {_newName} with "§"
name of player's tool is not {_newName}
set {_tool} to player's tool
set name of player's tool to "&3e"
set name of player's tool to colored {_newName}
on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n%{_cartridge}%§r§f"
replace all "&" in {_newName} with "§"
name of player's tool is not {_newName}
set {_tool} to player's tool
set name of player's tool to "&3e"
set name of player's tool to colored {_newName}
いまこんなかんじっす…
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
set {_empty} to "" set name of player's tool to "%{_empty}%%{_newName}%" 変数+変数の場合どうなるのかなって
月猫ch
月猫chOP13mo ago
ダメっぽいですね。。。カラコのない見た目になります ""を"-"にしたら動きました ??? "-"を付けた状態で名前を変えて "-"を""に置き換えたらいけるんじゃね? と思ってこうしましたが
on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n-%{_cartridge}%§r§f"
name of player's tool is not {_newName}
set name of player's tool to {_newName}
replace all "&" in name of player's tool with "§"
replace all "§§" in name of player's tool with "&"
#replace first "-" in name of player's tool with ""
on tool change:
wait 1 tick
if player is op:
stop if player is not sneaking
type of player's tool is dye
getAmmoID(player's tool) is set
set {_newName} to uncolored getAmmoID(player's tool)
set {_cartridge} to getAmmoCartridge(player's tool)
replace all {_cartridge} in {_newName} with "§e§l§n-%{_cartridge}%§r§f"
name of player's tool is not {_newName}
set name of player's tool to {_newName}
replace all "&" in name of player's tool with "§"
replace all "§§" in name of player's tool with "&"
#replace first "-" in name of player's tool with ""
結果からこが喪失しました
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
command /test:
trigger:
give stone named "ab" to player

on tool change:
wait for 1 tick
set {_n} to uncolored "ab"
set {_c} to "b"
replace all {_c} in {_n} with "§e§l§n%{_c}%§r§f"
replace all "&" in {_n} with "§"
set name of player's tool to {_n}
command /test:
trigger:
give stone named "ab" to player

on tool change:
wait for 1 tick
set {_n} to uncolored "ab"
set {_c} to "b"
replace all {_c} in {_n} with "§e§l§n%{_c}%§r§f"
replace all "&" in {_n} with "§"
set name of player's tool to {_n}
これが動かないってことだよね
月猫ch
月猫chOP13mo ago
command item.rename <string>:
permission: op
trigger:
set name of player's tool to "&r%arg%"
replace all "&" in name of player's tool with "§"
replace all "§§" in name of player's tool with "&"
command item.rename <string>:
permission: op
trigger:
set name of player's tool to "&r%arg%"
replace all "&" in name of player's tool with "§"
replace all "§§" in name of player's tool with "&"
ちなみにこれは動きます あ・・・・ あ・・・・・・・・・・・・ あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"あ"
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
解決した? まだわかってない
月猫ch
月猫chOP13mo ago
自★決
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
§って必要なの?
月猫ch
月猫chOP13mo ago
えー…恥を忍んで申し上げますと 先ほどまで苦戦していた⇧の関数のすぐ下に
# 弾の自動修正
on tool change:
wait 1 tick
if player is op:
player is not sneaking
stop
type of player's tool is dye
set {_ammo} to getAmmoItem(uncoloured name of player's tool)
1 of player's tool is not 1 of {_ammo}
set player's tool to item amount of player's tool of {_ammo}
# 弾の自動修正
on tool change:
wait 1 tick
if player is op:
player is not sneaking
stop
type of player's tool is dye
set {_ammo} to getAmmoItem(uncoloured name of player's tool)
1 of player's tool is not 1 of {_ammo}
set player's tool to item amount of player's tool of {_ammo}
このようなコードがありまして… すごく端的に言うと 『データベースに入ってるアイテムと違うところがあったら勝手に修正してくれるコード』なんですけど…
unnnnnnnnnnn
unnnnnnnnnnn13mo ago
草 わかるわけねえw
月猫ch
月猫chOP13mo ago
わかるはずもなく えー…恥をさらして時間を奪っただけという… まさに自決ものでございます
Want results from more Discord servers?
Add your server