US3R . 25 Opublikowano 13 lipca 2021 Udostępnij Opublikowano 13 lipca 2021 zatem, w skrypcie zapisuje treść z bazy danych do listy "jako tekst" set {variable::*} to objects in column "column" from result of query "select column from table" and close w treści zmiennej znajdują się przedmioty z ekwipunku gracza, zapisane w normalnej formie zmiennej listy ex. crafting table, diamond and emerald. problem polega na tym że po "przeprasowaniu" wartości do itemtype skrypt nie nadaje przedmiotów do ekwipunku loop {variable::*}: set {_item} to loop-value parsed as itemtype give {_item} to player na czym polega problem? Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/ Udostępnij na innych stronach Więcej opcji udostępniania...
0 knugi 794 Opublikowano 14 lipca 2021 Udostępnij Opublikowano 14 lipca 2021 Podaj przykładowe itemy z bazy danych. Ja potrzebowałem specjalnego konwertera który z tekstu robił itemy. Znajdziesz go w moich skryptach takich jak np kTrade. Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307168 Udostępnij na innych stronach Więcej opcji udostępniania...
0 US3R . 25 Opublikowano 14 lipca 2021 Autor Udostępnij Opublikowano 14 lipca 2021 (edytowane) itemy zapisuja sie normalnie np. diamond helmet, bedrock and diamond. ale problem jest w tym ze to tego nie chce "konwertowac" loop {items::*}: set {_item} to loop-value parsed as itemtype wydaje mi się że powinno działać normalnie, ale itemów nie nadaje. błędów brak możesz podać kawałek kodu z tym konwerterem? @knugi edit. zauważyłem że pojedynczy item normalnie nadaje, ale gdy dodam kolejny item rozdzielając and ex. diamond and emerald wtedy skrypt nie nadaje Edytowane 15 lipca 2021 przez US3R . Łączę posty, zamiast pisać nowy, w takiej sytuacji edytuj poprzedni. Notatka dodana przez JanekJaran Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307172 Udostępnij na innych stronach Więcej opcji udostępniania...
0 knugi 794 Opublikowano 15 lipca 2021 Udostępnij Opublikowano 15 lipca 2021 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 if {_item} is not item: 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 set {_lore::*} to split {_lore} by "||" return {_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} 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 {_lore::*} to split {_lore} by "||" set {_item} to {_item} parsed as item if {_item} is item: return {_item} with lore coloured {_lore::*} return air set {_item} to {_t} parsed as item if {_item} is item: return {_item} return air command /test [<text>]: trigger: set {_test::*} to objects in column "column" from result of query "select column from table" and close loop {_test::*}: set {_item} to getItemByText(loop-value) give {_item} to player Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307201 Udostępnij na innych stronach Więcej opcji udostępniania...
0 US3R . 25 Opublikowano 16 lipca 2021 Autor Udostępnij Opublikowano 16 lipca 2021 dobra teraz zauważyłem że problem jest w zapisywaniu itemów do zmiennej z bazy. gdy używam set {_test::*} to objects in column "column" from result of query "select column from table" and close to zmienna przechowuje wartość tylko tekst cały: czyli #wychodzi loop {_lista::*}: send "%loop-value% #tutaj wychodzi diamond and emerald #zamiast loop {_lista::*}: send "%loop-value% #chciałbym żeby wycodziło diamond send "%loop-value% #emerald jest jakaś szansa na przywrócenie tego do normalnej zmiennej z listą? @knugi Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307262 Udostępnij na innych stronach Więcej opcji udostępniania...
0 knugi 794 Opublikowano 16 lipca 2021 Udostępnij Opublikowano 16 lipca 2021 (edytowane) 21 godzin temu, US3R . napisał: dobra teraz zauważyłem że problem jest w zapisywaniu itemów do zmiennej z bazy. gdy używam set {_test::*} to objects in column "column" from result of query "select column from table" and close to zmienna przechowuje wartość tylko tekst cały: czyli #wychodzi loop {_lista::*}: send "%loop-value% #tutaj wychodzi diamond and emerald #zamiast loop {_lista::*}: send "%loop-value% #chciałbym żeby wycodziło diamond send "%loop-value% #emerald jest jakaś szansa na przywrócenie tego do normalnej zmiennej z listą? @knugi Tak, było coś takiego set {_s::} to {_getBaza} split at "," Tylko będziesz musiał zmienić and na przecinek później to zastosować //widzę że jeszcze nie przeczytałeś tego, więc umieszczam Ci przykładowy kod w razie byś nie mógł tego ogarnąć: command /test [<text>]: trigger: set {_test} to objects in column "column" from result of query "select column from table" and close replace all " and" with "," in {_test} set {_test::*} to split {_test} at "," loop {_test::*}: set {_item} to getItemByText(loop-value) give {_item} to player Edytowane 16 lipca 2021 przez knugi Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307284 Udostępnij na innych stronach Więcej opcji udostępniania...
0 US3R . 25 Opublikowano 17 lipca 2021 Autor Udostępnij Opublikowano 17 lipca 2021 18 godzin temu, knugi napisał: Tak, było coś takiego set {_s::} to {_getBaza} split at "," Tylko będziesz musiał zmienić and na przecinek później to zastosować //widzę że jeszcze nie przeczytałeś tego, więc umieszczam Ci przykładowy kod w razie byś nie mógł tego ogarnąć: command /test [<text>]: trigger: set {_test} to objects in column "column" from result of query "select column from table" and close replace all " and" with "," in {_test} set {_test::*} to split {_test} at "," loop {_test::*}: set {_item} to getItemByText(loop-value) give {_item} to player dzięki, już wszystko wiem. tylko co do funkcji zmiany stringu na itemtype, jest błąd którego nie jestem w stanie rozwiązać W dniu 15.07.2021 o 15:10, knugi napisał: Pokaż ukrytą 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 if {_item} is not item: 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 set {_lore::*} to split {_lore} by "||" return {_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} 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 {_lore::*} to split {_lore} by "||" set {_item} to {_item} parsed as item if {_item} is item: return {_item} with lore coloured {_lore::*} return air set {_item} to {_t} parsed as item if {_item} is item: return {_item} return air command /test [<text>]: trigger: set {_test::*} to objects in column "column" from result of query "select column from table" and close loop {_test::*}: set {_item} to getItemByText(loop-value) give {_item} to player Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307321 Udostępnij na innych stronach Więcej opcji udostępniania...
0 Gość Usunięty#34161 Opublikowano 17 lipca 2021 Udostępnij Opublikowano 17 lipca 2021 Problem został rozwiązany. Odnośnik do komentarza https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/#findComment-307374 Udostępnij na innych stronach Więcej opcji udostępniania...
Pytanie
US3R . 25
zatem, w skrypcie zapisuje treść z bazy danych do listy "jako tekst"
set {variable::*} to objects in column "column" from result of query "select column from table" and closew treści zmiennej znajdują się przedmioty z ekwipunku gracza, zapisane w normalnej formie zmiennej listy ex. crafting table, diamond and emerald.
problem polega na tym że po "przeprasowaniu" wartości do itemtype skrypt nie nadaje przedmiotów do ekwipunku
loop {variable::*}: set {_item} to loop-value parsed as itemtype give {_item} to playerna czym polega problem?
Odnośnik do komentarza
https://skript.pl/temat/49500-dawanie-przedmiot%C3%B3w-nie-dzia%C5%82a/Udostępnij na innych stronach
7 odpowiedzi na to pytanie
Rekomendowane odpowiedzi