skript yaml error

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

berrberr_

Member
Dec 3, 2024
1
0
1
17
1733201420495.png

I'm Korean, so I don't know English very well, but I'm asking because I think you guys know best about skript yaml.

The text of the script has some Korean. But I think it's understandable because everything important is in English. I'm sorry.

# /setstats 명령어: 타수와 안타를 설정하고 타율을 계산하여 저장
command /setstats <player> <number> <number>: # 예시: /setstats Andrew_OwO 10 3
trigger:
# 플레이어 통계 저장
set {player.%arg-1%.at_bats} to arg-2
set {player.%arg-1%.hits} to arg-3
set {player.%arg-1%.batting_avg} to (arg-3 / arg-2)
send "&a%arg-1%'s stats set! 타수: %{arg-2}%, 안타: %{arg-3}%, 타율: %{player.%arg-1%.batting_avg}%"

command /savestats <player>:
trigger:
set {_at_bats} to {player.%arg-1%.at_bats}
set {_hits} to {player.%arg-1%.hits}
set {_batting_avg} to {player.%arg-1%.batting_avg}

# 저장할 경로와 키 확인
set yaml value "players.%arg-1%.at_bats" in "plugins/YamlAPI/player_stats.yml" to {_at_bats}
set yaml value "players.%arg-1%.hits" in "plugins/YamlAPI/player_stats.yml" to {_hits}
set yaml value "players.%arg-1%.batting_avg" in "plugins/YamlAPI/player_stats.yml" to {_batting_avg}

save yaml "plugins/YamlAPI/player_stats.yml"
send "&a%arg-1%'s stats have been saved to player_stats.yml!"


# /loadstats 명령어: player_stats.yml에서 통계 불러오기
command /loadstats <player>:
trigger:
# 플레이어 통계 로드
set {_player} to arg-1

# YAML 파일에서 데이터 로드
set {_at_bats} to yaml value "players.%arg-1%.at_bats" from "plugins/YamlAPI/player_stats.yml"
set {_hits} to yaml value "players.%arg-1%.hits" from "plugins/YamlAPI/player_stats.yml"
set {_batting_avg} to yaml value "players.%arg-1%.batting_avg" from "plugins/YamlAPI/player_stats.yml"

send "&a%arg-1%'s stats loaded: 타수: %{_at_bats}%, 안타: %{_hits}%, 타율: %{_batting_avg}%"
 
You have to load the YAML file before you can use it.

Add this to the top of your script:
code_language.skript:
on load:
    load yaml "plugins/YamlAPI/player_stats.yml" as "plugins/YamlAPI/player_stats.yml"