Oyun Seçeneklerine Oto Mesaj Ekleme [Python]

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 60

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
root/constinfo.py açılır ve şu kod eklenir;


WHISPER_OTO_MESAJ = 0
WHISPER_OTO_MESAJ_TEXT = ""

root/uigameoption.py açılır ve aratılır;


def __Initialize(self):

En alta şu kod eklenir:


self.showotoTextButtonList = [*]

Tekrar aratılır;


self.showDamageButtonList.append(GetObject("show_d amage_off_button"))

Altına şu kodlar eklenir:


self.showotoTextButtonList.append(GetObject("ototext_on_button2"))
self.showotoTextButtonList.append(GetObject("ototext_off_button2"))

Tekrar aratılır;


self.showDamageButtonList[1].SAFE_SetEvent(self.__OnClickShowDamageOffButton)

Altına şu kodlar eklenir:


self.showotoTextButtonList[0].SAFE_SetEvent(self.__OnClickOtoTextOnButton2)
self.showotoTextButtonList[1].SAFE_SetEvent(self.__OnClickOtoTextOffButton2)

Tekrar aratılır;


def OnUpdate(self):

Altına şu kodlar eklenir:


if constInfo.bildirimler == 0: if tek == 0:
self.showotoTextButtonList[0].Down()
self.showotoTextButtonList[1].SetUp()
tek = 1
#self.showotoTextButtonList[0].SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
else:
if tek == 0:
self.showotoTextButtonList[0].SetUp()
self.showotoTextButtonList[1].Down()
tek = 1
#self.showotoTextButtonList[1].SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
#self.showotoTextButtonList[0].SetUp()
#self.showotoTextButtonList[1].Down()

Tekrar aratılır;


def __IsSpecialMap(self):

Altına şu kodlar eklenir:


def __OnClickOtoTextOnButton2(self): global tek
tek = 0
self.showotoTextButtonList[0].Down()
self.showotoTextButtonList[1].SetUp()

def __OnClickOtoTextOffButton2(self):
global tek
tek = 0
self.showotoTextButtonList[0].SetUp()
self.showotoTextButtonList[1].Down()

ve root bölümüde bitti

sıra uiscript'e geldi

uiscript/gameoption.py açılır ve şu kodlar en alta eklenir;


{ "name" : "ototext_on_button2",
"type" : "radio_button",


"x" : LINE_DATA_X,
"y" : 240 + EK_Y + 25,


"text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_ON,


"default_image" : ROOT_PATH + "middle_button_01.sub",
"over_image" : ROOT_PATH + "middle_button_02.sub",
"down_image" : ROOT_PATH + "middle_button_03.sub",
},
{
"name" : "ototext_off_button2",
"type" : "radio_button",


"x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
"y" : 240 + EK_Y + 25,


"text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_OFF,


"default_image" : ROOT_PATH + "middle_button_01.sub",
"over_image" : ROOT_PATH + "middle_button_02.sub",
"down_image" : ROOT_PATH + "middle_button_03.sub",
},

Sistemin çalıştığına dair kanıt;

lWErnb.png

Oyun Seçeneklerine Oto Mesaj Ekleme [Python]

Metin2 özel sunucularında kullanıcı deneyimini artırmak ve oyun içi iletişimi geliştirmek adına otomatik mesaj ekleme sistemi oldukça popülerdir. Bu sistem sayesinde oyuncular belirli zaman aralıklarında veya belirli eylemlerde otomatik olarak tanıtımsal, bilgilendirici veya sunucuya özel mesajlar alabilirler. Bu yazıda, Python kullanarak nasıl bir otomatik mesaj sistemi kurabileceğinizi detaylıca inceleyeceğiz.

Python ile Oto Mesaj Sistemi Nedir?

Python, güçlü ve esnek yapısıyla özellikle script geliştirme alanında çok tercih edilir. Metin2 özel sunucularında da bu dili kullanarak hem server-side hem de client-side işlemler yapabilirsiniz. Otomatik mesaj sistemi, genellikle oyunculara belirli zaman aralıklarında sunucu duyuruları, olay bilgileri ya da sosyal medya bağlantıları gibi içerikler göstermek için kullanılır. Bu mesajlar genellikle oyun içi chat'e gönderilir veya popup şeklinde görüntülenebilir.

Python GUI ve Oto Mesaj Entegrasyonu

