Skocz do zawartości
  • 0

Yml


kubastion
 Udostępnij

Pytanie

Witam, posiadam taki kod:
 

command /t:
	trigger:
		wait 2 ticks
		open chest with 1 rows to the player
		wait 2 ticks
		set {_lista::*} to value list "przedmioty" get of "plugins/Skript/scripts/przed.yml"
		set {_przed} to random element out of {_lista::*}
		wait 1 ticks
		set slot 4 of player's current inventory to {_przed}
		send "%{_przed}%"

Plik yml wygląda tak:
 

przedmioty:
  - 'mob spawner named "&6Spawner" with lore "||Test"'

Jak zrobić, żeby przedmiot wyświetlał się w GUI? Na dodatek prawidłowo?
Na czacie wyświetla się to co jest w "przedmioty" ale nie działają nawet kolory, co oznacza że jest to całkowicie przeniesione z pliku yml. Jak zrobić żeby przeniosło z owego pliku na skrypt i żeby działało prawidłowo?

Spoiler

8144956977b8f.png

 

Edytowane przez knugi
knugi

Wstawiam zdjęcie w bezpośrednio

Notatka dodana przez knugi

Odnośnik do komentarza
Udostępnij na innych stronach

6 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

Kiedyś walczyłem też z czymś takim, musiałem zrobić funkcję. 

Spoiler
function getItemByText(t: text) :: item:
	if "%{_t}%" contains "named":
		set {_item} to subtext of {_t} between index 0 to index of "named" in {_t} - 2
		set {_item} to {_item} parsed as item type
		if {_item} is not item type:
			return air
		if "%{_t}%" contains "with lore":
			set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to index of "with lore" in {_t} - 3
			set {_lore} to subtext of {_t} between index index of "with lore" in {_t} + 11 to length of {_t} - 1
			return ("%{_item}%" parsed as item) named coloured {_name} with lore coloured {_lore}
		else:
			set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to length of {_t} - 1
			return ("%{_item}%" parsed as item) named coloured {_name}
	if "%{_t}%" contains "with lore":
		set {_item} to subtext of {_t} between index 0 to index of "with lore" in {_t} - 2
		set {_lore} to subtext of {_t} between index length of "%{_item}%" + 13 to index length of {_t} - 1
		set {_item} to {_item} parsed as item type
		if {_item} is item type:
			return {_item} with lore coloured {_lore}
		return air
	set {_item} to {_t} parsed as item type
	if {_item} is item type:
		return {_item}
	return air

 

Możesz sobie ją wykorzystać (jest ona z kKits mojego autorstwa).

@xAxee nie musi koniecznie name i lore w osobnym, wystarczy trochę pomyśleć :) 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
9 minut temu, knugi napisał:

Kiedyś walczyłem też z czymś takim, musiałem zrobić funkcję. 

Zarejestruj się lub zaloguj, aby zobaczyć ukrytą treść! Ukryj zawartość

function getItemByText(t: text) :: item:
	if "%{_t}%" contains "named":
		set {_item} to subtext of {_t} between index 0 to index of "named" in {_t} - 2
		set {_item} to {_item} parsed as item type
		if {_item} is not item type:
			return air
		if "%{_t}%" contains "with lore":
			set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to index of "with lore" in {_t} - 3
			set {_lore} to subtext of {_t} between index index of "with lore" in {_t} + 11 to length of {_t} - 1
			return ("%{_item}%" parsed as item) named coloured {_name} with lore coloured {_lore}
		else:
			set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to length of {_t} - 1
			return ("%{_item}%" parsed as item) named coloured {_name}
	if "%{_t}%" contains "with lore":
		set {_item} to subtext of {_t} between index 0 to index of "with lore" in {_t} - 2
		set {_lore} to subtext of {_t} between index length of "%{_item}%" + 13 to index length of {_t} - 1
		set {_item} to {_item} parsed as item type
		if {_item} is item type:
			return {_item} with lore coloured {_lore}
		return air
	set {_item} to {_t} parsed as item type
	if {_item} is item type:
		return {_item}
	return air

 

Możesz sobie ją wykorzystać (jest ona z kKits mojego autorstwa).

@xAxee nie musi koniecznie name i lore w osobnym, wystarczy trochę pomyśleć :) 

Nie musi ale łatwiej chyba xd

I ładniej jak dla mnie xd

Odnośnik do komentarza
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

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