ymlファイルの画像部分のリストの取得方法

がぞうのFN_5728みたいな、一番最初のkeyのリストが欲しいです
test1:
o: 1
test2:
o: 1
test3:
o: 1
test1:
o: 1
test2:
o: 1
test3:
o: 1
例えば上記YMLなら、test1 test2 test3をlistとして取得したいのですが 何か専用の関数とかありますかね ちなみに今は
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_lineCount} to line count of file {_path}

if {_lineCount} > 0:
loop {_lineCount} times:
set {_line} to line loop-number in file {_path}
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_lineCount} to line count of file {_path}

if {_lineCount} > 0:
loop {_lineCount} times:
set {_line} to line loop-number in file {_path}
こんな感じで行を取得して 一行ずつ "#" " "から始まっていないかをチェックし それをkeyとして扱っています
No description
10 Replies
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
ちなSkript-yamlを使う選択肢はないんか
月猫ch
月猫chOP17mo ago
skript-yamlならいけます?
月猫ch
月猫chOP17mo ago
https://skripthub.net/docs/?id=1528 set {_list::*} to all yaml nodes of "config"
Skript Hub - Documentation
All YAML Nodes (Expression) - skript-yaml
Gets a list of all nodes of a cached YAML file.
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
Skript Hub - Documentation
YAML (Expression) - skript-yaml
Gets, sets, removes values/nodes etc.. of a cached yaml file - Requires the id used/created from the load effect - This expression does not save to file - Lists accept list variables for input - Using 'without string checks' optional is a tiny bit faster but doesn't check/convert strings for numbers or booleans
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
知らんけどこういうの使えるんじゃね
月猫ch
月猫chOP17mo ago
これ test1::0 の数値は取れるんすけど test1 test2 test3みたいなkey一覧は取れんす
月猫ch
月猫chOP17mo ago
画像みたいに
tintin:
po:
nya: 0
tintin:
po:
nya: 0
コンソールで改行されて表示されるような文字列は どうやったら行別に分解できます?
No description
何か
何か17mo ago
月猫ch
月猫chOP17mo ago
見せてもらった関数を一時期使ってたんですが いろいろいCS側のファイルじってる間になぜか動かなくなってしまって… それ以降画像の方法でまた脳筋処理してるんです…
No description
何か
何か17mo ago
それってevaluateで設定できない値が入ったからじゃないの あれは完全にskript向けのやつだから データ形式を自分で作りたいならすべてを文字列として扱って parserを定義するしかないよ

Did you find this page helpful?