Skocz do zawartości
  • 0

YAML - problem.


KrejzolekPRO
 Udostępnij

Pytanie

Witam mam kod:

Spoiler

function openGui(p: player):
	set {_x::*} to configuration section "crafting" get of "plugins/kCraft/config.yml"
	loop (size of {_x::*}) times:
		loop {_x::*}:
			set {_item} to single value "crafting.%loop-value-2%.item" get of "plugins/kCraft/config.yml" parsed as item
			set {_name} to coloured single value "crafting.%loop-value-2%.nazwa" get of "plugins/kCraft/config.yml" parsed as text
			set {_name2} to single value "crafting.%loop-value-2%" get of "plugins/kCraft/config.yml" parsed as text
			set {_lore} to coloured single value "crafting.%loop-value-2%.lore" get of "plugins/kCraft/config.yml" parsed as text
			format slot 1 of {_p} with 1 of {_item} named "%{_name}%" with lore "%{_lore}%" to close then run [execute {_p} command "crafting show %{_name2}%"]

function showGui(p: player, t: text):
	set {_wiad} to coloured single value "crafting.%{_t}%.guiname" get of "plugins/kCraft/config.yml"
	set {_name} to coloured single value "crafting.%{_t}%.nazwa" get of "plugins/kCraft/config.yml" parsed as text
	replace all "{NAME}" with "%{_name}%" in {_wiad}
	open chest with 3 rows named "{_wiad}" to {_p}
	wait a tick
	loop 9 times:
		set {_slot%loop-number%} to single value "crafting.%{_t}%.slot%loop-number%" get of "plugins/kCraft/config.yml" parsed as item
		set {_ilosc%loop-number%} to single value "crafting.%{_t}%.slot%loop-number%.ilosc" get of "plugins/kCraft/config.yml" parsed as number
	format slot 1 of {_p} with {_ilosc1} of {_slot1} to close
	format slot 2 of {_p} with {_ilosc2} of {_slot2} to close
	format slot 3 of {_p} with {_ilosc3} of {_slot3} to close
	format slot 4 of {_p} with {_ilosc4} of {_slot4} to close
	format slot 5 of {_p} with {_ilosc5} of {_slot5} to close
	format slot 6 of {_p} with {_ilosc6} of {_slot6} to close
	format slot 7 of {_p} with {_ilosc7} of {_slot7} to close
	format slot 8 of {_p} with {_ilosc8} of {_slot8} to close
	format slot 9 of {_p} with {_ilosc9} of {_slot9} to close


on load:
	if file "plugins/kCraft/config.yml" doesn't exists:
		create file "plugins/kCraft/config.yml"
		send "&aPlik konfiguracyjny zostal zaladowany." to console

command /crafting [<text>] [<text>]:
	trigger:
		if arg 1 is not set:
			set {_x::*} to configuration section "crafting" get of "plugins/kCraft/config.yml"
			if (size of {_x::*}) <= 0:
				set {_wiad} to coloured single value "message.brakcraftingow" get of "plugins/kCraft/config.yml" parsed as text
				send "%{_wiad}%"
			else:
				set {_wiad} to coloured single value "message.guicrafting" get of "plugins/kCraft/config.yml"
				open chest with 3 rows named "%{_wiad}%" to player
				wait a tick
				openGui(player)
		if arg 1 is "show":
			showGui(player, arg 2)
			
	

 

i config:

Spoiler

message:
  brakcraftingow: '&cAktualnie nie ma zadnego dodatkowego craftingu.'
  guicrafting: '&eMenu z craftingami:'
  
crafting:
  numer1:
    item: 'chest'
    nazwa: '&5Enderchest'
    lore: '&eKliknij, aby||&eprzejsc dalej...'
    guiname: '&5Crafting: Enderchestu'
    slot1: 'stone'
      ilosc: 5
    slot2: 'stone'
      ilosc: 5
    slot3: 'stone'
      ilosc: 5
    slot4: 'stone'
      ilosc: 5
    slot5: 'stone'
      ilosc: 5
    slot6: 'stone'
      ilosc: 5
    slot7: 'stone'
      ilosc: 5
    slot8: 'stone'
      ilosc: 5
    slot9: 'stone'
      ilosc: 5

 

Chodzi o to, że po wpisaniu /crafting, wyrzuca <none> i "pierdyliard" błędów w konsoli, że nie może załadować pliku config.yml.

Kod wydaję się być dobry, i sam nie wiem czy to wina WildSkript'u, czy skQuery, czy moja.

Edytowane przez KrejzolekPRO
Odnośnik do komentarza
Udostępnij na innych stronach

4 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

Zamiast ' musisz dać "

 

message:
  brakcraftingow: "&cAktualnie nie ma zadnego dodatkowego craftingu."
  guicrafting: "&eMenu z craftingami:"
  
crafting:
  numer1:
    item: "chest"
    nazwa: "&5Enderchest"
    lore: "&eKliknij, aby||&eprzejsc dalej..."
    guiname: "&5Crafting: Enderchestu"
    slot1: "stone"
      ilosc: 5
    slot2: "stone"
      ilosc: 5
    slot3: "stone"
      ilosc: 5
    slot4: "stone"
      ilosc: 5
    slot5: "stone"
      ilosc: 5
    slot6: "stone"
      ilosc: 5
    slot7: "stone"
      ilosc: 5
    slot8: "stone"
      ilosc: 5
    slot9: "stone"
      ilosc: 5

Łączę //Michma1707 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
2 minuty temu, Piotrek5565 napisał:

message:
  brakcraftingow: "&cAktualnie nie ma zadnego dodatkowego craftingu."
  guicrafting: "&eMenu z craftingami:"
  
crafting:
  numer1:
    item: "chest"
    nazwa: "&5Enderchest"
    lore: "&eKliknij, aby||&eprzejsc dalej..."
    guiname: "&5Crafting: Enderchestu"
    slot1: "stone"
      ilosc: 5
    slot2: "stone"
      ilosc: 5
    slot3: "stone"
      ilosc: 5
    slot4: "stone"
      ilosc: 5
    slot5: "stone"
      ilosc: 5
    slot6: "stone"
      ilosc: 5
    slot7: "stone"
      ilosc: 5
    slot8: "stone"
      ilosc: 5
    slot9: "stone"
      ilosc: 5

Nie wiesz jak się tworzy config. Twój "sposób" nie działa.

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
message:
  brakcraftingow: '&cAktualnie nie ma zadnego dodatkowego craftingu.'
  guicrafting: '&eMenu z craftingami:'
  
crafting:
  numer1:
    item: 'chest'
    nazwa: '&5Enderchest'
    lore: '&eKliknij, aby||&eprzejsc dalej...'
    guiname: '&5Crafting: Enderchestu'
    slot1: 'stone'
      ilosc: 5
    slot2: 'stone'
      ilosc: 5
    slot3: 'stone'
      ilosc: 5
    slot4: 'stone'
      ilosc: 5
    slot5: 'stone'
      ilosc: 5
    slot6: 'stone'
      ilosc: 5
    slot7: 'stone'
      ilosc: 5
    slot8: 'stone'
      ilosc: 5
    slot9: 'stone'
      ilosc: 5

Dajcie WSowi umrzeć, słabo obsługuje YML :v Ma masę błędów. Zmień to na SkUtilities - daje więcej i lepiej działa, łatwa obsługa i nie ma błędów :v

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ę...