[クソ長コード]コードの軽量化

ymlを読み込み、内容を変数に保存していくコードなのですが 如何せん処理に時間がかかっていて… これを軽量化する方法はないでしょうか
14 Replies
Tsukineko(月雲)
やってることとしては ①ymlファイルをloop ②keyのリストをもとに、該当する内容が書いてあるか確認 ③書いてあれば、諸々の要素を変数に代入 なお loop files in dir "plugins/CrackShot/weapons"➡50loop loop {key::Gun::*} and {key::Ammo::*}:➡250loop くらいです… これはもうどうしようもない処理の遅さなのでしょうか…
Tsukineko(月雲)
sk info
No description
何か
何か6mo ago
async:
Tsukineko(月雲)
asyncあるんですか!?!?!?!? MundoSKのasync set A to Bを使うってことでしょうか
何か
何か6mo ago
普通にasync:で sectionの中に突っ込めば 非同期になる
Tsukineko(月雲)
loop {key::Gun::*} and {key::Ammo::*}:
async:
処理~
loop {key::Gun::*} and {key::Ammo::*}:
async:
処理~
こういうことすか エラーは吐かなかったけどYMLの中身が読み込まれなかったです…
何か
何か6mo ago
asyncはローカル変数を保持しない 全く別のセクションとして考える必要がある
Tsukineko(月雲)
えぇ
yukkina
yukkina6mo ago
これほんま嫌い
unnnnnnnnnnn
unnnnnnnnnnn6mo ago
skreflectのasyncで引数渡せなかったっけ
unnnnnnnnnnn
unnnnnnnnnnn6mo ago
Skript Hub - Documentation
CondSection (Condition) - skript-reflect
For more information on skript-reflect, you can visit the wiki here: https://tpgamesnl.gitbook.io/skript-reflect/
unnnnnnnnnnn
unnnnnnnnnnn6mo ago
Skript Hub - Documentation
EffRunSection (Effect) - skript-reflect
For more information on skript-reflect, you can visit the wiki here: https://tpgamesnl.gitbook.io/skript-reflect/
のしぇあ
のしぇあ6mo ago
試してないのでわからないですが、最終リロード日時とymlファイルの最終更新日時を比較して読み込むべきファイルを選べば、ある程度処理回数を減らせるかもしれないです https://skripthub.net/docs/?id=166
Skript Hub - Documentation
File Last Modified, Last Accessed, Creation Date (Expression) - skU...
Returns when the file was last changed (modified), last accessed, and created
Tsukineko(月雲)
それと似たようなことできないかなと思って
loop files in dir "plugins/CrackShot/weapons":
wait 1 tick
set {_name} to name of file loop-value
{_name} doesn't start with "__"
{_name} starts with "_gun" or "_ammo"
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_line::*} to file contents of {_path}
set {_checkFlag} to false
if {csFile::%{_name}%::*} is not {_line::*}:
set {csFile::%{_name}%::*} to {_line::*}
broadcast "check! -> %{_name}%
set {_checkFlag} to true"
loop files in dir "plugins/CrackShot/weapons":
wait 1 tick
set {_name} to name of file loop-value
{_name} doesn't start with "__"
{_name} starts with "_gun" or "_ammo"
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_line::*} to file contents of {_path}
set {_checkFlag} to false
if {csFile::%{_name}%::*} is not {_line::*}:
set {csFile::%{_name}%::*} to {_line::*}
broadcast "check! -> %{_name}%
set {_checkFlag} to true"
file contentsを比較して 最後のreloadから内容が変わっていればそのファイルの内容を再読み込みする という風にしようとしたのですが 更新されていない、中身が一致しているはずのファイルも読み込みされてしまいます… これって仕様なのでしょうか… おとなしく更新日時比較にしました!!
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_when} to file {_path}'s last modified value
set {_line::*} to file contents of {_path}
set {_checkFlag} to false
broadcast "check! -> &e%{_name}% &7(%{_chekingAmount}% / %{_fileAmount}%)"
if {csFileTime::%{_name}%} is not {_when}:
broadcast "check! -> %{_name}%(%{_when}%)"
set {csFileTime::%{_name}%} to {_when}
set {_checkFlag} to true
set {_path} to "plugins/CrackShot/weapons/%{_name}%.yml"
set {_when} to file {_path}'s last modified value
set {_line::*} to file contents of {_path}
set {_checkFlag} to false
broadcast "check! -> &e%{_name}% &7(%{_chekingAmount}% / %{_fileAmount}%)"
if {csFileTime::%{_name}%} is not {_when}:
broadcast "check! -> %{_name}%(%{_when}%)"
set {csFileTime::%{_name}%} to {_when}
set {_checkFlag} to true
Want results from more Discord servers?
Add your server
More Posts
itemに個別のkeyとvalueを設定してあげたいentityなら `set metadata "test" of entity to 10` とかできるじゃないですか アイテムでも似たようなことがやりたいです ```applescript set ダイヤモンドを右クリックした後の15秒間、敵にダメージを与えると継続ダメージを与える``` on rightclick holding diamond: set {centhe2.skill.%player%} to 1 set {centhe2.click.%plapushがくそ```applescript on right click: player is op player's tool is getOPItem() push player forplayerが特定の進捗を達成しているかできますかね...? 環境 bungeecord 1.20 接続先 paper 1.20.1 skript 2.7.3 アドオン zulfungee last shot entity がバグってる``` on leftclick holding bow: set {_x} to x-coordinate of player set {_y} to y-coordinate of plaat 00:00 が動かない```applescript at 10:00 in "w-lobby-new": broadcast "test"``` /time set ~ した時に、上記コードが動かなくなります これbungeecordsw使えるチャット連携skriptを作ってほしい環境 bungeecord 1.20 接続先 paper 1.20.1 skript 2.7.3 アドオン zulfungee skungee mythicmobsで作ったモブをskriptで召喚したい。スポーンさせてlast spawned entityで指定したいです。 環境:1.19.4動物をプレイヤーに敵対させたい。豚のAIをゾンビにするみたいなことをしたいです。SkriptでX-Ray対策こんばんは。今日はX-Ray対策スクリプトについて質問しようと思います。 私はバトルロイヤルサバイバルサーバーを運営しているのですが、X-Rayの疑いがある人が出てきてしまいました。 そこで、X-Ra