Bvural41 1
Bvural41
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Hikaye Ekle

.script from object to .quest - Python3

  • Konuyu başlatan Konuyu başlatan muchomor1337
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 346

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

Video:


Code:
Kod:
# Script by Grzyb.ovh

def convert_to_quest(input_text, quest_name, state_name, npc_id, chat_option):
    quest_code = f"quest {quest_name} begin\n\tstate {state_name} begin\n\t\twhen {npc_id}.chat.\"{chat_option}\" begin\n"

    lines = input_text.split('\n')
    indentation_level = 0
    for line in lines:
        stripped_line = line.strip()

        if stripped_line.startswith("end"):
            indentation_level -= 1

        stripped_line = stripped_line.replace(" (", "(").replace(" )", ")")
        stripped_line = stripped_line.replace(" . ", ".")
        stripped_line = stripped_line.replace(' "', '"')

        indent = '\t' * (3 + indentation_level)
        quest_code += f"{indent}{stripped_line}\n"

        if stripped_line.startswith(("if", "while", "for")) and "end" not in stripped_line:
            indentation_level += 1

    quest_code += "\t\tend\n\tend\nend"

    return quest_code


def process_script_file(script_file_name, quest_name, state_name, npc_id, chat_option):
    with open(script_file_name, 'r', encoding='latin1') as f:
        input_text = f.read()

    quest_code = convert_to_quest(input_text, quest_name, state_name, npc_id, chat_option)

    quest_file_name = script_file_name.replace('.script', '.quest')
    with open(quest_file_name, 'w', encoding='latin1') as f:
        f.write(quest_code)


process_script_file('marriage_manage.start.0.script', 'weeding', 'start', 20358, 'Oldwoman')
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst