本の編集をskでやりたい

skで本の編集ができるPLとかありませんか
No description
17 Replies
KabiPan
KabiPan10mo ago
アドオンは分からんが マイクラの本のデーターって恐らくNBT管理されてるから それを上書きすれば編集はできるはず
KabiPan
KabiPan10mo ago
No description
KabiPan
KabiPan10mo ago
一番下のやつ
Laminas
Laminas10mo ago
めっちゃ前にフリー配布所に上げてる人いなかったっけ そこから読み解けばいけそう
Yeahn
Yeahn10mo ago
SkBee のGitHub wikiに本の場合の使い方載っていた気がします それかあまりに鯖が古いならSkellettの方のtext component を使うのもあり
KabiPan
KabiPan10mo ago
Skript Hub - Documentation
Book Pages (Expression) - SkBee
Allows you to set pages in a book to text components. You can also retrieve the pages. Based on testing, a book's author/title needs to be set AFTER setting the pages, why? I have no idea!
KabiPan
KabiPan10mo ago
アッタ あでも skript自体にも機能あって2.2以降取得と編集できるね
KabiPan
KabiPan10mo ago
Skript Hub - Documentation
Book Pages (Expression) - Skript
The pages of a book (Supports Skript's chat format) Note: In order to modify the pages of a new written book, you must have the title and author of the book set. Skript will do this for you, but if you want your own, please set those values.
KabiPan
KabiPan10mo ago
%pages of event-item%で全ページ取得 %page [数字] of event-item%で指定したページ取得 あと文字の編集で改行したいとき 例えば "panpan" and "kabikabi"みたいにand使うことが出来ない \n使っても出来ない だからやりたいときは"panpan %newline% kabikabi"ってやるとできる
月猫ch
月猫chOP10mo ago
%newline%はそのまますか
KabiPan
KabiPan10mo ago
月猫ch
月猫chOP10mo ago
%nl%の代わりに %newline%ってことすか
KabiPan
KabiPan10mo ago
あー nlでもいいはず
月猫ch
月猫chOP10mo ago
なる
何か
何か10mo ago
command /test:
trigger:
set {_t} to parse_book_text("test <tooltip:hello\>>&ab&cb&rc<akbbb:man,egg:test>ah\\no")
broadcast "%{_t}%"
add "{pages:[""%{_t}%""]}" to nbt of player's tool

function parse_book_text(str: string) :: string:
set {_str} to "%{_str}%<>"

while length of {_str} > 0:
set {_i::*} to parse_block({_str}, "<")
if {_i::1} is not -1:
set {_t} to size of {_items::*} + 1
set {_items::%{_t}%} to substr({_str}, 1, {_i::1} - 1)
loop {_attrs::*}:
set {_t2} to index of ":" in loop-value
set {_name} to substr(loop-value, 0, {_t2} - 1)
set {_value} to substr(loop-value, {_t2} + 1)
set {_items::%{_t}%::attrs::%{_name}%} to {_value}
set {_str} to substr({_str}, {_i::1})

set {_i::*} to parse_block({_str}, ">")
if {_i::1} is not -1:
set {_t} to slice({_i::2}, 2, -1)
delete {_attrs::*}
while length of {_t} > 0:
set {_i2::*} to parse_block({_t}, ",")
add {_i2::2} to {_attrs::*}
if {_i2::1} is -1:
stop loop
set {_t} to substr({_t}, {_i2::1} + 1)

set {_str} to substr({_str}, {_i::1} + 1)

else:
stop loop

loop {_items::*}:
delete {_nbt::*}
add "\""text\"":\""%loop-value%\""" to {_nbt::*}
loop {_items::%loop-index%::attrs::*}:
if loop-index-2 is "tooltip":
add "\""hoverEvent\"":{\""action\"":\""show_text\"",\""value\"":\""%loop-value-2%\""}" to {_nbt::*}

set {_data} to join {_nbt::*} with ","
add "{%{_data}%}" to {_components::*}

set {_data} to join {_components::*} with ","
return "[%{_data}%]"

function slice(str: string, start: number, end: number) :: string:
if {_start} < 0:
add length of {_str} + 1 to {_start}
if {_end} < 0:
add length of {_str} + 1 to {_end}
return substr({_str}, {_start}, {_end})
command /test:
trigger:
set {_t} to parse_book_text("test <tooltip:hello\>>&ab&cb&rc<akbbb:man,egg:test>ah\\no")
broadcast "%{_t}%"
add "{pages:[""%{_t}%""]}" to nbt of player's tool

function parse_book_text(str: string) :: string:
set {_str} to "%{_str}%<>"

while length of {_str} > 0:
set {_i::*} to parse_block({_str}, "<")
if {_i::1} is not -1:
set {_t} to size of {_items::*} + 1
set {_items::%{_t}%} to substr({_str}, 1, {_i::1} - 1)
loop {_attrs::*}:
set {_t2} to index of ":" in loop-value
set {_name} to substr(loop-value, 0, {_t2} - 1)
set {_value} to substr(loop-value, {_t2} + 1)
set {_items::%{_t}%::attrs::%{_name}%} to {_value}
set {_str} to substr({_str}, {_i::1})

set {_i::*} to parse_block({_str}, ">")
if {_i::1} is not -1:
set {_t} to slice({_i::2}, 2, -1)
delete {_attrs::*}
while length of {_t} > 0:
set {_i2::*} to parse_block({_t}, ",")
add {_i2::2} to {_attrs::*}
if {_i2::1} is -1:
stop loop
set {_t} to substr({_t}, {_i2::1} + 1)

set {_str} to substr({_str}, {_i::1} + 1)

else:
stop loop

loop {_items::*}:
delete {_nbt::*}
add "\""text\"":\""%loop-value%\""" to {_nbt::*}
loop {_items::%loop-index%::attrs::*}:
if loop-index-2 is "tooltip":
add "\""hoverEvent\"":{\""action\"":\""show_text\"",\""value\"":\""%loop-value-2%\""}" to {_nbt::*}

set {_data} to join {_nbt::*} with ","
add "{%{_data}%}" to {_components::*}

set {_data} to join {_components::*} with ","
return "[%{_data}%]"

function slice(str: string, start: number, end: number) :: string:
if {_start} < 0:
add length of {_str} + 1 to {_start}
if {_end} < 0:
add length of {_str} + 1 to {_end}
return substr({_str}, {_start}, {_end})
function substr(str: string, start: number, end: number=-1) :: string:
if {_end} is -1:
set {_end} to length of {_str}

if {_start} > length of {_str}:
return ""

return substring of {_str} from {_start} to {_end}

function parse_block(str: string, end: strings) :: objects:
set {_spl::*} to {_str} split at ""
set {_r} to -1
set {_text} to ""
set {_idx} to 1

while {_idx} < size of {_spl::*}:
set {_c} to {_spl::%{_idx}%}

set {_next} to {_idx} + 1
set {_next} to {_spl::%{_next}%}

if {_c} is "\":
add 1 to {_idx}
else if {_end::*} contains {_c}:
set {_r} to {_idx}
stop loop

set {_text} to "%{_text}%%{_spl::%{_idx}%}%"

add 1 to {_idx}

set {_r::1} to {_r}
set {_r::2} to {_text}
return {_r::*}
function substr(str: string, start: number, end: number=-1) :: string:
if {_end} is -1:
set {_end} to length of {_str}

if {_start} > length of {_str}:
return ""

return substring of {_str} from {_start} to {_end}

function parse_block(str: string, end: strings) :: objects:
set {_spl::*} to {_str} split at ""
set {_r} to -1
set {_text} to ""
set {_idx} to 1

while {_idx} < size of {_spl::*}:
set {_c} to {_spl::%{_idx}%}

set {_next} to {_idx} + 1
set {_next} to {_spl::%{_next}%}

if {_c} is "\":
add 1 to {_idx}
else if {_end::*} contains {_c}:
set {_r} to {_idx}
stop loop

set {_text} to "%{_text}%%{_spl::%{_idx}%}%"

add 1 to {_idx}

set {_r::1} to {_r}
set {_r::2} to {_text}
return {_r::*}
何か
何か10mo ago
No description
何か
何か10mo ago
command /test:
trigger:
set {_l::1} to "name"
set {_l::2} to " %player%"
set {_l::3} to "uuid"
set {_l::4} to " %uuid of player%"
set {_l::5} to "item"
set {_l::6} to " %player's tool%"
set {_l::7} to "location"
set {_l::8} to " %floor(x-pos of location of player)%"
set {_l::9} to " %floor(y-pos of location of player)%"
set {_l::10} to " %floor(z-pos of location of player)%"
set {_t} to parse_book_text(join {_l::*} with "\\n")
add "{pages:[""%{_t}%""]}" to nbt of player's tool
command /test:
trigger:
set {_l::1} to "name"
set {_l::2} to " %player%"
set {_l::3} to "uuid"
set {_l::4} to " %uuid of player%"
set {_l::5} to "item"
set {_l::6} to " %player's tool%"
set {_l::7} to "location"
set {_l::8} to " %floor(x-pos of location of player)%"
set {_l::9} to " %floor(y-pos of location of player)%"
set {_l::10} to " %floor(z-pos of location of player)%"
set {_t} to parse_book_text(join {_l::*} with "\\n")
add "{pages:[""%{_t}%""]}" to nbt of player's tool
こういう使い方ができてコードがきれいにまとめられる attributeは自分で追加
Want results from more Discord servers?
Add your server