AceOnward
Ağaç Yumruklayıcı
- Mesajlar
- 17
- En iyi cevaplar
- 0
- Beğeniler
- 5
- Puanları
- 0
Chatty JSON kullanarak YML dosyalarından basit chat menüleri oluşturmanızı sağlar.
"scripts" klasörüne yükledikten sonra ilk çalıştırmanızda örnek YML dosyaları otomatik olarak oluşturulacaktır, onlara bakarak kendi menülerinizi hazırlayabilirsiniz.
"/chattytest" komutuyla örnek YML dosyalarından oluşturulan GUI'lere ulaşabilirsiniz.
Kendi GUI'lerinize ulaşmak için:
YML örneği:
Örnek resim:
Sonraki sürümde eklenecekler:
İstenecek özellikleri eklemeye çalışırım
@Blueyescat Dosya yazımı ve sayı fonksiyonu için teşekkürler <3
"scripts" klasörüne yükledikten sonra ilk çalıştırmanızda örnek YML dosyaları otomatik olarak oluşturulacaktır, onlara bakarak kendi menülerinizi hazırlayabilirsiniz.
"/chattytest" komutuyla örnek YML dosyalarından oluşturulan GUI'lere ulaşabilirsiniz.
Kendi GUI'lerinize ulaşmak için:
Kod:
openChattyGui(player, "GUI'nin code-name değeri")
Kod:
options:
version: 0.11
choose-char: &9&l&k+
split-char: &9&l--
file-loc: plugins\\Skript\\scripts\\Chatty
p: &8[&6Chatty&8]&7
function isEven(num: number) :: boolean: # Blueyescat <3
"%{_num} / 2%" contains ".":
return false
else:
return true
function createChattyExamples(o: object):
if file "{@file-loc}\\-- CHATTY --" exists:
send "{@p} Chatty klasoru bulundu, isleniyor..." to console
else:
create file "{@file-loc}\\-- CHATTY --"
create file "{@file-loc}\\classic.yml"
create file "{@file-loc}\\two-in-one.yml"
add "chatty-gui:" to {_lines::*}
add " code-name: 'test-c'" to {_lines::*}
add " game-name: '&6Classic test'" to {_lines::*}
add " gui-design: 'classic'" to {_lines::*}
add " number-of-options: '1'" to {_lines::*}
add " options:" to {_lines::*}
add " 1:" to {_lines::*}
add " text: '&5Some text for option 1'" to {_lines::*}
add " tooltip: '&7Some text for option 1 tooltip'" to {_lines::*}
add " do-type: 'cmd'" to {_lines::*}
add " do: 'Chatty v{@version} (classic 1)'" to {_lines::*}
set file contents of "{@file-loc}\\classic.yml" to {_lines::*}
delete {_lines::*}
add "chatty-gui:" to {_lines::*}
add " code-name: 'test-tio'" to {_lines::*}
add " game-name: '&6Two-in-one test'" to {_lines::*}
add " gui-design: 'two-in-one'" to {_lines::*}
add " number-of-options: '2'" to {_lines::*}
add " options:" to {_lines::*}
add " 1:" to {_lines::*}
add " text: '&5Some text for option 1'" to {_lines::*}
add " tooltip: '&7Some text for option 1 tooltip'" to {_lines::*}
add " do-type: 'cmd'" to {_lines::*}
add " do: 'Chatty v{@version} (tio 1)'" to {_lines::*}
add " 2:" to {_lines::*}
add " text: '&5Some text for option 2'" to {_lines::*}
add " tooltip: '&7Some text for option 2 tooltip'" to {_lines::*}
add " do-type: 'cmd'" to {_lines::*}
add " do: 'Chatty v{@version} (tio 2)'" to {_lines::*}
set file contents of "{@file-loc}\\two-in-one.yml" to {_lines::*}
send "{@p} Chatty klasoru ve ornek YAML dosyalari olusturuldu!" to console
function loadChattyFiles(o: object):
delete {chatty::gui::*}
set {_files::*} to files in directory "{@file-loc}"
loop {_files::*}:
extension of file loop-value is "yml":
set {_fileloc-aslist::*} to loop-value split at "{@file-loc}"
set {_fileloc} to "{@file-loc}%last element of {_fileloc-aslist::*}%"
set {_n} to yml value "chatty-gui.code-name" of file {_fileloc}
set {chatty::gui::%{_n}%::game-name} to yml value "chatty-gui.game-name" of file {_fileloc}
set {chatty::gui::%{_n}%::gui-design} to yml value "chatty-gui.gui-design" of file {_fileloc}
set {_noo} to yml value "chatty-gui.number-of-options" of file {_fileloc}
set {chatty::gui::%{_n}%::number-of-options} to {_noo} parsed as integer
loop {chatty::gui::%{_n}%::number-of-options} times:
set {chatty::gui::%{_n}%::options::%loop-number%::text} to yml value "chatty-gui.options.%loop-number%.text" of file {_fileloc}
set {chatty::gui::%{_n}%::options::%loop-number%::tooltip} to yml value "chatty-gui.options.%loop-number%.tooltip" of file {_fileloc}
set {chatty::gui::%{_n}%::options::%loop-number%::do-type} to yml value "chatty-gui.options.%loop-number%.do-type" of file {_fileloc}
set {chatty::gui::%{_n}%::options::%loop-number%::do} to yml value "chatty-gui.options.%loop-number%.do" of file {_fileloc}
send "{@p} Chatty dosyalari islendi!" to console
function openChattyGui(p: player, n: string):
set {_ret} to "%{chatty::gui::%{_n}%::game-name}%||%nl%||"
{chatty::gui::%{_n}%::gui-design} is "classic":
loop {chatty::gui::%{_n}%::number-of-options} times:
loop-number is {chatty::gui::%{_n}%::number-of-options}:
set {_ret} to "%{_ret}% ||{@choose-char}&r|| ||%{chatty::gui::%{_n}%::options::%loop-number%::text}%||ttp:%{chatty::gui::%{_n}%::options::%loop-number%::tooltip}%||%{chatty::gui::%{_n}%::options::%loop-number%::do-type}%:%{chatty::gui::%{_n}%::options::%loop-number%::do}%"
else:
set {_ret} to "%{_ret}% ||{@choose-char}&r|| ||%{chatty::gui::%{_n}%::options::%loop-number%::text}%||ttp:%{chatty::gui::%{_n}%::options::%loop-number%::tooltip}%||%{chatty::gui::%{_n}%::options::%loop-number%::do-type}%:%{chatty::gui::%{_n}%::options::%loop-number%::do}%||"
json("%{_p}%", "%{_ret}%")
{chatty::gui::%{_n}%::gui-design} is "two-in-one":
if isEven({chatty::gui::%{_n}%::number-of-options}) is true:
set {_c} to 1
loop {chatty::gui::%{_n}%::number-of-options}/2 times:
set {_ln0} to "%{chatty::gui::%{_n}%::options::%{_c}%::text}%||ttp:%{chatty::gui::%{_n}%::options::%{_c}%::tooltip}%||%{chatty::gui::%{_n}%::options::%{_c}%::do-type}%:%{chatty::gui::%{_n}%::options::%{_c}%::do}%"
add 1 to {_c}
set {_ln1} to "%{chatty::gui::%{_n}%::options::%{_c}%::text}%||ttp:%{chatty::gui::%{_n}%::options::%{_c}%::tooltip}%||%{chatty::gui::%{_n}%::options::%{_c}%::do-type}%:%{chatty::gui::%{_n}%::options::%{_c}%::do}%"
add 1 to {_c}
loop-number is {chatty::gui::%{_n}%::number-of-options}/2:
set {_ret} to "%{_ret}% ||%{_ln0}%|| {@split-char} ||%{_ln1}%"
else:
set {_ret} to "%{_ret}% ||%{_ln0}%|| {@split-char} ||%{_ln1}%||%nl%"
json("%{_p}%", "%{_ret}%")
else:
send "{@p} GUI '%{_n}%' seçenek sayısı çift sayı olmalı!" to {_p}
on load:
delete {chatty::*}
createChattyExamples(0)
loadChattyFiles(0)
command chatty-reload:
permission: chatty.op
trigger:
loadChattyFiles(0)
command chattytest:
permission: chatty.op
trigger:
openChattyGui(player, "test-c")
openChattyGui(player, "test-tio")
YML örneği:
Kod:
chatty-gui:
code-name: 'test-c'
game-name: '§6Classic test'
gui-design: 'classic'
number-of-options: '1'
options:
1:
text: '§5Some text for option 1'
tooltip: '§7Some text for option 1 tooltip'
do-type: 'cmd'
do: 'Chatty v0.1 (classic 1)'
- code-name: GUI'nin koddaki adıdır. BENZERSİZ olması gerekmektedir.
- game-name: GUI'nin oyundaki adıdır. Oyuncuya gösterilir.
- gui-design: GUI'nin dizayn tipidir. Şu anki tipler "classic" ve "two-in-one" dır.
- number-of-options: GUI'deki seçenek sayısıdır.
- options.(sayı).text: Seçeneğin yazısıdır. Tıklanacak olan kısım burasıdır.
- options.(sayı).tooltip: Seçeneğin üzerine gelince çıkacak yazıdır.
- options.(sayı).do-type: Seçeneğe tıklanınca yapılacak işlemin tipidir. "json.sk" içerisinde "sgt", "cmd", "ins" ve "url" işlemlerini barındırır.
- options.(sayı).do: Seçeneğe tıklanınca yapılacak işlemdir.
Örnek resim:
Sonraki sürümde eklenecekler:
Kod:
+ Yer tutucular (oyuncu ismi, tarih vb.)
+ Daha fazla GUI dizayn tipi
- WolvSK zorunluluğu kaldırıldı
- Dosyaları yenileme komutu eklendi (test aşamasında)
İstenecek özellikleri eklemeye çalışırım
@Blueyescat Dosya yazımı ve sayı fonksiyonu için teşekkürler <3
Son düzenleme: