Skocz do zawartości
  • 0

Minecraft ID


RodgerDodg3r

Pytanie

Witam

 

Mam problem z przeniesieniem ID z pliku .yml. Wszystko działa poprawnie do momętu kiedy chcę wywołać np. 17:2. Skrypt nie czyta żadnego id gdy posiada dwukropek.

 

Config.yml

Drewno Brzozowe_:
  nazwa: Drewno Brzozowe
  item: 17:2
  buy: 300
  sell: 150
  ilosc: 16

 

A to kod

 

set {_item_item} to yaml value "%{_item}%.item" from file "zmienne/sklep/config.yml" 
set {_item_item} to {_item_item} parsed as item #Probowałem tutaj wszystkiego itemtype,material

 

Dziękuje za każdą odpowiedź.

Odnośnik do komentarza
https://skript.pl/temat/27825-minecraft-id/
Udostępnij na innych stronach

5 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

Util Knugiego:
 

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

Wtedy:

{_x} to yaml value "%{_item}%.item" from file "zmienne/sklep/config.yml" 
set {_item} to getItemByText({_x})

A config:

Drewno Brzozowe_:
  nazwa: Drewno Brzozowe
  item: stone named "&6xxxx" with lore "lore||loreeeee2"
  buy: 300
  sell: 150
  ilosc: 16

Powinno pomóc.

Odnośnik do komentarza
https://skript.pl/temat/27825-minecraft-id/#findComment-184356
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ę...