Skocz do zawartości
  • 0

Czytanie wartości z yml


Pytanie

on load:
	if folder "plugins/MyFood/config" doesn't exists:
		create folder "plugins/MyFood/config"
		if file "plugins/MyFood/config/message.yml" doesn't exists:
			create file "plugins/MyFood/config/message.yml"
		if file "plugins/MyFood/config/options.yml" doesn't exists:
			create file "plugins/MyFood/config/options.yml"
	set {full.health.message} to value "message.food.full" get of "plugins/MyFood/config/message.yml" 		
	set {food.apple.heal} to value "options.food.apple.heal" get of "plugins/MyFood/config/options.yml" 
on consume:
	if health of player is 10:
		cancel event
		send "&c%{full.health.message}%"
	item is apple:
		set {food.apple.heal} to value "options.food.apple.heal" get of "plugins/MyFood/config/options.yml" 
		loop 2 times:
			heal player by {food.apple.heal}
			wait 1 seconds

Witam mam problem bo gdy zjem jabłko to nie leczy mnie o wartość zapisaną w pliku YML

Sprawdzałem za pomocą komendy czy ta wartość jest dobra i jak zmieniłem ją na 1 to wysyłało mi wiadomość że jest to 1 jak na 3 to 3 itd.

Jednak nie ma żadnych błędów w tym skript a i tak mnie nie leczy gdy zjem jabłko

Odnośnik do komentarza
https://skript.pl/temat/9991-czytanie-warto%C5%9Bci-z-yml/
Udostępnij na innych stronach

Rekomendowane odpowiedzi

  • 0
set {_apple.heal} to single value "opcje.apple.ogolne.leczenie" get of "plugins/MyFood/config/opcje.yml"
set {_apple} to "%{_apple.heal}%" parsed as number

pewnie da się skrócić, ale nie będziemy kombinować ;p

Odnośnik do komentarza
https://skript.pl/temat/9991-czytanie-warto%C5%9Bci-z-yml/#findComment-75215
Udostępnij na innych stronach

  • 0

Działa i testowane w 100%

 

on load:
	if folder "plugins/food" doesn't exists:
		create folder "plugins/food"
		if file "plugins/food/config.yml" doesn't exists:
			create file "plugins/food/config.yml"
			set "full.hp" to "'&7Wiad&3omo&asc'" in yaml file "plugins/food/config.yml"
			set "food.apple" to "2" in yaml file "plugins/food/config.yml"
on consume:
	if health of player is 10:
		cancel event
		set {_full.hp} to value "full.hp" get of "plugins/food/config.yml" parsed as text
		send "%colored {_full.hp}%" to player
	item is apple:
		set {_food.apple} to value "food.apple" get of "plugins/food/config.yml" parsed as number
		loop 2 times:
			heal player by {_food.apple} hearts
			wait 1 seconds

 

Odnośnik do komentarza
https://skript.pl/temat/9991-czytanie-warto%C5%9Bci-z-yml/#findComment-75217
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...