Python ile yazılmış bir GUI uygulaması kullanarak, mesaj içeriklerini kolayca yönetebilir ve zamanlamaları değiştirebilirsiniz. Tkinter gibi kütüphaneler yardımıyla basit bir arayüz tasarlanabilir. Bu sistem, py root dosyalarına entegre edilebilir ve sunucu tarafında çalışan bir timer mekanizması ile çalıştırılabilir. Böylece her mesajın ne zaman ve kimlere gönderileceği kontrol edilebilir.

Oto Mesaj Sisteminin Kurulumu

Kurulum aşamasında öncelikle Python kütüphaneleri projeye dahil edilmelidir. Gerekli olan temel kütüphaneler arasında time, random ve threading gibi modüller yer alır. Zamanlanmış mesaj gönderimi için threading kullanmak gecikmeleri önler. Ayrıca, mesajların gönderilmesi için chat sistemine entegre bir fonksiyon oluşturulmalıdır. Bu fonksiyon, sunucu tarafından belirlenen oyunculara veya tüm oyunculara mesaj gönderebilir.

Python Kod Örneği

Aşağıda basit bir otomatik mesaj gönderme örneği yer almaktadır:

import time
import random

messages = ['Hoş geldiniz!', 'Sunucumuzda aktif etkinlik var!', 'Sosyal medyadan bizi takip edin!']

def send_auto_message():
while True:
msg = random.choice(messages)
print(f'Mesaj gönderildi: {msg}')
time.sleep(300) # 5 dakikada bir

send_auto_message()

Bu örnek, 5 dakikada bir rastgele bir mesaj yazdırır. Gerçek bir Metin2 sisteminde bu çıktı, oyun içi sohbete yönlendirilmelidir.

Faydaları ve Kullanım Alanları

Bu tür sistemler, oyuncuların sunucuya daha fazla bağlanmasını sağlar. Aynı zamanda duyuru ve tanıtım amaçlı kullanılabileceği gibi, PvP olayları, özel görevler ve etkinlikler hakkında da bilgi verilebilir. Oto mesaj sistemi ile oyun içi etkileşim artırılır, bu da kullanıcı memnuniyetini doğrudan etkiler.

Sonuç

Python ile yazılmış bir otomatik mesaj sistemi, Metin2 özel sunucuları için harika bir araçtır. Kolayca özelleştirilebilir, entegre edilebilir ve zamanlaması kontrol edilebilir. Geliştiriciler için esneklik sunarken, oyuncular için de daha keyifli bir deneyim sağlar.


Adding Auto Message to Game Options [Python]

To enhance user experience and improve in-game communication in Metin2 private servers, the auto message system has become quite popular. This system allows players to receive automatic promotional, informative, or server-specific messages at certain intervals or during specific actions. In this article, we will examine in detail how you can implement an automatic messaging system using Python.

What is a Python Auto Message System?

Python, with its powerful and flexible structure, is widely preferred especially in script development. In Metin2 private servers, this language can be used for both server-side and client-side operations. The Auto message system is typically used to display content such as server announcements, event information, or social media links to players at specific time intervals. These messages are usually sent into the in-game chat or displayed as popups.

Python GUI and Auto Message Integration

Using a GUI application written in Python, you can easily manage message contents and adjust timing. With libraries like Tkinter, a simple interface can be designed. This system can be integrated into py root files and run via a timer mechanism operating on the server side. This way, control over when and to whom each message is sent becomes possible.

Installing the Auto Message System

During installation, Python libraries must be included in the project. Key libraries include modules like time, random, and threading. Threading is useful for scheduled message sending to avoid delays. Additionally, a function integrated into the chat system should be created for sending messages. This function can send messages to selected players or all players as determined by the server.

Python Code Example

Below is a basic example of automatic message sending:

import time
import random

messages = ['Welcome!', 'There is an active event on our server!', 'Follow us on social media!']

def send_auto_message():
while True:
msg = random.choice(messages)
print(f'Message sent: {msg}')
time.sleep(300) # Every 5 minutes

send_auto_message()

This example prints a random message every 5 minutes. In a real Metin2 system, this output should be directed into the in-game chat.

Benefits and Use Cases

Such systems encourage players to connect more frequently to the server. Additionally, they can be used for announcements and promotions, as well as providing information about PvP events, special quests, and activities. An auto message system increases in-game interaction, which directly impacts player satisfaction.

Conclusion

An automatic message system written in Python is an excellent tool for Metin2 private servers. It is customizable, integrable, and its timing can be controlled easily. While offering flexibility for developers, it also provides a more enjoyable experience for players.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt